mirror of https://github.com/apache/nifi.git
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 <patricker@gmail.com>
This commit is contained in:
parent
f22a6c46ad
commit
f9f386b0f0
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue