lordgamez commented on a change in pull request #1173:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1173#discussion_r725943165
##########
File path: extensions/http-curl/tests/unit/InvokeHTTPTests.cpp
##########
@@ -306,3 +291,93 @@ TEST_CASE("HTTPTestsPostNoResourceClaim", "[httptest1]") {
REQUIRE(true == LogTestController::getInstance().contains("Exiting because
method is POST"));
LogTestController::getInstance().reset();
}
+
+TEST_CASE("HTTPTestsPenalizeNoRetry", "[httptest1]") {
+ TestController testController;
+ using processors::InvokeHTTP;
+
+ std::shared_ptr<core::ContentRepository> content_repo =
std::make_shared<core::repository::VolatileContentRepository>();
+ std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
+
+
LogTestController::getInstance().setTrace<org::apache::nifi::minifi::processors::GenerateFlowFile>();
+
LogTestController::getInstance().setTrace<org::apache::nifi::minifi::processors::ListenHTTP>();
+
LogTestController::getInstance().setTrace<org::apache::nifi::minifi::processors::InvokeHTTP>();
+ LogTestController::getInstance().setTrace<minifi::core::ProcessSession>();
+
+ std::shared_ptr<core::Processor> listenhttp =
std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ listenhttp->initialize();
+ std::shared_ptr<core::ProcessorNode> node =
std::make_shared<core::ProcessorNode>(listenhttp);
+ std::shared_ptr<core::ProcessContext> context =
std::make_shared<core::ProcessContext>(node, nullptr, repo, repo, content_repo);
+
context->setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
"/testytesttest");
+
context->setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
"8681");
+ auto session = std::make_shared<core::ProcessSession>(context);
+ std::shared_ptr<core::ProcessSessionFactory> factory =
std::make_shared<core::ProcessSessionFactory>(context);
+ listenhttp->setScheduledState(core::ScheduledState::RUNNING);
+ listenhttp->onSchedule(context, factory);
+ listenhttp->onTrigger(context, session);
+
+ std::shared_ptr<TestPlan> plan = testController.createPlan();
+ std::shared_ptr<core::Processor> genfile =
plan->addProcessor("GenerateFlowFile", "genfile");
+ std::shared_ptr<core::Processor> invokehttp =
plan->addProcessor("InvokeHTTP", "invokehttp", core::Relationship("success",
"description"), true);
+
+ plan->setProperty(invokehttp,
org::apache::nifi::minifi::processors::InvokeHTTP::Method.getName(), "GET");
+ plan->setProperty(invokehttp,
org::apache::nifi::minifi::processors::InvokeHTTP::URL.getName(),
"http://localhost:8681/testytesttest");
+
+ SECTION("with penalize on no retry set to true") {
+ plan->setProperty(invokehttp,
+
org::apache::nifi::minifi::processors::InvokeHTTP::PenalizeOnNoRetry.getName(),
+ "true");
+ invokehttp->setAutoTerminatedRelationships({InvokeHTTP::RelFailure,
InvokeHTTP::RelNoRetry, InvokeHTTP::RelResponse,
+ InvokeHTTP::RelRetry});
+ testController.runSession(plan, true);
+
+ REQUIRE(LogTestController::getInstance().contains("Flowfile has been
penalized"));
+ } SECTION("with penalize on no retry set to false") {
Review comment:
The second section should start on a new line
--
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]