You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2017/06/06 16:33:05 UTC
[2/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/ControllerServiceIntegrationTests.cpp b/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
index f1376e0..3f27b66 100644
--- a/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
+++ b/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
@@ -43,14 +43,10 @@
REGISTER_RESOURCE(MockControllerService);
REGISTER_RESOURCE(MockProcessor);
-std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(
- std::shared_ptr<core::controller::ControllerServiceProvider> provider,
- const std::string id) {
- std::shared_ptr<core::controller::ControllerService> service =
- std::make_shared<MockControllerService>();
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- service, provider, id, std::make_shared<minifi::Configure>());
+std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(std::shared_ptr<core::controller::ControllerServiceProvider> provider, const std::string id) {
+ std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, provider, id,
+ std::make_shared<minifi::Configure>());
return testNode;
}
@@ -59,7 +55,6 @@ void waitToVerifyProcessor() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
-
int main(int argc, char **argv) {
std::string test_file_location;
std::string key_dir;
@@ -69,87 +64,60 @@ int main(int argc, char **argv) {
key_dir = argv[1];
}
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ 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);
+ configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
std::string client_cert = "cn.crt.pem";
std::string priv_key_file = "cn.ckey.pem";
std::string passphrase = "cn.pass";
std::string ca_cert = "nifi-cert.pem";
- configuration->set(minifi::Configure::nifi_security_client_certificate,
- test_file_location);
- configuration->set(minifi::Configure::nifi_security_client_private_key,
- priv_key_file);
- configuration->set(minifi::Configure::nifi_security_client_pass_phrase,
- passphrase);
+ configuration->set(minifi::Configure::nifi_security_client_certificate, test_file_location);
+ configuration->set(minifi::Configure::nifi_security_client_private_key, priv_key_file);
+ configuration->set(minifi::Configure::nifi_security_client_pass_phrase, passphrase);
configuration->set(minifi::Configure::nifi_default_directory, key_dir);
- std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<
- minifi::io::StreamFactory>(configuration);
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
- std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_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),
- DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
disabled = false;
- std::shared_ptr<core::controller::ControllerServiceMap> map =
- std::make_shared<core::controller::ControllerServiceMap>();
+ std::shared_ptr<core::controller::ControllerServiceMap> map = std::make_shared<core::controller::ControllerServiceMap>();
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_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::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
- std::shared_ptr<core::controller::StandardControllerServiceProvider> provider =
- std::make_shared<core::controller::StandardControllerServiceProvider>(
- map, pg, std::make_shared<minifi::Configure>());
- std::shared_ptr<core::controller::ControllerServiceNode> mockNode = pg
- ->findControllerService("MockItLikeIts1995");
+ std::shared_ptr<core::controller::StandardControllerServiceProvider> provider = std::make_shared<core::controller::StandardControllerServiceProvider>(map, pg, std::make_shared<minifi::Configure>());
+ std::shared_ptr<core::controller::ControllerServiceNode> mockNode = pg->findControllerService("MockItLikeIts1995");
assert(mockNode != nullptr);
mockNode->enable();
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode> > linkedNodes =
- mockNode->getLinkedControllerServices();
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode> > linkedNodes = mockNode->getLinkedControllerServices();
assert(linkedNodes.size() == 1);
- std::shared_ptr<core::controller::ControllerServiceNode> notexistNode = pg
- ->findControllerService("MockItLikeItsWrong");
+ std::shared_ptr<core::controller::ControllerServiceNode> notexistNode = pg->findControllerService("MockItLikeItsWrong");
assert(notexistNode == nullptr);
controller->load();
controller->start();
- std::shared_ptr<core::controller::ControllerServiceNode> ssl_client_cont =
- controller->getControllerServiceNode("SSLClientServiceTest");
+ std::shared_ptr<core::controller::ControllerServiceNode> ssl_client_cont = controller->getControllerServiceNode("SSLClientServiceTest");
ssl_client_cont->enable();
assert(ssl_client_cont != nullptr);
assert(ssl_client_cont->getControllerServiceImplementation() != nullptr);
- std::shared_ptr<minifi::controllers::SSLContextService> ssl_client =
- std::static_pointer_cast<minifi::controllers::SSLContextService>(
- ssl_client_cont->getControllerServiceImplementation());
+ std::shared_ptr<minifi::controllers::SSLContextService> ssl_client = std::static_pointer_cast<minifi::controllers::SSLContextService>(ssl_client_cont->getControllerServiceImplementation());
assert(ssl_client->getCACertificate().length() > 0);
// now let's disable one of the controller services.
- std::shared_ptr<core::controller::ControllerServiceNode> cs_id = controller
- ->getControllerServiceNode("ID");
+ std::shared_ptr<core::controller::ControllerServiceNode> cs_id = controller->getControllerServiceNode("ID");
assert(cs_id != nullptr);
{
std::lock_guard<std::mutex> lock(control_mutex);
@@ -163,8 +131,7 @@ int main(int argc, char **argv) {
disabled = false;
waitToVerifyProcessor();
}
- std::shared_ptr<core::controller::ControllerServiceNode> mock_cont =
- controller->getControllerServiceNode("MockItLikeIts1995");
+ std::shared_ptr<core::controller::ControllerServiceNode> mock_cont = controller->getControllerServiceNode("MockItLikeIts1995");
assert(cs_id->enabled());
{
std::lock_guard<std::mutex> lock(control_mutex);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/HttpGetIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/HttpGetIntegrationTest.cpp b/libminifi/test/integration/HttpGetIntegrationTest.cpp
index 018ab59..ae60dc1 100644
--- a/libminifi/test/integration/HttpGetIntegrationTest.cpp
+++ b/libminifi/test/integration/HttpGetIntegrationTest.cpp
@@ -49,40 +49,26 @@ int main(int argc, char **argv) {
test_file_location = argv[1];
key_dir = argv[2];
}
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ 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>();
+ 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);
+ 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::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_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), DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr), DEFAULT_ROOT_GROUP_NAME,
+ true);
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_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::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
controller->load();
@@ -92,13 +78,9 @@ int main(int argc, char **argv) {
controller->waitUnload(60000);
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:https://raw.githubusercontent.com/curl/curl/master/docs/examples/httpput.c")
- != std::string::npos);
+ assert(logs.find("key:invokehttp.request.url value:https://raw.githubusercontent.com/curl/curl/master/docs/examples/httpput.c") != std::string::npos);
assert(logs.find("Size:3734 Offset:0") != std::string::npos);
- assert(
- logs.find("key:invokehttp.status.code value:200") != std::string::npos);
+ assert(logs.find("key:invokehttp.status.code value:200") != std::string::npos);
std::string stringtofind = "Resource Claim created ./content_repository/";
size_t loc = logs.find(stringtofind);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/HttpPostIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/HttpPostIntegrationTest.cpp b/libminifi/test/integration/HttpPostIntegrationTest.cpp
index e88fc57..dfa284f 100644
--- a/libminifi/test/integration/HttpPostIntegrationTest.cpp
+++ b/libminifi/test/integration/HttpPostIntegrationTest.cpp
@@ -37,7 +37,6 @@
#include "io/StreamFactory.h"
#include "../TestBase.h"
-
void waitToVerifyProcessor() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
@@ -56,39 +55,25 @@ int main(int argc, char **argv) {
myfile.close();
mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ 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);
+ 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::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_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),
- DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_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::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
controller->load();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/ProvenanceReportingTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/ProvenanceReportingTest.cpp b/libminifi/test/integration/ProvenanceReportingTest.cpp
index 5e2c7b8..a7bcc2b 100644
--- a/libminifi/test/integration/ProvenanceReportingTest.cpp
+++ b/libminifi/test/integration/ProvenanceReportingTest.cpp
@@ -37,7 +37,6 @@
#include "io/StreamFactory.h"
#include "../TestBase.h"
-
void waitToVerifyProcessor() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
@@ -53,45 +52,28 @@ int main(int argc, char **argv) {
LogTestController::getInstance().setDebug<core::ProcessGroup>();
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ 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);
+ 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::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_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),
- DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_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::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
- 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>());
- org::apache::nifi::minifi::io::Socket server(socket_context, "localhost",
- 10001, 1);
+ 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>());
+ org::apache::nifi::minifi::io::Socket server(socket_context, "localhost", 10001, 1);
controller->load();
controller->start();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/TestExecuteProcess.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/TestExecuteProcess.cpp b/libminifi/test/integration/TestExecuteProcess.cpp
index c3a3f4c..ef0d113 100644
--- a/libminifi/test/integration/TestExecuteProcess.cpp
+++ b/libminifi/test/integration/TestExecuteProcess.cpp
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-
#include <cassert>
#include <chrono>
#include <string>
@@ -45,23 +44,18 @@
int main(int argc, char **argv) {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::ExecuteProcess>("executeProcess");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ExecuteProcess>("executeProcess");
processor->setMaxConcurrentTasks(1);
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<
- TestFlowController>(test_repo, test_repo);
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<TestFlowController>(test_repo, test_repo);
uuid_t processoruuid;
assert(true == processor->getUUID(processoruuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(test_repo, "executeProcessConnection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, "executeProcessConnection");
connection->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -84,37 +78,29 @@ int main(int argc, char **argv) {
std::vector<std::thread> processor_workers;
core::ProcessorNode node2(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
- std::shared_ptr<core::ProcessContext> contextset = std::make_shared<
- core::ProcessContext>(node2, controller_services_provider, test_repo);
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
+ std::shared_ptr<core::ProcessContext> contextset = std::make_shared<core::ProcessContext>(node2, controller_services_provider, test_repo);
core::ProcessSessionFactory factory(contextset.get());
processor->onSchedule(contextset.get(), &factory);
for (int i = 0; i < 1; i++) {
- processor_workers.push_back(
- std::thread(
- [processor, test_repo, &is_ready]() {
- core::ProcessorNode node(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
- std::shared_ptr<core::ProcessContext> context = std::make_shared<core::ProcessContext>(node, controller_services_provider, test_repo);
- context->setProperty(org::apache::nifi::minifi::processors::ExecuteProcess::Command, "sleep 0.5");
- std::shared_ptr<core::ProcessSession> session = std::make_shared<core::ProcessSession>(context.get());
- while (!is_ready.load(std::memory_order_relaxed)) {
- }
- processor->onTrigger(context.get(), session.get());
- }));
+ processor_workers.push_back(std::thread([processor, test_repo, &is_ready]() {
+ core::ProcessorNode node(processor);
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
+ std::shared_ptr<core::ProcessContext> context = std::make_shared<core::ProcessContext>(node, controller_services_provider, test_repo);
+ context->setProperty(org::apache::nifi::minifi::processors::ExecuteProcess::Command, "sleep 0.5");
+ std::shared_ptr<core::ProcessSession> session = std::make_shared<core::ProcessSession>(context.get());
+ while (!is_ready.load(std::memory_order_relaxed)) {
+ }
+ processor->onTrigger(context.get(), session.get());
+ }));
}
is_ready.store(true, std::memory_order_relaxed);
- std::for_each(processor_workers.begin(), processor_workers.end(),
- [](std::thread &t) {
- t.join();
- });
-
+ std::for_each(processor_workers.begin(), processor_workers.end(), [](std::thread &t) {
+ t.join();
+ });
- std::shared_ptr<org::apache::nifi::minifi::processors::ExecuteProcess> execp =
- std::static_pointer_cast<
- org::apache::nifi::minifi::processors::ExecuteProcess>(processor);
+ std::shared_ptr<org::apache::nifi::minifi::processors::ExecuteProcess> execp = std::static_pointer_cast<org::apache::nifi::minifi::processors::ExecuteProcess>(processor);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/nodefs/NoLevelDB.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/nodefs/NoLevelDB.cpp b/libminifi/test/nodefs/NoLevelDB.cpp
index 677886e..6856287 100644
--- a/libminifi/test/nodefs/NoLevelDB.cpp
+++ b/libminifi/test/nodefs/NoLevelDB.cpp
@@ -22,13 +22,11 @@
#include "core/RepositoryFactory.h"
TEST_CASE("NoLevelDBTest1", "[NoLevelDBTest]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository(
- "provenancerepository", true);
+ std::shared_ptr<core::Repository> prov_repo = core::createRepository("provenancerepository", true);
REQUIRE(nullptr != prov_repo);
}
TEST_CASE("NoLevelDBTest2", "[NoLevelDBTest]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository(
- "flowfilerepository", true);
+ std::shared_ptr<core::Repository> prov_repo = core::createRepository("flowfilerepository", true);
REQUIRE(nullptr != prov_repo);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/CRCTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/CRCTests.cpp b/libminifi/test/unit/CRCTests.cpp
index d2b0466..97af4c3 100644
--- a/libminifi/test/unit/CRCTests.cpp
+++ b/libminifi/test/unit/CRCTests.cpp
@@ -26,16 +26,14 @@
TEST_CASE("Test CRC1", "[testcrc1]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
test.writeData(reinterpret_cast<uint8_t*>(const_cast<char*>("cow")), 3);
REQUIRE(2580823964 == test.getCRC());
}
TEST_CASE("Test CRC2", "[testcrc2]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
std::string fox = "the quick brown fox jumped over the brown fox";
std::vector<uint8_t> charvect(fox.begin(), fox.end());
test.writeData(charvect, charvect.size());
@@ -44,8 +42,7 @@ TEST_CASE("Test CRC2", "[testcrc2]") {
TEST_CASE("Test CRC3", "[testcrc3]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
uint64_t number = 7;
test.write(number);
REQUIRE(4215687882 == test.getCRC());
@@ -53,8 +50,7 @@ TEST_CASE("Test CRC3", "[testcrc3]") {
TEST_CASE("Test CRC4", "[testcrc4]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
uint32_t number = 7;
test.write(number);
REQUIRE(3206564543 == test.getCRC());
@@ -62,8 +58,7 @@ TEST_CASE("Test CRC4", "[testcrc4]") {
TEST_CASE("Test CRC5", "[testcrc5]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
uint16_t number = 7;
test.write(number);
REQUIRE(3753740124 == test.getCRC());
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ClassLoaderTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ClassLoaderTests.cpp b/libminifi/test/unit/ClassLoaderTests.cpp
index e27c753..fa8e5ef 100644
--- a/libminifi/test/unit/ClassLoaderTests.cpp
+++ b/libminifi/test/unit/ClassLoaderTests.cpp
@@ -25,20 +25,8 @@
TEST_CASE("TestLoader", "[TestLoader]") {
TestController controller;
- REQUIRE(
- nullptr
- != core::ClassLoader::getDefaultClassLoader().instantiate(
- "AppendHostInfo", "hosty"));
- REQUIRE(
- nullptr
- != core::ClassLoader::getDefaultClassLoader().instantiate(
- "ListenHTTP", "hosty2"));
- REQUIRE(
- nullptr
- == core::ClassLoader::getDefaultClassLoader().instantiate(
- "Don'tExist", "hosty3"));
- REQUIRE(
- nullptr
- == core::ClassLoader::getDefaultClassLoader().instantiate(
- "", "EmptyEmpty"));
+ REQUIRE(nullptr != core::ClassLoader::getDefaultClassLoader().instantiate("AppendHostInfo", "hosty"));
+ REQUIRE(nullptr != core::ClassLoader::getDefaultClassLoader().instantiate("ListenHTTP", "hosty2"));
+ REQUIRE(nullptr == core::ClassLoader::getDefaultClassLoader().instantiate("Don'tExist", "hosty3"));
+ REQUIRE(nullptr == core::ClassLoader::getDefaultClassLoader().instantiate("", "EmptyEmpty"));
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ControllerServiceTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ControllerServiceTests.cpp b/libminifi/test/unit/ControllerServiceTests.cpp
index 44d30d4..a24ee03 100644
--- a/libminifi/test/unit/ControllerServiceTests.cpp
+++ b/libminifi/test/unit/ControllerServiceTests.cpp
@@ -40,11 +40,8 @@ TEST_CASE("Test ControllerServicesMap", "[cs1]") {
core::controller::ControllerServiceMap map;
REQUIRE(0 == map.getAllControllerServices().size());
- std::shared_ptr<core::controller::ControllerService> service =
- std::make_shared<MockControllerService>();
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- service, "ID", std::make_shared<minifi::Configure>());
+ std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, "ID", std::make_shared<minifi::Configure>());
map.put("ID", testNode);
REQUIRE(1 == map.getAllControllerServices().size());
@@ -56,19 +53,14 @@ TEST_CASE("Test ControllerServicesMap", "[cs1]") {
// ensure the pointer is the same
- REQUIRE(
- service.get()
- == map.getControllerServiceNode("ID")
- ->getControllerServiceImplementation().get());
+ REQUIRE(service.get() == map.getControllerServiceNode("ID")->getControllerServiceImplementation().get());
}
TEST_CASE("Test StandardControllerServiceNode nullPtr", "[cs1]") {
core::controller::ControllerServiceMap map;
try {
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- nullptr, "ID", std::make_shared<minifi::Configure>());
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(nullptr, "ID", std::make_shared<minifi::Configure>());
} catch (minifi::Exception &ex) {
return;
}
@@ -76,13 +68,9 @@ TEST_CASE("Test StandardControllerServiceNode nullPtr", "[cs1]") {
FAIL("Should have encountered exception");
}
-std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(
- const std::string id) {
- std::shared_ptr<core::controller::ControllerService> service =
- std::make_shared<MockControllerService>();
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- service, id, std::make_shared<minifi::Configure>());
+std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(const std::string id) {
+ std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, id, std::make_shared<minifi::Configure>());
return testNode;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/InvokeHTTPTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/InvokeHTTPTests.cpp b/libminifi/test/unit/InvokeHTTPTests.cpp
index 95b4a2e..705ac84 100644
--- a/libminifi/test/unit/InvokeHTTPTests.cpp
+++ b/libminifi/test/unit/InvokeHTTPTests.cpp
@@ -41,23 +41,19 @@ TEST_CASE("HTTPTestsPostNoResourceClaim", "[httptest1]") {
std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
- std::shared_ptr<core::Processor> invokehttp = std::make_shared<
- org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
+ std::shared_ptr<core::Processor> invokehttp = std::make_shared<org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
uuid_t processoruuid;
REQUIRE(true == processor->getUUID(processoruuid));
uuid_t invokehttp_uuid;
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "listenhttp");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "listenhttp");
connection2->setRelationship(core::Relationship("No Retry", "description"));
@@ -80,20 +76,14 @@ TEST_CASE("HTTPTestsPostNoResourceClaim", "[httptest1]") {
core::ProcessorNode node(processor);
core::ProcessorNode node2(invokehttp);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
- "8685");
- context.setProperty(
- org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
- "/testytesttest");
-
- context2.setProperty(
- org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
- context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL,
- "http://localhost:8685/testytesttest");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port, "8685");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath, "/testytesttest");
+
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL, "http://localhost:8685/testytesttest");
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
@@ -148,40 +138,32 @@ TEST_CASE("HTTPTestsWithNoResourceClaimPOST", "[httptest1]") {
std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> logAttribute = std::make_shared<
- org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
+ std::shared_ptr<core::Processor> logAttribute = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::Processor> listenhttp = std::make_shared<
- org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ std::shared_ptr<core::Processor> listenhttp = std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
- std::shared_ptr<core::Processor> invokehttp = std::make_shared<
- org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
+ std::shared_ptr<core::Processor> invokehttp = std::make_shared<org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
uuid_t processoruuid;
REQUIRE(true == listenhttp->getUUID(processoruuid));
uuid_t invokehttp_uuid;
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
- std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
gcConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> laConnection = std::make_shared<
- minifi::Connection>(repo, "logattribute");
+ std::shared_ptr<minifi::Connection> laConnection = std::make_shared<minifi::Connection>(repo, "logattribute");
laConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "listenhttp");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "listenhttp");
connection2->setRelationship(core::Relationship("No Retry", "description"));
@@ -198,20 +180,14 @@ TEST_CASE("HTTPTestsWithNoResourceClaimPOST", "[httptest1]") {
core::ProcessorNode node(listenhttp);
core::ProcessorNode node2(invokehttp);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
- "8686");
- context.setProperty(
- org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
- "/testytesttest");
-
- context2.setProperty(
- org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
- context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL,
- "http://localhost:8686/testytesttest");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port, "8686");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath, "/testytesttest");
+
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL, "http://localhost:8686/testytesttest");
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
@@ -276,43 +252,34 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST", "[httptest1]") {
TestController testController;
LogTestController::getInstance().setInfo<org::apache::nifi::minifi::processors::InvokeHTTP>();
- std::shared_ptr<TestRepository> repo = std::make_shared<
- TestRepository>();
+ std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> logAttribute = std::make_shared<
- org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
+ std::shared_ptr<core::Processor> logAttribute = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::Processor> listenhttp = std::make_shared<
- org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ std::shared_ptr<core::Processor> listenhttp = std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
- std::shared_ptr<core::Processor> invokehttp = std::make_shared<
- org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
+ std::shared_ptr<core::Processor> invokehttp = std::make_shared<org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
uuid_t processoruuid;
REQUIRE(true == listenhttp->getUUID(processoruuid));
uuid_t invokehttp_uuid;
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
- std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
gcConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> laConnection = std::make_shared<
- minifi::Connection>(repo, "logattribute");
+ std::shared_ptr<minifi::Connection> laConnection = std::make_shared<minifi::Connection>(repo, "logattribute");
laConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "listenhttp");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "listenhttp");
connection2->setRelationship(core::Relationship("No Retry", "description"));
@@ -331,20 +298,14 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST", "[httptest1]") {
core::ProcessorNode node(invokehttp);
core::ProcessorNode node2(listenhttp);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
- "8680");
- context.setProperty(
- org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
- "/testytesttest");
-
- context2.setProperty(
- org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
- context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL,
- "http://localhost:8680/testytesttest");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port, "8680");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath, "/testytesttest");
+
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL, "http://localhost:8680/testytesttest");
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
@@ -363,8 +324,7 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST", "[httptest1]") {
*/
std::map<std::string, std::string> attributes;
attributes["testy"] = "test";
- std::shared_ptr<minifi::FlowFileRecord> flow = std::make_shared<
- minifi::FlowFileRecord>(repo, attributes);
+ std::shared_ptr<minifi::FlowFileRecord> flow = std::make_shared<minifi::FlowFileRecord>(repo, attributes);
session2.write(flow, &callback);
invokehttp->incrementActiveTasks();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/LoggerConfigurationTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/LoggerConfigurationTests.cpp b/libminifi/test/unit/LoggerConfigurationTests.cpp
index 7c340d1..8a8b0bc 100644
--- a/libminifi/test/unit/LoggerConfigurationTests.cpp
+++ b/libminifi/test/unit/LoggerConfigurationTests.cpp
@@ -34,7 +34,7 @@ TEST_CASE("TestLoggerProperties::get_keys_of_type", "[test get_keys_of_type]") {
logger_properties.set("notappender.notrolling", "notrolling");
logger_properties.set("appender.stdout", "stdout");
logger_properties.set("appender.stdout2.ignore", "stdout");
- std::vector<std::string> expected = {"appender.rolling", "appender.stdout"};
+ std::vector<std::string> expected = { "appender.rolling", "appender.stdout" };
std::vector<std::string> actual = logger_properties.get_keys_of_type("appender");
std::sort(actual.begin(), actual.end());
REQUIRE(expected == actual);
@@ -42,7 +42,7 @@ TEST_CASE("TestLoggerProperties::get_keys_of_type", "[test get_keys_of_type]") {
class TestLoggerConfiguration : public logging::LoggerConfiguration {
public:
- static std::shared_ptr<logging::internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<logging::LoggerProperties> &logger_properties) {
+ static std::shared_ptr<logging::internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<logging::LoggerProperties> &logger_properties) {
return logging::LoggerConfiguration::initialize_namespaces(logger_properties);
}
static std::shared_ptr<spdlog::logger> get_logger(const std::shared_ptr<logging::internal::LoggerNamespace> &root_namespace, const std::string &name, std::shared_ptr<spdlog::formatter> formatter) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/LoggerTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/LoggerTests.cpp b/libminifi/test/unit/LoggerTests.cpp
index 5f87fe6..c7509f5 100644
--- a/libminifi/test/unit/LoggerTests.cpp
+++ b/libminifi/test/unit/LoggerTests.cpp
@@ -27,10 +27,7 @@ TEST_CASE("Test log Levels", "[ttl1]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_info("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [info] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [info] hello world"));
LogTestController::getInstance().reset();
}
@@ -39,10 +36,7 @@ TEST_CASE("Test log Levels debug", "[ttl2]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_debug("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [debug] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [debug] hello world"));
LogTestController::getInstance().reset();
}
@@ -51,10 +45,7 @@ TEST_CASE("Test log Levels trace", "[ttl3]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_trace("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [trace] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [trace] hello world"));
LogTestController::getInstance().reset();
}
@@ -63,10 +54,7 @@ TEST_CASE("Test log Levels error", "[ttl4]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_error("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
LogTestController::getInstance().reset();
}
@@ -75,17 +63,11 @@ TEST_CASE("Test log Levels change", "[ttl5]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_error("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
LogTestController::getInstance().reset();
LogTestController::getInstance().setOff<logging::Logger>();
logger->log_error("hello %s", "world");
- REQUIRE(
- false
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
+ REQUIRE(false == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
LogTestController::getInstance().reset();
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/MockClasses.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/MockClasses.h b/libminifi/test/unit/MockClasses.h
index 0aa4235..00eaf82 100644
--- a/libminifi/test/unit/MockClasses.h
+++ b/libminifi/test/unit/MockClasses.h
@@ -104,23 +104,18 @@ class MockProcessor : public core::Processor {
}
// OnTrigger method, implemented by NiFi Processor Designer
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::string linked_service = "";
getProperty("linkedService", linked_service);
if (!IsNullOrEmpty(linked_service)) {
- std::shared_ptr<core::controller::ControllerService> service = context
- ->getControllerService(linked_service);
+ std::shared_ptr<core::controller::ControllerService> service = context->getControllerService(linked_service);
std::lock_guard<std::mutex> lock(control_mutex);
if (!disabled.load()) {
assert(true == context->isControllerServiceEnabled(linked_service));
assert(nullptr != service);
- assert(
- "pushitrealgood"
- == std::static_pointer_cast<MockControllerService>(service)
- ->doSomething());
+ assert("pushitrealgood" == std::static_pointer_cast<MockControllerService>(service)->doSomething());
} else {
assert(false == context->isControllerServiceEnabled(linked_service));
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ProcessorTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProcessorTests.cpp b/libminifi/test/unit/ProcessorTests.cpp
index 491ca8f..ac2b54e 100644
--- a/libminifi/test/unit/ProcessorTests.cpp
+++ b/libminifi/test/unit/ProcessorTests.cpp
@@ -38,28 +38,21 @@
TEST_CASE("Test Creation of GetFile", "[getfileCreate]") {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("processorname");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("processorname");
REQUIRE(processor->getName() == "processorname");
}
TEST_CASE("Test Find file", "[getfileCreate2]") {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> processorReport =
- std::make_shared<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
- std::make_shared<org::apache::nifi::minifi::io::StreamFactory>(
- std::make_shared<org::apache::nifi::minifi::Configure>()));
+ std::shared_ptr<core::Processor> processorReport = std::make_shared<org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
+ std::make_shared<org::apache::nifi::minifi::io::StreamFactory>(std::make_shared<org::apache::nifi::minifi::Configure>()));
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
@@ -67,8 +60,7 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
uuid_t processoruuid;
REQUIRE(true == processor->getUUID(processoruuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(test_repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -82,12 +74,10 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
REQUIRE(dir != NULL);
core::ProcessorNode node(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, test_repo);
core::ProcessSessionFactory factory(&context);
- context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory,
- dir);
+ context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory, dir);
core::ProcessSession session(&context);
processor->onSchedule(&context, &factory);
@@ -131,9 +121,7 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
for (auto entry : repo->getRepoMap()) {
provenance::ProvenanceEventRecord newRecord;
- newRecord.DeSerialize(
- reinterpret_cast<uint8_t*>(const_cast<char*>(entry.second.data())),
- entry.second.length());
+ newRecord.DeSerialize(reinterpret_cast<uint8_t*>(const_cast<char*>(entry.second.data())), entry.second.length());
bool found = false;
for (auto provRec : records) {
@@ -153,45 +141,32 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
}
core::ProcessorNode nodeReport(processorReport);
- core::ProcessContext contextReport(nodeReport, controller_services_provider,
- test_repo);
+ core::ProcessContext contextReport(nodeReport, controller_services_provider, test_repo);
core::ProcessSessionFactory factoryReport(&contextReport);
core::ProcessSession sessionReport(&contextReport);
processorReport->onSchedule(&contextReport, &factoryReport);
- std::shared_ptr<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask> taskReport =
- std::static_pointer_cast<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
- processorReport);
+ std::shared_ptr<org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask> taskReport = std::static_pointer_cast<
+ org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(processorReport);
taskReport->setBatchSize(1);
std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> recordsReport;
processorReport->incrementActiveTasks();
processorReport->setScheduledState(core::ScheduledState::RUNNING);
std::string jsonStr;
repo->getProvenanceRecord(recordsReport, 1);
- taskReport->getJsonReport(&contextReport, &sessionReport, recordsReport,
- jsonStr);
+ taskReport->getJsonReport(&contextReport, &sessionReport, recordsReport, jsonStr);
REQUIRE(recordsReport.size() == 1);
- REQUIRE(
- taskReport->getName()
- == std::string(
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask::ReportTaskName));
- REQUIRE(
- jsonStr.find("\"componentType\" : \"getfileCreate2\"")
- != std::string::npos);
+ REQUIRE(taskReport->getName() == std::string(org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask::ReportTaskName));
+ REQUIRE(jsonStr.find("\"componentType\" : \"getfileCreate2\"") != std::string::npos);
}
TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
@@ -199,8 +174,7 @@ TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
uuid_t processoruuid;
REQUIRE(true == processor->getUUID(processoruuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(test_repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -214,12 +188,10 @@ TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
REQUIRE(dir != NULL);
core::ProcessorNode node(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, test_repo);
core::ProcessSessionFactory factory(&context);
- context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory,
- dir);
+ context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory, dir);
// replicate 10 threads
processor->setScheduledState(core::ScheduledState::RUNNING);
processor->onSchedule(&context, &factory);
@@ -234,8 +206,7 @@ TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
processor->onTrigger(&context, &session);
provenance::ProvenanceReporter *reporter = session.getProvenanceReporter();
- std::set<provenance::ProvenanceEventRecord*> records =
- reporter->getEvents();
+ std::set<provenance::ProvenanceEventRecord*> records = reporter->getEvents();
record = session.get();
REQUIRE(record == nullptr);
REQUIRE(records.size() == 0);
@@ -275,11 +246,9 @@ TEST_CASE("LogAttributeTest", "[getfileCreate3]") {
std::shared_ptr<core::Repository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> logAttribute = std::make_shared<
- org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
+ std::shared_ptr<core::Processor> logAttribute = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
@@ -290,12 +259,10 @@ TEST_CASE("LogAttributeTest", "[getfileCreate3]") {
uuid_t logattribute_uuid;
REQUIRE(true == logAttribute->getUUID(logattribute_uuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "logattribute");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "logattribute");
connection2->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -317,12 +284,10 @@ TEST_CASE("LogAttributeTest", "[getfileCreate3]") {
core::ProcessorNode node(processor);
core::ProcessorNode node2(logAttribute);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory,
- dir);
+ context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory, dir);
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/PropertyTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/PropertyTests.cpp b/libminifi/test/unit/PropertyTests.cpp
index a2d5858..af85579 100644
--- a/libminifi/test/unit/PropertyTests.cpp
+++ b/libminifi/test/unit/PropertyTests.cpp
@@ -23,22 +23,14 @@
TEST_CASE("Test Boolean Conversion", "[testboolConversion]") {
bool b;
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("true", b));
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("True", b));
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("TRue", b));
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("tRUE", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALSE", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALLSEY", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FaLSE", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("false", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("true", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("True", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("TRue", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("tRUE", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALSE", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALLSEY", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FaLSE", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("false", b));
}
TEST_CASE("Test Trimmer Right", "[testTrims]") {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ProvenanceTestHelper.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProvenanceTestHelper.h b/libminifi/test/unit/ProvenanceTestHelper.h
index 585c0d3..17e6078 100644
--- a/libminifi/test/unit/ProvenanceTestHelper.h
+++ b/libminifi/test/unit/ProvenanceTestHelper.h
@@ -42,9 +42,7 @@ class TestRepository : public core::Repository {
}
bool Put(std::string key, uint8_t *buf, int bufLen) {
- repositoryResults.insert(
- std::pair<std::string, std::string>(
- key, std::string((const char*) buf, bufLen)));
+ repositoryResults.insert(std::pair<std::string, std::string>(key, std::string((const char*) buf, bufLen)));
return true;
}
// Delete
@@ -67,17 +65,13 @@ class TestRepository : public core::Repository {
return repositoryResults;
}
- void getProvenanceRecord(
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- int maxSize) {
+ void getProvenanceRecord(std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records, int maxSize) {
for (auto entry : repositoryResults) {
if (records.size() >= maxSize)
break;
- std::shared_ptr<provenance::ProvenanceEventRecord> eventRead =
- std::make_shared<provenance::ProvenanceEventRecord>();
+ std::shared_ptr<provenance::ProvenanceEventRecord> eventRead = std::make_shared<provenance::ProvenanceEventRecord>();
- if (eventRead->DeSerialize((uint8_t*) entry.second.data(),
- entry.second.length())) {
+ if (eventRead->DeSerialize((uint8_t*) entry.second.data(), entry.second.length())) {
records.push_back(eventRead);
}
}
@@ -93,7 +87,7 @@ class TestRepository : public core::Repository {
class TestFlowRepository : public core::repository::FlowFileRepository {
public:
TestFlowRepository()
- : core::repository::FlowFileRepository("ff","./dir", 1000, 100, 0) {
+ : core::repository::FlowFileRepository("ff", "./dir", 1000, 100, 0) {
}
// initialize
bool initialize() {
@@ -106,9 +100,7 @@ class TestFlowRepository : public core::repository::FlowFileRepository {
}
bool Put(std::string key, uint8_t *buf, int bufLen) {
- repositoryResults.insert(
- std::pair<std::string, std::string>(
- key, std::string((const char*) buf, bufLen)));
+ repositoryResults.insert(std::pair<std::string, std::string>(key, std::string((const char*) buf, bufLen)));
return true;
}
// Delete
@@ -131,17 +123,13 @@ class TestFlowRepository : public core::repository::FlowFileRepository {
return repositoryResults;
}
- void getProvenanceRecord(
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- int maxSize) {
+ void getProvenanceRecord(std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records, int maxSize) {
for (auto entry : repositoryResults) {
if (records.size() >= maxSize)
break;
- std::shared_ptr<provenance::ProvenanceEventRecord> eventRead =
- std::make_shared<provenance::ProvenanceEventRecord>();
+ std::shared_ptr<provenance::ProvenanceEventRecord> eventRead = std::make_shared<provenance::ProvenanceEventRecord>();
- if (eventRead->DeSerialize((uint8_t*) entry.second.data(),
- entry.second.length())) {
+ if (eventRead->DeSerialize((uint8_t*) entry.second.data(), entry.second.length())) {
records.push_back(eventRead);
}
}
@@ -157,11 +145,8 @@ class TestFlowRepository : public core::repository::FlowFileRepository {
class TestFlowController : public minifi::FlowController {
public:
- TestFlowController(std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo)
- : minifi::FlowController(repo, flow_file_repo,
- std::make_shared<minifi::Configure>(), nullptr,
- "", true) {
+ TestFlowController(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo)
+ : minifi::FlowController(repo, flow_file_repo, std::make_shared<minifi::Configure>(), nullptr, "", true) {
}
~TestFlowController() {
@@ -194,8 +179,7 @@ class TestFlowController : public minifi::FlowController {
return true;
}
- std::shared_ptr<core::Processor> createProcessor(std::string name,
- uuid_t uuid) {
+ std::shared_ptr<core::Processor> createProcessor(std::string name, uuid_t uuid) {
return 0;
}
@@ -207,8 +191,7 @@ class TestFlowController : public minifi::FlowController {
return 0;
}
- std::shared_ptr<minifi::Connection> createConnection(std::string name,
- uuid_t uuid) {
+ std::shared_ptr<minifi::Connection> createConnection(std::string name, uuid_t uuid) {
return 0;
}
protected:
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ProvenanceTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProvenanceTests.cpp b/libminifi/test/unit/ProvenanceTests.cpp
index 993fe58..6a58597 100644
--- a/libminifi/test/unit/ProvenanceTests.cpp
+++ b/libminifi/test/unit/ProvenanceTests.cpp
@@ -30,17 +30,13 @@
#include "core/repository/VolatileRepository.h"
TEST_CASE("Test Provenance record create", "[Testprovenance::ProvenanceEventRecord]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "blah",
- "blahblah");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "blah", "blahblah");
REQUIRE(record1.getAttributes().size() == 0);
REQUIRE(record1.getAlternateIdentifierUri().length() == 0);
}
TEST_CASE("Test Provenance record serialization", "[Testprovenance::ProvenanceEventRecordSerializeDeser]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
@@ -48,8 +44,7 @@ TEST_CASE("Test Provenance record serialization", "[Testprovenance::ProvenanceEv
record1.setDetails(smileyface);
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- TestRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<TestRepository>();
record1.setEventDuration(sample);
record1.Serialize(testRepository);
@@ -64,24 +59,18 @@ TEST_CASE("Test Provenance record serialization", "[Testprovenance::ProvenanceEv
}
TEST_CASE("Test Flowfile record added to provenance", "[TestFlowAndProv1]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
std::map<std::string, std::string> attributes;
attributes.insert(std::pair<std::string, std::string>("potato", "potatoe"));
attributes.insert(std::pair<std::string, std::string>("tomato", "tomatoe"));
- std::shared_ptr<core::repository::FlowFileRepository> frepo =
- std::make_shared<core::repository::FlowFileRepository>(
- "ff", "./content_repository", 0, 0, 0);
- std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<
- minifi::FlowFileRecord>(frepo, attributes);
+ std::shared_ptr<core::repository::FlowFileRepository> frepo = std::make_shared<core::repository::FlowFileRepository>("ff", "./content_repository", 0, 0, 0);
+ std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<minifi::FlowFileRecord>(frepo, attributes);
record1.addChildFlowFile(ffr1);
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- TestRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<TestRepository>();
record1.setEventDuration(sample);
record1.Serialize(testRepository);
@@ -96,9 +85,7 @@ TEST_CASE("Test Flowfile record added to provenance", "[TestFlowAndProv1]") {
}
TEST_CASE("Test Provenance record serialization Volatile", "[Testprovenance::ProvenanceEventRecordSerializeDeser]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
@@ -107,8 +94,7 @@ TEST_CASE("Test Provenance record serialization Volatile", "[Testprovenance::Pro
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- core::repository::VolatileRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<core::repository::VolatileRepository>();
testRepository->initialize(0);
record1.setEventDuration(sample);
@@ -124,24 +110,19 @@ TEST_CASE("Test Provenance record serialization Volatile", "[Testprovenance::Pro
}
TEST_CASE("Test Flowfile record added to provenance using Volatile Repo", "[TestFlowAndProv1]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
std::map<std::string, std::string> attributes;
attributes.insert(std::pair<std::string, std::string>("potato", "potatoe"));
attributes.insert(std::pair<std::string, std::string>("tomato", "tomatoe"));
- std::shared_ptr<core::Repository> frepo = std::make_shared<
- core::repository::VolatileRepository>();
+ std::shared_ptr<core::Repository> frepo = std::make_shared<core::repository::VolatileRepository>();
frepo->initialize(0);
- std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<
- minifi::FlowFileRecord>(frepo, attributes);
+ std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<minifi::FlowFileRecord>(frepo, attributes);
record1.addChildFlowFile(ffr1);
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- core::repository::VolatileRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<core::repository::VolatileRepository>();
testRepository->initialize(0);
record1.setEventDuration(sample);
@@ -157,9 +138,7 @@ TEST_CASE("Test Flowfile record added to provenance using Volatile Repo", "[Test
}
TEST_CASE("Test Provenance record serialization NoOp", "[Testprovenance::ProvenanceEventRecordSerializeDeser]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
@@ -168,8 +147,7 @@ TEST_CASE("Test Provenance record serialization NoOp", "[Testprovenance::Provena
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- core::Repository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<core::Repository>();
testRepository->initialize(0);
record1.setEventDuration(sample);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/RepoTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/RepoTests.cpp b/libminifi/test/unit/RepoTests.cpp
index 34b1f35..4424a93 100644
--- a/libminifi/test/unit/RepoTests.cpp
+++ b/libminifi/test/unit/RepoTests.cpp
@@ -30,9 +30,7 @@ TEST_CASE("Test Repo Empty Value Attribute", "[TestFFR1]") {
TestController testController;
char format[] = "/tmp/testRepo.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::repository::FlowFileRepository> repository =
- std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0,
- 1);
+ std::shared_ptr<core::repository::FlowFileRepository> repository = std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0, 1);
repository->initialize(std::make_shared<minifi::Configure>());
@@ -49,9 +47,7 @@ TEST_CASE("Test Repo Empty Key Attribute ", "[TestFFR2]") {
TestController testController;
char format[] = "/tmp/testRepo.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::repository::FlowFileRepository> repository =
- std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0,
- 1);
+ std::shared_ptr<core::repository::FlowFileRepository> repository = std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0, 1);
repository->initialize(std::make_shared<minifi::Configure>());
@@ -70,12 +66,9 @@ TEST_CASE("Test Repo Key Attribute Verify ", "[TestFFR3]") {
TestController testController;
char format[] = "/tmp/testRepo.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::repository::FlowFileRepository> repository =
- std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0,
- 1);
+ std::shared_ptr<core::repository::FlowFileRepository> repository = std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0, 1);
- repository->initialize(
- std::make_shared<org::apache::nifi::minifi::Configure>());
+ repository->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
minifi::FlowFileRecord record(repository);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/Site2SiteTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/Site2SiteTests.cpp b/libminifi/test/unit/Site2SiteTests.cpp
index 18878ad..2eef532 100644
--- a/libminifi/test/unit/Site2SiteTests.cpp
+++ b/libminifi/test/unit/Site2SiteTests.cpp
@@ -32,12 +32,8 @@
#define FMT_DEFAULT fmt_lower
TEST_CASE("TestSetPortId", "[S2S1]") {
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::DataStream()),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(new org::apache::nifi::minifi::io::DataStream()), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
@@ -53,12 +49,8 @@ TEST_CASE("TestSetPortId", "[S2S1]") {
}
TEST_CASE("TestSetPortIdUppercase", "[S2S2]") {
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::DataStream()),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(new org::apache::nifi::minifi::io::DataStream()), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
@@ -102,12 +94,8 @@ TEST_CASE("TestSiteToSiteVerifySend", "[S2S3]") {
sunny_path_bootstrap(collector);
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::BaseStream(collector)),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<minifi::io::DataStream>(new org::apache::nifi::minifi::io::BaseStream(collector)), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
@@ -137,9 +125,7 @@ TEST_CASE("TestSiteToSiteVerifySend", "[S2S3]") {
collector->get_next_client_response();
REQUIRE(collector->get_next_client_response() == "PORT_IDENTIFIER");
collector->get_next_client_response();
- REQUIRE(
- collector->get_next_client_response()
- == "c56a4180-65aa-42ec-a945-5fd21dec0538");
+ REQUIRE(collector->get_next_client_response() == "c56a4180-65aa-42ec-a945-5fd21dec0538");
collector->get_next_client_response();
REQUIRE(collector->get_next_client_response() == "REQUEST_EXPIRATION_MILLIS");
collector->get_next_client_response();
@@ -176,12 +162,8 @@ TEST_CASE("TestSiteToSiteVerifyNegotiationFail", "[S2S4]") {
collector->push_response(resp_code);
collector->push_response(resp_code);
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::BaseStream(collector)),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<minifi::io::DataStream>(new org::apache::nifi::minifi::io::BaseStream(collector)), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/SiteToSiteHelper.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/SiteToSiteHelper.h b/libminifi/test/unit/SiteToSiteHelper.h
index 1876bde..586b17a 100755
--- a/libminifi/test/unit/SiteToSiteHelper.h
+++ b/libminifi/test/unit/SiteToSiteHelper.h
@@ -79,8 +79,7 @@ class SiteToSiteResponder : public minifi::io::BaseStream {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint16_t &base_value, bool is_little_endian =
- minifi::io::EndiannessCheck::IS_LITTLE) {
+ virtual int read(uint16_t &base_value, bool is_little_endian = minifi::io::EndiannessCheck::IS_LITTLE) {
base_value = std::stoi(get_next_response());
return 2;
}
@@ -122,8 +121,7 @@ class SiteToSiteResponder : public minifi::io::BaseStream {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint32_t &value, bool is_little_endian =
- minifi::io::EndiannessCheck::IS_LITTLE) {
+ virtual int read(uint32_t &value, bool is_little_endian = minifi::io::EndiannessCheck::IS_LITTLE) {
value = std::stoul(get_next_response());
return 4;
}
@@ -134,8 +132,7 @@ class SiteToSiteResponder : public minifi::io::BaseStream {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint64_t &value, bool is_little_endian =
- minifi::io::EndiannessCheck::IS_LITTLE) {
+ virtual int read(uint64_t &value, bool is_little_endian = minifi::io::EndiannessCheck::IS_LITTLE) {
value = std::stoull(get_next_response());
return 8;
}