You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pw...@apache.org on 2018/12/20 17:05:32 UTC
[nifi] branch master updated: NIFI-5871 ignore UUID attribute when
copying flow file attributes (#3203)
This is an automated email from the ASF dual-hosted git repository.
pwicks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new f9f386b NIFI-5871 ignore UUID attribute when copying flow file attributes (#3203)
f9f386b is described below
commit f9f386b0f01fb7492ea6e9a56ca6cbc3d4578ad3
Author: SavtechSolutions <al...@gmail.com>
AuthorDate: Thu Dec 20 12:05:25 2018 -0500
NIFI-5871 ignore UUID attribute when copying flow file attributes (#3203)
NIFI-5871 ignore UUID attribute when copying flow file attributes
Signed-off-by: Peter Wicks <pa...@gmail.com>
---
.../main/java/org/apache/nifi/util/MockProcessSession.java | 9 ++++++++-
.../nifi/processors/couchbase/TestPutCouchbaseKey.java | 1 -
.../java/org/apache/nifi/processors/standard/TestWait.java | 12 ------------
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
index 1629e96..f48b919 100644
--- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
+++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
@@ -496,7 +496,14 @@ public class MockProcessSession implements ProcessSession {
final MockFlowFile newFlowFile = new MockFlowFile(mock.getId(), flowFile);
currentVersions.put(newFlowFile.getId(), newFlowFile);
- newFlowFile.putAttributes(attrs);
+ final Map<String, String> updatedAttributes;
+ if (attrs.containsKey(CoreAttributes.UUID.key())) {
+ updatedAttributes = new HashMap<>(attrs);
+ updatedAttributes.remove(CoreAttributes.UUID.key());
+ } else {
+ updatedAttributes = attrs;
+ }
+ newFlowFile.putAttributes(updatedAttributes);
return newFlowFile;
}
diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/test/java/org/apache/nifi/processors/couchbase/TestPutCouchbaseKey.java b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/test/java/org/apache/nifi/processors/couchbase/TestPutCouchbaseKey.java
index ce9baa7..c32fff7 100644
--- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/test/java/org/apache/nifi/processors/couchbase/TestPutCouchbaseKey.java
+++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/test/java/org/apache/nifi/processors/couchbase/TestPutCouchbaseKey.java
@@ -268,7 +268,6 @@ public class TestPutCouchbaseKey {
ArgumentCaptor<RawJsonDocument> capture = ArgumentCaptor.forClass(RawJsonDocument.class);
verify(bucket, times(1)).upsert(capture.capture(), eq(PersistTo.NONE), eq(ReplicateTo.NONE));
- assertEquals(uuid, capture.getValue().id());
assertEquals(inFileData, capture.getValue().content());
testRunner.assertTransferCount(REL_SUCCESS, 1);
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
index a4df2f3..5b5b6fc 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestWait.java
@@ -218,7 +218,6 @@ public class TestWait {
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);
@@ -234,8 +233,6 @@ public class TestWait {
// show a new attribute was copied from the cache
assertEquals("notifyValue", outputFlowFile.getAttribute("notify.only"));
- // show that uuid was not overwritten
- assertEquals(waitAttributes.get("uuid"), outputFlowFile.getAttribute("uuid"));
// show that the original attributes are still there
assertEquals("waitValue", outputFlowFile.getAttribute("wait.only"));
@@ -265,7 +262,6 @@ public class TestWait {
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);
@@ -278,8 +274,6 @@ public class TestWait {
// show a new attribute was copied from the cache
assertEquals("notifyValue", outputFlowFile.getAttribute("notify.only"));
- // show that uuid was not overwritten
- assertEquals(waitAttributes.get("uuid"), outputFlowFile.getAttribute("uuid"));
// show that the original attributes are still there
assertEquals("waitValue", outputFlowFile.getAttribute("wait.only"));
@@ -307,7 +301,6 @@ public class TestWait {
waitAttributes.put("targetSignalCount", "3");
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);
@@ -359,8 +352,6 @@ public class TestWait {
// show a new attribute was copied from the cache
assertEquals("notifyValue", outputFlowFile.getAttribute("notify.only"));
- // show that uuid was not overwritten
- assertEquals(waitAttributes.get("uuid"), outputFlowFile.getAttribute("uuid"));
// show that the original attributes are still there
assertEquals("waitValue", outputFlowFile.getAttribute("wait.only"));
// show that the original attribute is kept
@@ -391,7 +382,6 @@ public class TestWait {
waitAttributes.put("signalCounterName", "counter-B");
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);
@@ -446,8 +436,6 @@ public class TestWait {
// show a new attribute was copied from the cache
assertEquals("notifyValue", outputFlowFile.getAttribute("notify.only"));
- // show that uuid was not overwritten
- assertEquals(waitAttributes.get("uuid"), outputFlowFile.getAttribute("uuid"));
// show that the original attributes are still there
assertEquals("waitValue", outputFlowFile.getAttribute("wait.only"));
// show that the original attribute is kept