[
https://issues.apache.org/jira/browse/NIFI-10583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612767#comment-17612767
]
Joe Witt commented on NIFI-10583:
---------------------------------
Are you verifying against the result of session.transfer(ff, REL_SUCCESS) or
against the ff you passed in?
> StandardProcessSession and MockProcessSession Handle Attribute Update
> Differently
> ---------------------------------------------------------------------------------
>
> Key: NIFI-10583
> URL: https://issues.apache.org/jira/browse/NIFI-10583
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.14.0, 1.17.0
> Reporter: Eric Secules
> Priority: Major
>
> When writing some custom processors I noticed that I can execute the
> following code in onTrigger which would set the attribute when I run in
> StandardProcessSession on a real nifi, but would fail my unit tests if I
> assert that the attribute exists.
> {code:java}
> FlowFile ff = session.get();
> session.putAttribute(ff, "foo", "123");
> session.transfer.(ff, REL_SUCCESS)
> {code}
> So the StandardProcessSession mutates the flowfile passed in while the
> MockProcessSession does not.
> The desired outcome is that the StandardProcessSession behaves the same way
> as the MockProcessSession, ideally neither of them should mutate the flowfile
> passed in and should only return a copy of the flowfile with the new
> attribute(s) added.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)