fgerlits commented on a change in pull request #1040:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1040#discussion_r613251303



##########
File path: extensions/standard-processors/tests/unit/PutFileTests.cpp
##########
@@ -467,4 +467,39 @@ TEST_CASE("TestPutFilePermissions", 
"[PutFilePermissions]") {
   REQUIRE(utils::file::FileUtils::get_permissions(putfiledir, perms));
   REQUIRE(perms == 0777);
 }
+
+TEST_CASE("PutFileCreateDirectoryTest", "[PutFilePermissions]") {
+  TestController testController;
+  LogTestController::getInstance().setDebug<minifi::processors::GetFile>();
+  LogTestController::getInstance().setDebug<TestPlan>();
+  LogTestController::getInstance().setDebug<minifi::processors::PutFile>();
+  
LogTestController::getInstance().setDebug<minifi::processors::PutFile::ReadCallback>();
+  
LogTestController::getInstance().setDebug<minifi::processors::LogAttribute>();
+
+  std::shared_ptr<TestPlan> plan = testController.createPlan();
+  std::shared_ptr<core::Processor> getfile = plan->addProcessor("GetFile", 
"getfileCreate2");
+  std::shared_ptr<core::Processor> putfile = plan->addProcessor("PutFile", 
"putfile", core::Relationship("success", "description"), true);
+  plan->addProcessor("LogAttribute", "logattribute", 
core::Relationship("success", "description"), true);
+
+  // Define Directory
+  char format[] = "/tmp/gt.XXXXXX";
+  auto dir = testController.createTempDirectory(format);
+  char format2[] = "/tmp/ft.XXXXXX";
+  // Defining a sub directory
+  auto putfiledir = testController.createTempDirectory(format2) + 
utils::file::FileUtils::get_separator() + "test_dir";
+  plan->setProperty(getfile, 
org::apache::nifi::minifi::processors::GetFile::Directory.getName(), dir);
+  plan->setProperty(putfile, 
org::apache::nifi::minifi::processors::PutFile::Directory.getName(), 
putfiledir);
+
+  plan->setProperty(putfile, 
org::apache::nifi::minifi::processors::PutFile::CreateDirs.getName(), "true");

Review comment:
       I like the new SECTIONs, this test has quite good coverage now. :+1: 




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