szaszm commented on a change in pull request #1165:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1165#discussion_r726046742



##########
File path: libminifi/test/TestBase.cpp
##########
@@ -447,3 +591,38 @@ void TestPlan::validateAnnotations() const {
     processor->validateAnnotations();
   }
 }
+
+std::string TestPlan::getContent(const 
std::shared_ptr<minifi::core::FlowFile>& file) {
+  auto content_claim = file->getResourceClaim();
+  auto content_stream = content_repo_->read(*content_claim);
+  auto output_stream = std::make_shared<minifi::io::BufferStream>();
+  minifi::InputStreamPipe{output_stream}.process(content_stream);
+  return {reinterpret_cast<const char*>(output_stream->getBuffer()), 
output_stream->size()};
+}
+
+TestController::TestController()
+    : log(LogTestController::getInstance()) {
+  minifi::setDefaultDirectory("./");
+  log.reset();
+  
minifi::utils::IdGenerator::getIdGenerator()->initialize(std::make_shared<minifi::Properties>());
+  flow_version_ = 
std::make_shared<minifi::state::response::FlowVersion>("test", "test", "test");
+}
+
+std::shared_ptr<TestPlan> 
TestController::createPlan(std::shared_ptr<minifi::Configure> configuration, 
const char* state_dir) {
+  if (configuration == nullptr) {
+    configuration = std::make_shared<minifi::Configure>();
+    
configuration->set(minifi::Configure::nifi_state_management_provider_local_class_name,
 "UnorderedMapKeyValueStoreService");
+  }
+
+  auto content_repo = 
std::make_shared<minifi::core::repository::VolatileContentRepository>();
+  content_repo->initialize(configuration);
+
+  return std::make_shared<TestPlan>(std::move(content_repo), 
std::make_shared<TestRepository>(), std::make_shared<TestRepository>(), 
flow_version_, configuration, state_dir);
+}
+
+std::string TestController::createTempDirectory() {
+  char format[] = "/var/tmp/nifi-minifi-cpp.test.XXXXXX";

Review comment:
       Not in this case. It's passed to `mkdtemp` which expects `char*` and 
modifies the buffer to the created temp directory name. Changing this behavior 
would require changing file utils.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to