| 64 | }; |
| 65 | |
| 66 | int main(int argc, char **argv) { |
| 67 | using org::apache::nifi::minifi::utils::verifyLogLinePresenceInPollTime; |
| 68 | const cmd_args args = parse_cmdline_args(argc, argv); |
| 69 | |
| 70 | LogTestController::getInstance().setDebug<core::Processor>(); |
| 71 | LogTestController::getInstance().setDebug<core::ProcessSession>(); |
| 72 | LogTestController::getInstance().setDebug<utils::HTTPClient>(); |
| 73 | LogTestController::getInstance().setDebug<minifi::controllers::SSLContextService>(); |
| 74 | LogTestController::getInstance().setDebug<minifi::processors::InvokeHTTP>(); |
| 75 | LogTestController::getInstance().setDebug<minifi::processors::LogAttribute>(); |
| 76 | |
| 77 | std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>(); |
| 78 | configuration->set(minifi::Configure::nifi_default_directory, args.key_dir); |
| 79 | |
| 80 | std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>(); |
| 81 | std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>(); |
| 82 | |
| 83 | configuration->set(minifi::Configure::nifi_flow_configuration_file, args.test_file); |
| 84 | |
| 85 | std::shared_ptr<minifi::io::StreamFactory> stream_factory = minifi::io::StreamFactory::getInstance(configuration); |
| 86 | |
| 87 | std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>(); |
| 88 | |
| 89 | content_repo->initialize(configuration); |
| 90 | |
| 91 | std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>( |
| 92 | new core::YamlConfiguration(test_repo, test_repo, content_repo, stream_factory, configuration, args.test_file)); |
| 93 | std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo); |
| 94 | |
| 95 | std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>( |
| 96 | test_repo, test_flow_repo, configuration, std::move(yaml_ptr), content_repo, DEFAULT_ROOT_GROUP_NAME, true); |
| 97 | |
| 98 | core::YamlConfiguration yaml_config(test_repo, test_repo, content_repo, stream_factory, configuration, args.test_file); |
| 99 | |
| 100 | std::shared_ptr<core::Processor> proc = yaml_config.getRoot()->findProcessorByName("invoke"); |
| 101 | assert(proc != nullptr); |
| 102 | |
| 103 | const auto inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc); |
| 104 | assert(inv != nullptr); |
| 105 | |
| 106 | std::string url; |
| 107 | inv->getProperty(minifi::processors::InvokeHTTP::URL.getName(), url); |
| 108 | HttpResponder h_ex; |
| 109 | std::string port, scheme, path; |
| 110 | std::unique_ptr<TestServer> server; |
| 111 | parse_http_components(url, port, scheme, path); |
| 112 | CivetCallbacks callback{}; |
| 113 | if (scheme == "https") { |
| 114 | std::string cert; |
| 115 | cert = args.key_dir + "nifi-cert.pem"; |
| 116 | memset(&callback, 0, sizeof(callback)); |
| 117 | callback.init_ssl = ssl_enable; |
| 118 | std::string https_port = port + "s"; |
| 119 | callback.log_message = log_message; |
| 120 | server = utils::make_unique<TestServer>(https_port, path, &h_ex, &callback, cert, cert); |
| 121 | } else { |
| 122 | server = utils::make_unique<TestServer>(port, path, &h_ex); |
| 123 | } |
nothing calls this directly
no test coverage detected