[
https://issues.apache.org/jira/browse/NIFI-10583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Secules updated NIFI-10583:
--------------------------------
Description:
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.
was:
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.
> 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)