ijokarumawak commented on a change in pull request #3233: NIFI-5892 Wait 
timestamp lingers, potentially messing up downstream w…
URL: https://github.com/apache/nifi/pull/3233#discussion_r244099572
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
 ##########
 @@ -72,6 +72,61 @@ public void testWait() throws InitializationException {
         runner.clearTransferState();
     }
 
+    @Test
+    public void testSuccessClearsWaitTimestamp() throws 
InitializationException, IOException {
+        Map<String, String> cachedAttributes = new HashMap<>();
+        cachedAttributes.put("both", "notifyValue");
+        cachedAttributes.put("uuid", "notifyUuid");
+        cachedAttributes.put("notify.only", "notifyValue");
+
+        // Setup existing cache entry.
+        final WaitNotifyProtocol protocol = new WaitNotifyProtocol(service);
+        protocol.notify("key", "default", 1, cachedAttributes);
+
+        runner.setProperty(Wait.RELEASE_SIGNAL_IDENTIFIER, 
"${releaseSignalAttribute}");
+        runner.setProperty(Wait.ATTRIBUTE_COPY_MODE, 
Wait.ATTRIBUTE_COPY_KEEP_ORIGINAL.getValue());
+
+        final Map<String, String> waitAttributes = new HashMap<>();
+        waitAttributes.put("releaseSignalAttribute", "key");
+        waitAttributes.put("wait.only", "waitValue");
+        waitAttributes.put("both", "waitValue");
+        waitAttributes.put("uuid", UUID.randomUUID().toString());
+        String flowFileContent = "content";
+        runner.enqueue(flowFileContent.getBytes("UTF-8"), waitAttributes);
+
+        runner.run();
+
+        runner.assertAllFlowFilesTransferred(Wait.REL_SUCCESS, 1);
+        runner.assertTransferCount(Wait.REL_SUCCESS, 1);
+
+        final MockFlowFile outputFlowFile = 
runner.getFlowFilesForRelationship(Wait.REL_SUCCESS).get(0);
+
+        outputFlowFile.assertAttributeNotExists(Wait.WAIT_START_TIMESTAMP);
 
 Review comment:
   Please add this assertion into existing test methods routing FlowFiles to 
FAILURE such as:
   - testEmptyReleaseSignal
   - testFailingCacheService

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to