tlsmith109 commented on a change in pull request #4620:
URL: https://github.com/apache/nifi/pull/4620#discussion_r539615600
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestPutSFTP.java
##########
@@ -243,9 +244,58 @@ public void testPutSFTPBatching() throws IOException {
putSFTPRunner.clearTransferState();
}
+ @Test
+ public void testPutSFTPProvenanceTransitUri() throws IOException {
+ emptyTestDirectory();
+
+ putSFTPRunner.setProperty(SFTPTransfer.REJECT_ZERO_BYTE, "false");
+ Map<String,String> attributes = new HashMap<>();
+ attributes.put("filename", "testfile.txt");
+ attributes.put("transfer-host","localhost");
+
+ putSFTPRunner.enqueue(Paths.get(testFile), attributes);
+
+ attributes = new HashMap<>();
+ attributes.put("filename", "testfile1.txt");
+ attributes.put("transfer-host","127.0.0.1");
+
+ putSFTPRunner.enqueue(Paths.get(testFile), attributes);
+ putSFTPRunner.run();
+
+ putSFTPRunner.assertTransferCount(PutSFTP.REL_SUCCESS, 2);
+ putSFTPRunner.getProvenanceEvents().forEach(k->{
+ assert(k.toString().contains("sftp://localhost"));
+ });
+ //Two files in batch, should have 2 transferred to success, 0 to
failure
+ putSFTPRunner.assertTransferCount(PutSFTP.REL_SUCCESS, 2);
+ putSFTPRunner.assertTransferCount(PutSFTP.REL_REJECT, 0);
+
+ MockFlowFile flowFile1 =
putSFTPRunner.getFlowFilesForRelationship(PutFileTransfer.REL_SUCCESS).get(0);
+ MockFlowFile flowFile2 =
putSFTPRunner.getFlowFilesForRelationship(PutFileTransfer.REL_SUCCESS).get(1);
+ putSFTPRunner.clearProvenanceEvents();
+ putSFTPRunner.clearTransferState();
+
+ //Test different destinations on flow file attributes
+ putSFTPRunner.setProperty(SFTPTransfer.HOSTNAME,"${transfer-host}");
//set to derive hostname
+
+ putSFTPRunner.enqueue(flowFile1);
+ putSFTPRunner.run();
Review comment:
No guarantee of order of provenance events unless separate runs for
result assertions.
----------------------------------------------------------------
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]