bakaid commented on a change in pull request #605:
URL: https://github.com/apache/nifi-minifi-cpp/pull/605#discussion_r413745426



##########
File path: libminifi/test/TestBase.cpp
##########
@@ -45,6 +45,23 @@ TestPlan::TestPlan(std::shared_ptr<core::ContentRepository> 
content_repo, std::s
       flow_version_(flow_version),
       logger_(logging::LoggerFactory<TestPlan>::getLogger()) {
   stream_factory = 
org::apache::nifi::minifi::io::StreamFactory::getInstance(std::make_shared<minifi::Configure>());
+  controller_services_ = 
std::make_shared<core::controller::ControllerServiceMap>();
+  controller_services_provider_ = 
std::make_shared<core::controller::StandardControllerServiceProvider>(controller_services_,
 nullptr, configuration_);
+  /* Inject the default state provider ahead of ProcessContext to make sure we 
have a unique state directory */
+  if (state_dir == nullptr) {
+    char state_dir_name_template[] = "/tmp/teststate.XXXXXX";
+    state_dir_ = 
utils::file::FileUtils::create_temp_directory(state_dir_name_template);
+  } else {
+    state_dir_ = state_dir;
+  }
+  state_manager_provider_ = 
core::ProcessContext::getOrCreateDefaultStateManagerProvider(controller_services_provider_,
 configuration_, state_dir_.c_str());

Review comment:
       Done.

##########
File path: libminifi/test/integration/IntegrationBase.h
##########
@@ -121,6 +122,11 @@ void IntegrationBase::run(std::string test_file_location) {
 
   core::YamlConfiguration yaml_config(test_repo, test_repo, content_repo, 
stream_factory, configuration, test_file_location);
 
+  auto controller_service_provider = yaml_ptr->getControllerServiceProvider();
+  char state_dir_name_template[] = "/tmp/integrationstate.XXXXXX";
+  state_dir = 
utils::file::FileUtils::create_temp_directory(state_dir_name_template);
+  
core::ProcessContext::getOrCreateDefaultStateManagerProvider(controller_service_provider,
 configuration, state_dir.c_str());

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to