markap14 commented on a change in pull request #3438: NIFI-6220: If FlowFile is
created by cloning a relationship, do not c…
URL: https://github.com/apache/nifi/pull/3438#discussion_r277307358
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/integration/provenance/ProvenanceEventsIT.java
##########
@@ -420,4 +420,62 @@ public void testForkAutoGenerated() throws
ExecutionException, InterruptedExcept
final ProvenanceEventRecord thirdEvent = provRepo.getEvent(2L);
assertEquals(ProvenanceEventType.DROP, thirdEvent.getEventType());
}
+
+ @Test
+ public void testCloneOnMultipleConnectionsForRelationship() throws
ExecutionException, InterruptedException, IOException {
+ final ProcessorNode generateProcessor = createGenerateProcessor(0);
+ final ProcessorNode passThroughProcessor =
createProcessorNode((context, session) -> {
+ FlowFile original = session.get();
+ session.transfer(original, REL_SUCCESS);
+ }, REL_SUCCESS);
+
+ connect(generateProcessor, passThroughProcessor, REL_SUCCESS);
+ connect(passThroughProcessor, getTerminateProcessor(), REL_SUCCESS);
+ connect(passThroughProcessor, getTerminateAllProcessor(), REL_SUCCESS);
+
+ triggerOnce(generateProcessor);
+ triggerOnce(passThroughProcessor);
+
+ final ProvenanceEventRepository provRepo = getProvenanceRepository();
+ assertEquals(1L, provRepo.getMaxEventId().longValue());
+
+ final ProvenanceEventRecord firstEvent = provRepo.getEvent(0L);
+ assertEquals(ProvenanceEventType.CREATE, firstEvent.getEventType());
+
+ final ProvenanceEventRecord secondEvent = provRepo.getEvent(1L);
+ assertEquals(ProvenanceEventType.CLONE, secondEvent.getEventType());
+ assertEquals(1, secondEvent.getParentUuids().size());
+ assertEquals(1, secondEvent.getChildUuids().size());
+ }
+
+ @Test
+ public void
testCloneOnMultipleConnectionsForRelationshipIncludesUpToDateAttributes()
throws ExecutionException, InterruptedException, IOException {
+ final ProcessorNode generateProcessor = createGenerateProcessor(0);
+ final ProcessorNode passThroughProcessor =
createProcessorNode((context, session) -> {
+ FlowFile original = session.get();
+ original = session.putAttribute(original, "test", "integration");
+
+ session.transfer(original, REL_SUCCESS);
+ }, REL_SUCCESS);
+
+ connect(generateProcessor, passThroughProcessor, REL_SUCCESS);
+ connect(passThroughProcessor, getTerminateProcessor(), REL_SUCCESS);
+ connect(passThroughProcessor, getTerminateAllProcessor(), REL_SUCCESS);
+
+ triggerOnce(generateProcessor);
+ triggerOnce(passThroughProcessor);
+
+ final ProvenanceEventRepository provRepo = getProvenanceRepository();
+ assertEquals(1L, provRepo.getMaxEventId().longValue());
Review comment:
@ijokarumawak in the example that you have above, you are getting the
ATTRIBUTES MODIFIED event because UpdateAttribute explicitly creates that event
- not the framework. So if you used, for example, LogAttribute instead of
UpdateAttribute, then you should not see that behavior.
As for the `thirdEvent` that was just a mistake because I copied & pasted
the assertions of the test above it. Will fix that.
----------------------------------------------------------------
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]
With regards,
Apache Git Services