Devin Fisher created NIFI-16609:
-----------------------------------

             Summary: MockValidationContext does not propagate Parameter 
Context values from MockProcessContext
                 Key: NIFI-16609
                 URL: https://issues.apache.org/jira/browse/NIFI-16609
             Project: Apache NiFi
          Issue Type: Bug
          Components: NiFi API
    Affects Versions: nifi-api-2.12.0
            Reporter: Devin Fisher


{{MockValidationContext}} receives a {{MockProcessContext}} in its constructor, 
but it appears that the {{contextParameters}} from the {{MockProcessContext}} 
are not being carried over.

Minimal Test to reproduce:
{code:java}
  @Test
  void resolvesParameterContextValue() {
    var testRunner = TestRunners.newTestRunner( UpdateAttribute.class);

    testRunner.setParameterContextValue("test-param", "resolved-value");
    testRunner.setProperty("param_based_attr", "#{test-param}");

    testRunner.enqueue(new byte[0]);
    testRunner.run();
  }
{code}

Specifically it seem to be here:

https://github.com/apache/nifi/blob/rel/nifi-2.12.0/nifi-mock/src/main/java/org/apache/nifi/util/MockProcessContext.java#L289

that calls here:

https://github.com/apache/nifi/blob/rel/nifi-2.12.0/nifi-mock/src/main/java/org/apache/nifi/util/MockValidationContext.java#L58
which sets the  {{parameterLookup}} to {{ParameterLookup.EMPTY}}

Seems like it should get the parameterLookup from the passed in 
MockProcessContext




 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to