You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bq...@apache.org on 2017/11/27 17:42:02 UTC
nifi-minifi-cpp git commit: MINIFICPP-320: Change Processors to be
within their own linked object
Repository: nifi-minifi-cpp
Updated Branches:
refs/heads/master 0e4ce79b7 -> d6c28e1ce
MINIFICPP-320: Change Processors to be within their own linked object
This closes #206.
This will facilitate the eventual move and documentation that follows
enabling a processor module.
Signed-off-by: Bin Qiu <be...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/d6c28e1c
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/d6c28e1c
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/d6c28e1c
Branch: refs/heads/master
Commit: d6c28e1ce284f57061fce1497f40d433609c9724
Parents: 0e4ce79
Author: Marc Parisi <ph...@apache.org>
Authored: Sun Nov 5 10:52:35 2017 -0500
Committer: Bin Qiu <be...@gmail.com>
Committed: Mon Nov 27 09:40:12 2017 -0800
----------------------------------------------------------------------
cmake/BuildTests.cmake | 11 +-
libminifi/include/core/FlowConfiguration.h | 11 +-
libminifi/include/core/Resource.h | 106 +++---
libminifi/include/core/yaml/YamlConfiguration.h | 1 -
libminifi/include/processors/LoadProcessors.h | 33 --
.../test/archive-tests/CompressContentTests.cpp | 1 +
.../test/archive-tests/FocusArchiveTests.cpp | 1 +
.../archive-tests/ManipulateArchiveTests.cpp | 1 +
libminifi/test/archive-tests/MergeFileTests.cpp | 1 +
.../test/curl-tests/C2NullConfiguration.cpp | 1 +
.../curl-tests/C2VerifyHeartbeatAndStop.cpp | 309 +++++++++---------
.../test/curl-tests/C2VerifyServeResults.cpp | 1 +
.../test/curl-tests/HttpGetIntegrationTest.cpp | 321 ++++++++++---------
.../test/curl-tests/HttpPostIntegrationTest.cpp | 2 +
libminifi/test/curl-tests/ThreadPoolAdjust.cpp | 225 ++++++-------
.../test/curl-tests/unit/InvokeHTTPTests.cpp | 3 +
.../test/script-tests/LuaExecuteScriptTests.cpp | 3 +
.../script-tests/PythonExecuteScriptTests.cpp | 3 +
libminifi/test/unit/ExtractTextTests.cpp | 2 +
libminifi/test/unit/TailFileTests.cpp | 2 +
main/CMakeLists.txt | 11 +-
21 files changed, 524 insertions(+), 525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/cmake/BuildTests.cmake
----------------------------------------------------------------------
diff --git a/cmake/BuildTests.cmake b/cmake/BuildTests.cmake
index 00ba43b..120064a 100644
--- a/cmake/BuildTests.cmake
+++ b/cmake/BuildTests.cmake
@@ -59,10 +59,15 @@ function(createTests testName)
target_include_directories(${testName} BEFORE PRIVATE "${Boost_INCLUDE_DIRS}")
endif()
target_link_libraries(${testName} ${SPD_LIB} ${TEST_BASE_LIB})
- target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES} core-minifi minifi yaml-cpp c-library civetweb-cpp ${JSON_CPP_LIB})
+ target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES} core-minifi yaml-cpp c-library civetweb-cpp ${JSON_CPP_LIB})
+ if (APPLE)
+ target_link_libraries (${testName} -Wl,-all_load minifi)
+ else ()
+ target_link_libraries (${testName} -Wl,--whole-archive minifi -Wl,--no-whole-archive)
+ endif ()
if (Boost_FOUND)
- target_link_libraries(${testName} ${Boost_SYSTEM_LIBRARY})
- target_link_libraries(${testName} ${Boost_FILESYSTEM_LIBRARY})
+ target_link_libraries(${testName} ${Boost_SYSTEM_LIBRARY})
+ target_link_libraries(${testName} ${Boost_FILESYSTEM_LIBRARY})
endif()
endfunction()
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/include/core/FlowConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/FlowConfiguration.h b/libminifi/include/core/FlowConfiguration.h
index 1d0b638..a45958e 100644
--- a/libminifi/include/core/FlowConfiguration.h
+++ b/libminifi/include/core/FlowConfiguration.h
@@ -25,17 +25,8 @@
#include "core/controller/StandardControllerServiceProvider.h"
#include "provenance/Provenance.h"
#include "core/reporting/SiteToSiteProvenanceReportingTask.h"
-#include "processors/GetFile.h"
-#include "processors/PutFile.h"
-#include "processors/TailFile.h"
-#include "processors/ListenSyslog.h"
-#include "processors/GenerateFlowFile.h"
-#include "processors/ListenHTTP.h"
-#include "processors/LogAttribute.h"
-#include "processors/ExecuteProcess.h"
-#include "processors/AppendHostInfo.h"
-
#include "core/Processor.h"
+#include "core/Resource.h"
#include "core/logging/LoggerConfiguration.h"
#include "core/ProcessContext.h"
#include "core/ProcessSession.h"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/include/core/Resource.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Resource.h b/libminifi/include/core/Resource.h
index 1787843..8bb7c97 100644
--- a/libminifi/include/core/Resource.h
+++ b/libminifi/include/core/Resource.h
@@ -1,53 +1,53 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef LIBMINIFI_INCLUDE_CORE_RESOURCE_H_
-#define LIBMINIFI_INCLUDE_CORE_RESOURCE_H_
-
-#include "ClassLoader.h"
-
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
-namespace core {
-
-template<class T>
-class StaticClassType {
- public:
-
- StaticClassType(const std::string &name) {
- // Notify when the static member is created
- ClassLoader::getDefaultClassLoader().registerClass(name, std::unique_ptr<ObjectFactory>(new DefautObjectFactory<T>()));
- }
-};
-
-#define REGISTER_RESOURCE(CLASSNAME) \
- static core::StaticClassType<CLASSNAME> \
- CLASSNAME##_registrar( #CLASSNAME );
-
-#define REGISTER_RESOURCE_AS(CLASSNAME,NAME) \
- static core::StaticClassType<CLASSNAME> \
- CLASSNAME##_registrar( #NAME );
-
-}/* namespace core */
-} /* namespace minifi */
-} /* namespace nifi */
-} /* namespace apache */
-} /* namespace org */
-
-#endif /* LIBMINIFI_INCLUDE_CORE_RESOURCE_H_ */
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef LIBMINIFI_INCLUDE_CORE_RESOURCE_H_
+#define LIBMINIFI_INCLUDE_CORE_RESOURCE_H_
+
+#include "ClassLoader.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace core {
+
+template<class T>
+class StaticClassType {
+ public:
+
+ StaticClassType(const std::string &name) {
+ // Notify when the static member is created
+ ClassLoader::getDefaultClassLoader().registerClass(name, std::unique_ptr<ObjectFactory>(new DefautObjectFactory<T>()));
+ }
+};
+
+#define REGISTER_RESOURCE(CLASSNAME) \
+ static core::StaticClassType<CLASSNAME> \
+ CLASSNAME##_registrar( #CLASSNAME );
+
+#define REGISTER_RESOURCE_AS(CLASSNAME,NAME) \
+ static core::StaticClassType<CLASSNAME> \
+ CLASSNAME##_registrar( #NAME );
+
+}/* namespace core */
+} /* namespace minifi */
+} /* namespace nifi */
+} /* namespace apache */
+} /* namespace org */
+
+#endif /* LIBMINIFI_INCLUDE_CORE_RESOURCE_H_ */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/include/core/yaml/YamlConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/yaml/YamlConfiguration.h b/libminifi/include/core/yaml/YamlConfiguration.h
index 112725e..c5153f4 100644
--- a/libminifi/include/core/yaml/YamlConfiguration.h
+++ b/libminifi/include/core/yaml/YamlConfiguration.h
@@ -20,7 +20,6 @@
#include "core/ProcessorConfig.h"
#include "yaml-cpp/yaml.h"
-#include "processors/LoadProcessors.h"
#include "core/FlowConfiguration.h"
#include "sitetosite/SiteToSite.h"
#include <string>
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/include/processors/LoadProcessors.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/LoadProcessors.h b/libminifi/include/processors/LoadProcessors.h
deleted file mode 100644
index 2fc4374..0000000
--- a/libminifi/include/processors/LoadProcessors.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef LIBMINIFI_INCLUDE_PROCESSORS_LOADPROCESSORS_H_
-#define LIBMINIFI_INCLUDE_PROCESSORS_LOADPROCESSORS_H_
-
-#include "core/Core.h"
-#include "core/Resource.h"
-#include "AppendHostInfo.h"
-#include "ExecuteProcess.h"
-#include "GenerateFlowFile.h"
-#include "GetFile.h"
-#include "GetTCP.h"
-#include "ListenHTTP.h"
-#include "LogAttribute.h"
-#include "PutFile.h"
-#include "TailFile.h"
-
-#endif /* LIBMINIFI_INCLUDE_PROCESSORS_LOADPROCESSORS_H_ */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/archive-tests/CompressContentTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/archive-tests/CompressContentTests.cpp b/libminifi/test/archive-tests/CompressContentTests.cpp
index a543ef4..3c51277 100644
--- a/libminifi/test/archive-tests/CompressContentTests.cpp
+++ b/libminifi/test/archive-tests/CompressContentTests.cpp
@@ -37,6 +37,7 @@
#include "FlowFileRecord.h"
#include <sstream>
#include <iostream>
+#include "processors/LogAttribute.h"
static const char* EXPECT_COMPRESS_CONTENT = "/tmp/minifi-expect-compresscontent.txt";
static const char* COMPRESS_CONTENT = "/tmp/minifi-compresscontent";
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/archive-tests/FocusArchiveTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/archive-tests/FocusArchiveTests.cpp b/libminifi/test/archive-tests/FocusArchiveTests.cpp
index 87fab1b..0934208 100644
--- a/libminifi/test/archive-tests/FocusArchiveTests.cpp
+++ b/libminifi/test/archive-tests/FocusArchiveTests.cpp
@@ -29,6 +29,7 @@
#include "ArchiveTests.h"
#include "processors/GetFile.h"
#include "processors/PutFile.h"
+#include "processors/LogAttribute.h"
#include "FocusArchiveEntry.h"
#include "UnfocusArchiveEntry.h"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/archive-tests/ManipulateArchiveTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/archive-tests/ManipulateArchiveTests.cpp b/libminifi/test/archive-tests/ManipulateArchiveTests.cpp
index e8491f0..3bc23b7 100644
--- a/libminifi/test/archive-tests/ManipulateArchiveTests.cpp
+++ b/libminifi/test/archive-tests/ManipulateArchiveTests.cpp
@@ -28,6 +28,7 @@
#include "../TestBase.h"
#include "ArchiveTests.h"
#include "processors/GetFile.h"
+#include "processors/LogAttribute.h"
#include "processors/PutFile.h"
#include "ManipulateArchive.h"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/archive-tests/MergeFileTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/archive-tests/MergeFileTests.cpp b/libminifi/test/archive-tests/MergeFileTests.cpp
index 361048b..d1b42c6 100644
--- a/libminifi/test/archive-tests/MergeFileTests.cpp
+++ b/libminifi/test/archive-tests/MergeFileTests.cpp
@@ -35,6 +35,7 @@
#include "MergeContent.h"
#include <sstream>
#include <iostream>
+#include "processors/LogAttribute.h"
static const char* FLOW_FILE = "/tmp/minifi-mergecontent";
static const char* EXPECT_MERGE_CONTENT_FIRST = "/tmp/minifi-expect-mergecontent1.txt";
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/C2NullConfiguration.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/C2NullConfiguration.cpp b/libminifi/test/curl-tests/C2NullConfiguration.cpp
index d163a21..cbb1831 100644
--- a/libminifi/test/curl-tests/C2NullConfiguration.cpp
+++ b/libminifi/test/curl-tests/C2NullConfiguration.cpp
@@ -49,6 +49,7 @@
#include "c2/C2Agent.h"
#include "protocols/RESTReceiver.h"
#include "../integration/IntegrationBase.h"
+#include "processors/LogAttribute.h"
class VerifyC2Server : public IntegrationBase {
public:
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/C2VerifyHeartbeatAndStop.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/C2VerifyHeartbeatAndStop.cpp b/libminifi/test/curl-tests/C2VerifyHeartbeatAndStop.cpp
index a8fb04c..69c9a3b 100644
--- a/libminifi/test/curl-tests/C2VerifyHeartbeatAndStop.cpp
+++ b/libminifi/test/curl-tests/C2VerifyHeartbeatAndStop.cpp
@@ -1,154 +1,155 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/stat.h>
-#undef NDEBUG
-#include <cassert>
-#include <utility>
-#include <chrono>
-#include <fstream>
-#include <memory>
-#include <string>
-#include <thread>
-#include <type_traits>
-#include <vector>
-#include <iostream>
-#include <sstream>
-#include "HTTPClient.h"
-#include "InvokeHTTP.h"
-#include "../TestBase.h"
-#include "utils/StringUtils.h"
-#include "core/Core.h"
-#include "../include/core/logging/Logger.h"
-#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
-#include "FlowController.h"
-#include "properties/Configure.h"
-#include "../unit/ProvenanceTestHelper.h"
-#include "io/StreamFactory.h"
-#include "CivetServer.h"
-#include "RemoteProcessorGroupPort.h"
-#include "core/ConfigurableComponent.h"
-#include "controllers/SSLContextService.h"
-#include "../TestServer.h"
-#include "c2/C2Agent.h"
-#include "RESTReceiver.h"
-#include "../integration/IntegrationBase.h"
-
-class Responder : public CivetHandler {
- public:
- explicit Responder(bool isSecure)
- : isSecure(isSecure) {
- }
- bool handlePost(CivetServer *server, struct mg_connection *conn) {
- std::string resp =
- "{\"operation\" : \"heartbeat\", \"requested_operations\" : [{ \"operationid\" : 41, \"operation\" : \"stop\", \"name\" : \"invoke\" }, "
- "{ \"operationid\" : 42, \"operation\" : \"stop\", \"name\" : \"FlowController\" } ]}";
- mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n",
- resp.length());
- mg_printf(conn, "%s", resp.c_str());
- return true;
- }
-
- protected:
- bool isSecure;
-};
-
-class VerifyC2Heartbeat : public IntegrationBase {
- public:
- explicit VerifyC2Heartbeat(bool isSecure)
- : isSecure(isSecure) {
- char format[] = "/tmp/ssth.XXXXXX";
- dir = testController.createTempDirectory(format);
- }
-
- void testSetup() {
- LogTestController::getInstance().setDebug<utils::HTTPClient>();
- LogTestController::getInstance().setTrace<minifi::c2::C2Agent>();
- LogTestController::getInstance().setDebug<LogTestController>();
- LogTestController::getInstance().setDebug<minifi::c2::RESTSender>();
- LogTestController::getInstance().setDebug<minifi::c2::RESTProtocol>();
- LogTestController::getInstance().setDebug<minifi::c2::RESTReceiver>();
- std::fstream file;
- ss << dir << "/" << "tstFile.ext";
- file.open(ss.str(), std::ios::out);
- file << "tempFile";
- file.close();
- }
-
- void cleanup() {
- LogTestController::getInstance().reset();
- unlink(ss.str().c_str());
- }
-
- void runAssertions() {
- assert(LogTestController::getInstance().contains("Received Ack from Server") == true);
-
- assert(LogTestController::getInstance().contains("C2Agent] [debug] Stopping component invoke") == true);
-
- assert(LogTestController::getInstance().contains("C2Agent] [debug] Stopping component FlowController") == true);
- }
-
- void queryRootProcessGroup(std::shared_ptr<core::ProcessGroup> pg) {
- std::shared_ptr<core::Processor> proc = pg->findProcessor("invoke");
- assert(proc != nullptr);
-
- std::shared_ptr<minifi::processors::InvokeHTTP> inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc);
-
- assert(inv != nullptr);
- std::string url = "";
- inv->getProperty(minifi::processors::InvokeHTTP::URL.getName(), url);
-
- configuration->set("c2.rest.url", "http://localhost:8888/api/heartbeat");
- configuration->set("c2.agent.heartbeat.period", "1000");
- configuration->set("c2.rest.url.ack", "http://localhost:8888/api/heartbeat");
- }
-
- protected:
- bool isSecure;
- char *dir;
- std::stringstream ss;
- TestController testController;
-};
-
-int main(int argc, char **argv) {
- std::string key_dir, test_file_location, url;
- url = "http://localhost:8888/api/heartbeat";
- if (argc > 1) {
- test_file_location = argv[1];
- key_dir = argv[2];
- }
-
- bool isSecure = false;
- if (url.find("https") != std::string::npos) {
- isSecure = true;
- }
-
- VerifyC2Heartbeat harness(isSecure);
-
- harness.setKeyDir(key_dir);
-
- Responder responder(isSecure);
-
- harness.setUrl(url, &responder);
-
- harness.run(test_file_location);
-
- return 0;
-}
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/stat.h>
+#undef NDEBUG
+#include <cassert>
+#include <utility>
+#include <chrono>
+#include <fstream>
+#include <memory>
+#include <string>
+#include <thread>
+#include <type_traits>
+#include <vector>
+#include <iostream>
+#include <sstream>
+#include "HTTPClient.h"
+#include "InvokeHTTP.h"
+#include "../TestBase.h"
+#include "utils/StringUtils.h"
+#include "core/Core.h"
+#include "../include/core/logging/Logger.h"
+#include "core/ProcessGroup.h"
+#include "core/yaml/YamlConfiguration.h"
+#include "FlowController.h"
+#include "properties/Configure.h"
+#include "../unit/ProvenanceTestHelper.h"
+#include "io/StreamFactory.h"
+#include "CivetServer.h"
+#include "RemoteProcessorGroupPort.h"
+#include "core/ConfigurableComponent.h"
+#include "controllers/SSLContextService.h"
+#include "../TestServer.h"
+#include "c2/C2Agent.h"
+#include "RESTReceiver.h"
+#include "../integration/IntegrationBase.h"
+#include "processors/LogAttribute.h"
+
+class Responder : public CivetHandler {
+ public:
+ explicit Responder(bool isSecure)
+ : isSecure(isSecure) {
+ }
+ bool handlePost(CivetServer *server, struct mg_connection *conn) {
+ std::string resp =
+ "{\"operation\" : \"heartbeat\", \"requested_operations\" : [{ \"operationid\" : 41, \"operation\" : \"stop\", \"name\" : \"invoke\" }, "
+ "{ \"operationid\" : 42, \"operation\" : \"stop\", \"name\" : \"FlowController\" } ]}";
+ mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: "
+ "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n",
+ resp.length());
+ mg_printf(conn, "%s", resp.c_str());
+ return true;
+ }
+
+ protected:
+ bool isSecure;
+};
+
+class VerifyC2Heartbeat : public IntegrationBase {
+ public:
+ explicit VerifyC2Heartbeat(bool isSecure)
+ : isSecure(isSecure) {
+ char format[] = "/tmp/ssth.XXXXXX";
+ dir = testController.createTempDirectory(format);
+ }
+
+ void testSetup() {
+ LogTestController::getInstance().setDebug<utils::HTTPClient>();
+ LogTestController::getInstance().setTrace<minifi::c2::C2Agent>();
+ LogTestController::getInstance().setDebug<LogTestController>();
+ LogTestController::getInstance().setDebug<minifi::c2::RESTSender>();
+ LogTestController::getInstance().setDebug<minifi::c2::RESTProtocol>();
+ LogTestController::getInstance().setDebug<minifi::c2::RESTReceiver>();
+ std::fstream file;
+ ss << dir << "/" << "tstFile.ext";
+ file.open(ss.str(), std::ios::out);
+ file << "tempFile";
+ file.close();
+ }
+
+ void cleanup() {
+ LogTestController::getInstance().reset();
+ unlink(ss.str().c_str());
+ }
+
+ void runAssertions() {
+ assert(LogTestController::getInstance().contains("Received Ack from Server") == true);
+
+ assert(LogTestController::getInstance().contains("C2Agent] [debug] Stopping component invoke") == true);
+
+ assert(LogTestController::getInstance().contains("C2Agent] [debug] Stopping component FlowController") == true);
+ }
+
+ void queryRootProcessGroup(std::shared_ptr<core::ProcessGroup> pg) {
+ std::shared_ptr<core::Processor> proc = pg->findProcessor("invoke");
+ assert(proc != nullptr);
+
+ std::shared_ptr<minifi::processors::InvokeHTTP> inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc);
+
+ assert(inv != nullptr);
+ std::string url = "";
+ inv->getProperty(minifi::processors::InvokeHTTP::URL.getName(), url);
+
+ configuration->set("c2.rest.url", "http://localhost:8888/api/heartbeat");
+ configuration->set("c2.agent.heartbeat.period", "1000");
+ configuration->set("c2.rest.url.ack", "http://localhost:8888/api/heartbeat");
+ }
+
+ protected:
+ bool isSecure;
+ char *dir;
+ std::stringstream ss;
+ TestController testController;
+};
+
+int main(int argc, char **argv) {
+ std::string key_dir, test_file_location, url;
+ url = "http://localhost:8888/api/heartbeat";
+ if (argc > 1) {
+ test_file_location = argv[1];
+ key_dir = argv[2];
+ }
+
+ bool isSecure = false;
+ if (url.find("https") != std::string::npos) {
+ isSecure = true;
+ }
+
+ VerifyC2Heartbeat harness(isSecure);
+
+ harness.setKeyDir(key_dir);
+
+ Responder responder(isSecure);
+
+ harness.setUrl(url, &responder);
+
+ harness.run(test_file_location);
+
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/C2VerifyServeResults.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/C2VerifyServeResults.cpp b/libminifi/test/curl-tests/C2VerifyServeResults.cpp
index 625a5f2..961fec0 100644
--- a/libminifi/test/curl-tests/C2VerifyServeResults.cpp
+++ b/libminifi/test/curl-tests/C2VerifyServeResults.cpp
@@ -49,6 +49,7 @@
#include "c2/C2Agent.h"
#include "RESTReceiver.h"
#include "../integration/IntegrationBase.h"
+#include "processors/LogAttribute.h"
class VerifyC2Server : public IntegrationBase {
public:
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/HttpGetIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/HttpGetIntegrationTest.cpp b/libminifi/test/curl-tests/HttpGetIntegrationTest.cpp
index 0b18324..702be14 100644
--- a/libminifi/test/curl-tests/HttpGetIntegrationTest.cpp
+++ b/libminifi/test/curl-tests/HttpGetIntegrationTest.cpp
@@ -1,159 +1,162 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define CURLOPT_SSL_VERIFYPEER_DISABLE 1
-#include <sys/stat.h>
-#undef NDEBUG
-#include <cassert>
-#include <utility>
-#include <chrono>
-#include <fstream>
-#include <memory>
-#include <string>
-#include <thread>
-#include <type_traits>
-#include <vector>
-#include "HTTPClient.h"
-#include "InvokeHTTP.h"
-#include "../TestServer.h"
-#include "../TestBase.h"
-#include "utils/StringUtils.h"
-#include "core/Core.h"
-#include "../include/core/logging/Logger.h"
-#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
-#include "FlowController.h"
-#include "properties/Configure.h"
-#include "../unit/ProvenanceTestHelper.h"
-#include "io/StreamFactory.h"
-
-void waitToVerifyProcessor() {
- std::this_thread::sleep_for(std::chrono::seconds(10));
-}
-
-int log_message(const struct mg_connection *conn, const char *message) {
- puts(message);
- return 1;
-}
-
-int ssl_enable(void *ssl_context, void *user_data) {
- struct ssl_ctx_st *ctx = (struct ssl_ctx_st *) ssl_context;
- return 0;
-}
-
-class HttpResponder : public CivetHandler {
- public:
- bool handleGet(CivetServer *server, struct mg_connection *conn) {
- static const std::string site2site_rest_resp = "hi this is a get test";
- mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: "
- "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n",
- site2site_rest_resp.length());
- mg_printf(conn, "%s", site2site_rest_resp.c_str());
- return true;
- }
-};
-
-int main(int argc, char **argv) {
- init_webserver();
- LogTestController::getInstance().setDebug<core::Processor>();
- LogTestController::getInstance().setDebug<core::ProcessSession>();
- LogTestController::getInstance().setDebug<utils::HTTPClient>();
- LogTestController::getInstance().setDebug<minifi::controllers::SSLContextService>();
- LogTestController::getInstance().setDebug<minifi::processors::InvokeHTTP>();
- LogTestController::getInstance().setDebug<minifi::processors::LogAttribute>();
- std::string key_dir, test_file_location;
- if (argc > 1) {
- test_file_location = argv[1];
- key_dir = argv[2];
- }
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- configuration->set(minifi::Configure::nifi_default_directory, key_dir);
- mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-
- std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
-
- configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
-
- std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
-
- std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
-
- content_repo->initialize(configuration);
-
- std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location));
- std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
-
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
- content_repo,
- DEFAULT_ROOT_GROUP_NAME,
- true);
-
- core::YamlConfiguration yaml_config(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location);
-
- std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
- std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
- std::shared_ptr<core::Processor> proc = ptr->findProcessor("invoke");
- assert(proc != nullptr);
-
- std::shared_ptr<minifi::processors::InvokeHTTP> inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc);
-
- assert(inv != nullptr);
- std::string url = "";
- inv->getProperty(minifi::processors::InvokeHTTP::URL.getName(), url);
- ptr.release();
- HttpResponder h_ex;
- std::string port, scheme, path;
- CivetServer *server = nullptr;
-
- parse_http_components(url, port, scheme, path);
- struct mg_callbacks callback;
- if (url.find("localhost") != std::string::npos) {
- if (scheme == "https") {
- std::string cert = "";
- cert = key_dir + "nifi-cert.pem";
- memset(&callback, 0, sizeof(callback));
- callback.init_ssl = ssl_enable;
- port +="s";
- callback.log_message = log_message;
- server = start_webserver(port, path, &h_ex, &callback, cert, cert);
- } else {
- server = start_webserver(port, path, &h_ex);
- }
- }
- controller->load();
- controller->start();
- waitToVerifyProcessor();
-
- controller->waitUnload(60000);
- if (url.find("localhost") == std::string::npos) {
- stop_webserver(server);
- exit(1);
- }
- std::string logs = LogTestController::getInstance().log_output.str();
-
- assert(logs.find("key:filename value:") != std::string::npos);
- assert(logs.find("key:invokehttp.request.url value:" + url) != std::string::npos);
- assert(logs.find("key:invokehttp.status.code value:200") != std::string::npos);
-
- LogTestController::getInstance().reset();
- rmdir("./content_repository");
- stop_webserver(server);
- return 0;
-}
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define CURLOPT_SSL_VERIFYPEER_DISABLE 1
+#include <sys/stat.h>
+#undef NDEBUG
+#include <cassert>
+#include <utility>
+#include <chrono>
+#include <fstream>
+#include <memory>
+#include <string>
+#include <thread>
+#include <type_traits>
+#include <vector>
+#include "HTTPClient.h"
+#include "InvokeHTTP.h"
+#include "../TestServer.h"
+#include "../TestBase.h"
+#include "utils/StringUtils.h"
+#include "core/Core.h"
+#include "../include/core/logging/Logger.h"
+#include "core/ProcessGroup.h"
+#include "core/yaml/YamlConfiguration.h"
+#include "FlowController.h"
+#include "properties/Configure.h"
+#include "../unit/ProvenanceTestHelper.h"
+#include "io/StreamFactory.h"
+#include "processors/InvokeHTTP.h"
+#include "processors/ListenHTTP.h"
+#include "processors/LogAttribute.h"
+
+void waitToVerifyProcessor() {
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+}
+
+int log_message(const struct mg_connection *conn, const char *message) {
+ puts(message);
+ return 1;
+}
+
+int ssl_enable(void *ssl_context, void *user_data) {
+ struct ssl_ctx_st *ctx = (struct ssl_ctx_st *) ssl_context;
+ return 0;
+}
+
+class HttpResponder : public CivetHandler {
+ public:
+ bool handleGet(CivetServer *server, struct mg_connection *conn) {
+ static const std::string site2site_rest_resp = "hi this is a get test";
+ mg_printf(conn, "HTTP/1.1 200 OK\r\nContent-Type: "
+ "text/plain\r\nContent-Length: %lu\r\nConnection: close\r\n\r\n",
+ site2site_rest_resp.length());
+ mg_printf(conn, "%s", site2site_rest_resp.c_str());
+ return true;
+ }
+};
+
+int main(int argc, char **argv) {
+ init_webserver();
+ LogTestController::getInstance().setDebug<core::Processor>();
+ LogTestController::getInstance().setDebug<core::ProcessSession>();
+ LogTestController::getInstance().setDebug<utils::HTTPClient>();
+ LogTestController::getInstance().setDebug<minifi::controllers::SSLContextService>();
+ LogTestController::getInstance().setDebug<minifi::processors::InvokeHTTP>();
+ LogTestController::getInstance().setDebug<minifi::processors::LogAttribute>();
+ std::string key_dir, test_file_location;
+ if (argc > 1) {
+ test_file_location = argv[1];
+ key_dir = argv[2];
+ }
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
+ configuration->set(minifi::Configure::nifi_default_directory, key_dir);
+ mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
+
+ configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
+
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
+
+ std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::VolatileContentRepository>();
+
+ content_repo->initialize(configuration);
+
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(
+ new core::YamlConfiguration(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location));
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
+
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ content_repo,
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
+
+ core::YamlConfiguration yaml_config(test_repo, test_repo, content_repo, stream_factory, configuration, test_file_location);
+
+ std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
+ std::shared_ptr<core::Processor> proc = ptr->findProcessor("invoke");
+ assert(proc != nullptr);
+
+ std::shared_ptr<minifi::processors::InvokeHTTP> inv = std::dynamic_pointer_cast<minifi::processors::InvokeHTTP>(proc);
+
+ assert(inv != nullptr);
+ std::string url = "";
+ inv->getProperty(minifi::processors::InvokeHTTP::URL.getName(), url);
+ ptr.release();
+ HttpResponder h_ex;
+ std::string port, scheme, path;
+ CivetServer *server = nullptr;
+
+ parse_http_components(url, port, scheme, path);
+ struct mg_callbacks callback;
+ if (url.find("localhost") != std::string::npos) {
+ if (scheme == "https") {
+ std::string cert = "";
+ cert = key_dir + "nifi-cert.pem";
+ memset(&callback, 0, sizeof(callback));
+ callback.init_ssl = ssl_enable;
+ port +="s";
+ callback.log_message = log_message;
+ server = start_webserver(port, path, &h_ex, &callback, cert, cert);
+ } else {
+ server = start_webserver(port, path, &h_ex);
+ }
+ }
+ controller->load();
+ controller->start();
+ waitToVerifyProcessor();
+
+ controller->waitUnload(60000);
+ if (url.find("localhost") == std::string::npos) {
+ stop_webserver(server);
+ exit(1);
+ }
+ std::string logs = LogTestController::getInstance().log_output.str();
+
+ assert(logs.find("key:filename value:") != std::string::npos);
+ assert(logs.find("key:invokehttp.request.url value:" + url) != std::string::npos);
+ assert(logs.find("key:invokehttp.status.code value:200") != std::string::npos);
+
+ LogTestController::getInstance().reset();
+ rmdir("./content_repository");
+ stop_webserver(server);
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/HttpPostIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/HttpPostIntegrationTest.cpp b/libminifi/test/curl-tests/HttpPostIntegrationTest.cpp
index 1a29ce1..1c48f7d 100644
--- a/libminifi/test/curl-tests/HttpPostIntegrationTest.cpp
+++ b/libminifi/test/curl-tests/HttpPostIntegrationTest.cpp
@@ -30,6 +30,8 @@
#include <iostream>
#include "HTTPClient.h"
#include "InvokeHTTP.h"
+#include "processors/ListenHTTP.h"
+#include "processors/LogAttribute.h"
#include <sstream>
#include "../TestBase.h"
#include "utils/StringUtils.h"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/ThreadPoolAdjust.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/ThreadPoolAdjust.cpp b/libminifi/test/curl-tests/ThreadPoolAdjust.cpp
index 7c15d39..53ed7ba 100644
--- a/libminifi/test/curl-tests/ThreadPoolAdjust.cpp
+++ b/libminifi/test/curl-tests/ThreadPoolAdjust.cpp
@@ -1,111 +1,114 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sys/stat.h>
-#undef NDEBUG
-#include <cassert>
-#include <utility>
-#include <chrono>
-#include <fstream>
-#include <memory>
-#include <string>
-#include <thread>
-#include <type_traits>
-#include <vector>
-#include <iostream>
-#include <sstream>
-#include "HTTPClient.h"
-#include "InvokeHTTP.h"
-#include "../TestBase.h"
-#include "utils/StringUtils.h"
-#include "core/Core.h"
-#include "../include/core/logging/Logger.h"
-#include "core/ProcessGroup.h"
-#include "core/yaml/YamlConfiguration.h"
-#include "FlowController.h"
-#include "properties/Configure.h"
-#include "../unit/ProvenanceTestHelper.h"
-#include "io/StreamFactory.h"
-#include "CivetServer.h"
-#include "RemoteProcessorGroupPort.h"
-#include "core/ConfigurableComponent.h"
-#include "controllers/SSLContextService.h"
-#include "../TestServer.h"
-#include "../integration/IntegrationBase.h"
-
-class HttpTestHarness : public IntegrationBase {
- public:
- HttpTestHarness() {
- char format[] = "/tmp/ssth.XXXXXX";
- dir = testController.createTempDirectory(format);
- }
-
- void testSetup() {
- LogTestController::getInstance().setDebug<minifi::FlowController>();
- LogTestController::getInstance().setDebug<core::ProcessGroup>();
- LogTestController::getInstance().setDebug<minifi::SchedulingAgent>();
- LogTestController::getInstance().setDebug<core::ProcessContext>();
- LogTestController::getInstance().setDebug<processors::InvokeHTTP>();
- LogTestController::getInstance().setDebug<utils::HTTPClient>();
- LogTestController::getInstance().setDebug<processors::ListenHTTP>();
- LogTestController::getInstance().setDebug<processors::ListenHTTP::WriteCallback>();
- LogTestController::getInstance().setDebug<processors::ListenHTTP::Handler>();
- LogTestController::getInstance().setDebug<processors::LogAttribute>();
- LogTestController::getInstance().setDebug<core::Processor>();
- LogTestController::getInstance().setDebug<minifi::ThreadedSchedulingAgent>();
- LogTestController::getInstance().setDebug<minifi::TimerDrivenSchedulingAgent>();
- LogTestController::getInstance().setDebug<minifi::core::ProcessSession>();
- std::fstream file;
- ss << dir << "/" << "tstFile.ext";
- file.open(ss.str(), std::ios::out);
- file << "tempFile";
- file.close();
- configuration->set("nifi.flow.engine.threads", "1");
- }
-
- void cleanup() {
- unlink(ss.str().c_str());
- }
-
- void runAssertions() {
- assert(LogTestController::getInstance().contains("curl performed") == true);
- assert(LogTestController::getInstance().contains("Size:1024 Offset:0") == true);
- assert(LogTestController::getInstance().contains("Size:0 Offset:0") == false);
- }
-
- protected:
- char *dir;
- std::stringstream ss;
- TestController testController;
-};
-
-int main(int argc, char **argv) {
- std::string key_dir, test_file_location, url;
- if (argc > 1) {
- test_file_location = argv[1];
- key_dir = argv[2];
- }
-
- HttpTestHarness harness;
-
- harness.setKeyDir(key_dir);
-
- harness.run(test_file_location);
-
- return 0;
-}
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/stat.h>
+#undef NDEBUG
+#include <cassert>
+#include <utility>
+#include <chrono>
+#include <fstream>
+#include <memory>
+#include <string>
+#include <thread>
+#include <type_traits>
+#include <vector>
+#include <iostream>
+#include <sstream>
+#include "HTTPClient.h"
+#include "InvokeHTTP.h"
+#include "../TestBase.h"
+#include "utils/StringUtils.h"
+#include "core/Core.h"
+#include "../include/core/logging/Logger.h"
+#include "core/ProcessGroup.h"
+#include "core/yaml/YamlConfiguration.h"
+#include "FlowController.h"
+#include "properties/Configure.h"
+#include "../unit/ProvenanceTestHelper.h"
+#include "io/StreamFactory.h"
+#include "CivetServer.h"
+#include "RemoteProcessorGroupPort.h"
+#include "core/ConfigurableComponent.h"
+#include "controllers/SSLContextService.h"
+#include "../TestServer.h"
+#include "../integration/IntegrationBase.h"
+#include "processors/InvokeHTTP.h"
+#include "processors/ListenHTTP.h"
+#include "processors/LogAttribute.h"
+
+class HttpTestHarness : public IntegrationBase {
+ public:
+ HttpTestHarness() {
+ char format[] = "/tmp/ssth.XXXXXX";
+ dir = testController.createTempDirectory(format);
+ }
+
+ void testSetup() {
+ LogTestController::getInstance().setDebug<minifi::FlowController>();
+ LogTestController::getInstance().setDebug<core::ProcessGroup>();
+ LogTestController::getInstance().setDebug<minifi::SchedulingAgent>();
+ LogTestController::getInstance().setDebug<core::ProcessContext>();
+ LogTestController::getInstance().setDebug<processors::InvokeHTTP>();
+ LogTestController::getInstance().setDebug<utils::HTTPClient>();
+ LogTestController::getInstance().setDebug<processors::ListenHTTP>();
+ LogTestController::getInstance().setDebug<processors::ListenHTTP::WriteCallback>();
+ LogTestController::getInstance().setDebug<processors::ListenHTTP::Handler>();
+ LogTestController::getInstance().setDebug<processors::LogAttribute>();
+ LogTestController::getInstance().setDebug<core::Processor>();
+ LogTestController::getInstance().setDebug<minifi::ThreadedSchedulingAgent>();
+ LogTestController::getInstance().setDebug<minifi::TimerDrivenSchedulingAgent>();
+ LogTestController::getInstance().setDebug<minifi::core::ProcessSession>();
+ std::fstream file;
+ ss << dir << "/" << "tstFile.ext";
+ file.open(ss.str(), std::ios::out);
+ file << "tempFile";
+ file.close();
+ configuration->set("nifi.flow.engine.threads", "1");
+ }
+
+ void cleanup() {
+ unlink(ss.str().c_str());
+ }
+
+ void runAssertions() {
+ assert(LogTestController::getInstance().contains("curl performed") == true);
+ assert(LogTestController::getInstance().contains("Size:1024 Offset:0") == true);
+ assert(LogTestController::getInstance().contains("Size:0 Offset:0") == false);
+ }
+
+ protected:
+ char *dir;
+ std::stringstream ss;
+ TestController testController;
+};
+
+int main(int argc, char **argv) {
+ std::string key_dir, test_file_location, url;
+ if (argc > 1) {
+ test_file_location = argv[1];
+ key_dir = argv[2];
+ }
+
+ HttpTestHarness harness;
+
+ harness.setKeyDir(key_dir);
+
+ harness.run(test_file_location);
+
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/curl-tests/unit/InvokeHTTPTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/curl-tests/unit/InvokeHTTPTests.cpp b/libminifi/test/curl-tests/unit/InvokeHTTPTests.cpp
index c51a142..cfb6588 100644
--- a/libminifi/test/curl-tests/unit/InvokeHTTPTests.cpp
+++ b/libminifi/test/curl-tests/unit/InvokeHTTPTests.cpp
@@ -36,6 +36,9 @@
#include "core/ProcessContext.h"
#include "core/ProcessSession.h"
#include "core/ProcessorNode.h"
+#include "processors/InvokeHTTP.h"
+#include "processors/ListenHTTP.h"
+#include "processors/LogAttribute.h"
TEST_CASE("HTTPTestsWithNoResourceClaimPOST", "[httptest1]") {
TestController testController;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/script-tests/LuaExecuteScriptTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/script-tests/LuaExecuteScriptTests.cpp b/libminifi/test/script-tests/LuaExecuteScriptTests.cpp
index fa294dc..fcf630d 100644
--- a/libminifi/test/script-tests/LuaExecuteScriptTests.cpp
+++ b/libminifi/test/script-tests/LuaExecuteScriptTests.cpp
@@ -25,6 +25,9 @@
#include "../TestBase.h"
#include <ExecuteScript.h>
+#include "processors/LogAttribute.h"
+#include "processors/GetFile.h"
+#include "processors/PutFile.h"
TEST_CASE("Lua: Test Log", "[executescriptLuaLog]") { // NOLINT
TestController testController;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/script-tests/PythonExecuteScriptTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/script-tests/PythonExecuteScriptTests.cpp b/libminifi/test/script-tests/PythonExecuteScriptTests.cpp
index de7ec0f..4ab6a6a 100644
--- a/libminifi/test/script-tests/PythonExecuteScriptTests.cpp
+++ b/libminifi/test/script-tests/PythonExecuteScriptTests.cpp
@@ -25,6 +25,9 @@
#include "../TestBase.h"
#include <ExecuteScript.h>
+#include "processors/LogAttribute.h"
+#include "processors/GetFile.h"
+#include "processors/PutFile.h"
TEST_CASE("Python: Test Read File", "[executescriptPythonRead]") { // NOLINT
TestController testController;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/unit/ExtractTextTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ExtractTextTests.cpp b/libminifi/test/unit/ExtractTextTests.cpp
index fc49c7f..545996e 100644
--- a/libminifi/test/unit/ExtractTextTests.cpp
+++ b/libminifi/test/unit/ExtractTextTests.cpp
@@ -33,6 +33,8 @@
#include "core/ProcessSession.h"
#include "core/ProcessorNode.h"
+#include "processors/GetFile.h"
+#include "processors/PutFile.h"
#include "processors/ExtractText.h"
#include "processors/LogAttribute.h"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/libminifi/test/unit/TailFileTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/TailFileTests.cpp b/libminifi/test/unit/TailFileTests.cpp
index 53bfc9c..62cb0eb 100644
--- a/libminifi/test/unit/TailFileTests.cpp
+++ b/libminifi/test/unit/TailFileTests.cpp
@@ -32,6 +32,8 @@
#include "core/ProcessContext.h"
#include "core/ProcessSession.h"
#include "core/ProcessorNode.h"
+#include "processors/TailFile.h"
+#include "processors/LogAttribute.h"
#include <iostream>
static const char *NEWLINE_FILE = ""
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d6c28e1c/main/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index edfce6e..633665c 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -52,7 +52,16 @@ find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
# Link against minifi, yaml-cpp, civetweb-cpp, uuid, openssl, jsoncpp and rocksdb
-target_link_libraries(minifiexe core-minifi minifi yaml-cpp c-library civetweb-cpp ${JSON_CPP_LIB} ${UUID_LIBRARIES} ${OPENSSL_LIBRARIES})
+target_link_libraries(minifiexe core-minifi)
+
+target_link_libraries(minifiexe minifi yaml-cpp c-library civetweb-cpp ${JSON_CPP_LIB} ${UUID_LIBRARIES} ${OPENSSL_LIBRARIES})
+
+if (APPLE)
+ target_link_libraries (minifiexe -Wl,-all_load minifi)
+else ()
+ target_link_libraries (minifiexe -Wl,--whole-archive minifi -Wl,--no-whole-archive)
+endif ()
+
if (APPLE)
get_property(extensions GLOBAL PROPERTY EXTENSION-OPTIONS)