MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / main

Function main

libminifi/test/integration/ProvenanceReportingTest.cpp:43–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#include "utils/IntegrationTestUtils.h"
42
43int main(int argc, char **argv) {
44 using org::apache::nifi::minifi::utils::verifyLogLinePresenceInPollTime;
45
46 std::string test_file_location;
47 if (argc > 1) {
48 test_file_location = argv[1];
49 }
50 // need to change test to not use temp dir
51#ifndef WIN32
52 mkdir("/tmp/aljs39/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
53
54 mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
55
56 LogTestController::getInstance().setDebug<core::ProcessGroup>();
57
58 std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
59 std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
60 std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
61
62 configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
63 std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration);
64 std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
65 std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(
66 new core::YamlConfiguration(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location));
67 std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
68
69 std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(
70 test_repo, test_flow_repo, configuration, std::move(yaml_ptr), content_repo, DEFAULT_ROOT_GROUP_NAME, true);
71
72 core::YamlConfiguration yaml_config(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location);
73
74 std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot();
75 std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
76 ptr.release();
77 std::shared_ptr<org::apache::nifi::minifi::io::SocketContext> socket_context = std::make_shared<org::apache::nifi::minifi::io::SocketContext>(std::make_shared<minifi::Configure>());
78 org::apache::nifi::minifi::io::ServerSocket server(socket_context, "localhost", 10005, 1);
79
80 controller->load();
81 controller->start();
82
83 assert(verifyLogLinePresenceInPollTime(std::chrono::milliseconds(std::chrono::seconds(2)), "Add processor SiteToSiteProvenanceReportingTask into process group MiNiFi Flow"));
84
85 controller->waitUnload(60000);
86 LogTestController::getInstance().reset();
87 rmdir("./content_repository");
88 rmdir("/tmp/aljs39/");
89#endif
90 return 0;
91}

Callers

nothing calls this directly

Calls 8

setMethod · 0.45
getRootMethod · 0.45
getMethod · 0.45
loadMethod · 0.45
startMethod · 0.45
waitUnloadMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected