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



##########
File path: extensions/standard-processors/tests/unit/GetFileTests.cpp
##########
@@ -91,12 +113,30 @@ TEST_CASE("GetFile: MaxSize", "[getFileFifo]") {  // NOLINT
 #endif
 }
 
-
-TEST_CASE("GetFile: Directory", "[getFileDir]") {
-  TestController testController;
+TEST_CASE("GetFile onSchedule() throws if the required Directory property is 
not set", "[GetFile]") {
+  TestController test_controller;
   LogTestController::getInstance().setTrace<TestPlan>();
   LogTestController::getInstance().setTrace<processors::GetFile>();
-  auto plan = testController.createPlan();
+  auto plan = test_controller.createPlan();
   auto get_file = plan->addProcessor("GetFile", "Get");
   REQUIRE_THROWS_AS(plan->runNextProcessor(), minifi::Exception&);
 }
+
+TEST_CASE("GetFile removes the source file if KeepSourceFile is false") {
+  GetFileTestController test_controller;
+  SECTION("KeepSourceFile is not set, so defaults to false") {}
+  SECTION("KeepSourceFile is set to false explicitly") { 
test_controller.setProperty(processors::GetFile::KeepSourceFile, "false"); }
+
+  test_controller.runSession();
+
+  
REQUIRE_FALSE(utils::file::FileUtils::exists(test_controller.input_file_name_));
+}
+
+TEST_CASE("GetFile keeps the source file if KeepSourceFile is true") {
+  GetFileTestController test_controller;
+  test_controller.setProperty(processors::GetFile::KeepSourceFile, "true");
+
+  test_controller.runSession();
+
+  REQUIRE(utils::file::FileUtils::exists(test_controller.input_file_name_));
+}

Review comment:
       I have created a new Jira for this: 
https://issues.apache.org/jira/browse/MINIFICPP-1555




-- 
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:
[email protected]


Reply via email to