This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 31b5dc56c6 NIFI-14891 Fixed StandardProvenanceReporter receive method
to match API (#10231)
31b5dc56c6 is described below
commit 31b5dc56c6ab76f52cabb039a022e0b37ca49648
Author: markobean <[email protected]>
AuthorDate: Tue Aug 26 09:12:05 2025 -0400
NIFI-14891 Fixed StandardProvenanceReporter receive method to match API
(#10231)
Signed-off-by: David Handermann <[email protected]>
---
.../repository/StandardProvenanceReporter.java | 4 ++--
.../repository/StandardProvenanceReporterTest.java | 23 ++++++++++++++++++++++
.../apache/nifi/util/MockProvenanceReporter.java | 4 ++--
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java
index 832b9bba1b..4348b6ef44 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java
@@ -151,8 +151,8 @@ public class StandardProvenanceReporter implements
InternalProvenanceReporter {
}
@Override
- public void receive(FlowFile flowFile, String transitUri, String details) {
- receive(flowFile, transitUri, details, -1L);
+ public void receive(FlowFile flowFile, String transitUri, String
sourceSystemFlowFileIdentifier) {
+ receive(flowFile, transitUri, sourceSystemFlowFileIdentifier, null,
-1L);
}
@Override
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/repository/StandardProvenanceReporterTest.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/repository/StandardProvenanceReporterTest.java
index d636f3224e..2cf586304b 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/repository/StandardProvenanceReporterTest.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/controller/repository/StandardProvenanceReporterTest.java
@@ -28,6 +28,7 @@ import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
@@ -49,7 +50,29 @@ class StandardProvenanceReporterTest {
assertEquals(1, records.size());
final ProvenanceEventRecord record = records.iterator().next();
assertNotNull(record);
+ assertEquals("test://noop", record.getTransitUri());
+ assertNull(record.getSourceSystemFlowFileIdentifier());
assertEquals("These are details", record.getDetails());
+ assertEquals(-1L, record.getEventDuration());
+ }
+
+ @Test
+ public void testSourceSystemFlowFileIdentifierRetainedWithDelegate() {
+ final ProvenanceEventRepository mockRepo =
Mockito.mock(ProvenanceEventRepository.class);
+ final StandardProvenanceReporter reporter = new
StandardProvenanceReporter(null, "1234", "TestProc", mockRepo, null);
+ Mockito.when(mockRepo.eventBuilder()).thenReturn(new
StandardProvenanceEventRecord.Builder());
+
+ final FlowFile flowFile = new
StandardFlowFileRecord.Builder().id(10L).addAttribute("uuid", "10").build();
+ reporter.receive(flowFile, "test://noop", "urn:nifi:mock-uuid-value");
+ final Set<ProvenanceEventRecord> records = reporter.getEvents();
+ assertNotNull(records);
+ assertEquals(1, records.size());
+ final ProvenanceEventRecord record = records.iterator().next();
+ assertNotNull(record);
+ assertEquals("test://noop", record.getTransitUri());
+ assertEquals("urn:nifi:mock-uuid-value",
record.getSourceSystemFlowFileIdentifier());
+ assertNull(record.getDetails());
+ assertEquals(-1L, record.getEventDuration());
}
@Test
diff --git
a/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java
b/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java
index 64184e98ac..652d9ef1ae 100644
--- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java
+++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java
@@ -79,8 +79,8 @@ public class MockProvenanceReporter implements
ProvenanceReporter {
}
@Override
- public void receive(FlowFile flowFile, String transitUri, String details) {
- receive(flowFile, transitUri, details, -1L);
+ public void receive(FlowFile flowFile, String transitUri, String
sourceSystemFlowFileIdentifier) {
+ receive(flowFile, transitUri, sourceSystemFlowFileIdentifier, null,
-1L);
}
@Override