NIFI-3218: fixed incorrect assertion for self-routing flowfiles in 
MockProcessSession

Signed-off-by: Joe Skora <[email protected]>

This closes #1988.


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/07a6499d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/07a6499d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/07a6499d

Branch: refs/heads/master
Commit: 07a6499dae93344b0e8a8e8cd890ba16cf667fe2
Parents: 58f60b3
Author: m-hogue <[email protected]>
Authored: Fri Jul 7 06:46:02 2017 -0400
Committer: Joe Skora <[email protected]>
Committed: Tue Jul 11 13:51:40 2017 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/nifi/util/MockProcessSession.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/07a6499d/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessSession.java
----------------------------------------------------------------------
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 553c6e4..2fdc6ea 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
@@ -756,10 +756,10 @@ public class MockProcessSession implements ProcessSession 
{
             throw new IllegalArgumentException("I only accept MockFlowFile");
         }
 
-        // if the flowfile provided was created in this session (i.e. it's in 
currentVersions),
+        // if the flowfile provided was created in this session (i.e. it's in 
currentVersions and not in original versions),
         // then throw an exception indicating that you can't transfer 
flowfiles back to self.
-        // this mimics the behavior of StandardProcessSession
-        if(currentVersions.get(flowFile.getId()) != null) {
+        // this mimics the same behavior in StandardProcessSession
+        if(currentVersions.get(flowFile.getId()) != null && 
originalVersions.get(flowFile.getId()) == null) {
             throw new IllegalArgumentException("Cannot transfer FlowFiles that 
are created in this Session back to self");
         }
 

Reply via email to