-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 6.0-HF13, 7.4, 7.10
-
Component/s: Automation
-
Tags:
-
Sprint:TGV 11
As a result of NXP-17114, if a chain runs a subchain, and the subchain sets a context variable each time it runs, the context is not updated with the new setting when the subchain runs a second, third, fourth ... time.
MvelTest.java
@Test public void testMvelOnList() throws Exception { try { service.putOperation(RunOnListItem.class); OperationContext ctx = new OperationContext(session); String input = "dummyInput"; ctx.setInput(input); ArrayList<String> users = new ArrayList<String>(); users.add("foo"); users.add("bar"); users.add("baz"); users.add("bum"); ctx.put("users", users); factory.toggleRecording(); OperationChain chain = new OperationChain("testChain"); chain.add(RunOperationOnList.ID).set("list", "users").set("id", "mvelchain1").set("isolate", "false"); service.run(ctx, chain); } finally { service.removeOperation(RunOnListItem.class); }
mvelchain1.xml
<chain id="mvelchain1"> <operation id="Context.SetVar"> <param type="string" name="name">myvar</param> <param type="object" name="value">expr:Context["item"]</param> </operation> <operation id="LogOperation"> <param type="string" name="level">error</param> <param type="string" name="message">expr:Context["myvar"].toString()</param> </operation> </chain>
If recording is enabled, log shows
13:57:57,718 [main] ERROR [LogOperation] foo 13:57:57,722 [main] ERROR [LogOperation] foo 13:57:57,722 [main] ERROR [LogOperation] foo 13:57:57,723 [main] ERROR [LogOperation] foo
Correct output is
14:08:44,862 [main] ERROR [LogOperation] foo 14:08:44,866 [main] ERROR [LogOperation] bar 14:08:44,867 [main] ERROR [LogOperation] baz 14:08:44,867 [main] ERROR [LogOperation] bum