0
votes

I am implementing MUnit with java for a mule flow. The flow is having a flow variable who's value is being derived from a variable in another flow. So, I need to have this value set in java which would be run as Junit.

Please let me know how do we set flow/session variables in Java that will be testing the mule flow.

Thanks in advance.

3

3 Answers

1
votes
0
votes

We can set it by using eventcontext as below:

eventContext.getMessage().setInvocationProperty(key, value);

So , you can access that flow variable by key anywhere.

0
votes

Like this:

    <set-session-variable doc:name="Session Variable" value="#[flowVars.acme_id]" variableName="myVar"/>
    <set-variable variableName="munit-json-payload" value="#[getResource('testData/good-response.json').asString()]" doc:name="Variable"/>