use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method assignValueToNewSessionVariable.
@Test
public void assignValueToNewSessionVariable() throws Exception {
Message message = of("");
CoreEvent event = InternalEvent.builder(context).message(message).build();
evaluate("sessionVars['foo']='bar'", event);
assertEquals("bar", ((PrivilegedEvent) event).getSession().getProperty("foo"));
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method reassignValueToLocalVariable.
/**
* See MULE-6381
*/
@Test
public void reassignValueToLocalVariable() throws Exception {
Message message = of("");
CoreEvent event = InternalEvent.builder(context).message(message).build();
evaluate("localVar='bar';localVar='bar2'", event);
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method assignValueToSessionVariable.
@Test
public void assignValueToSessionVariable() throws Exception {
Message message = of("");
PrivilegedEvent event = (PrivilegedEvent) InternalEvent.builder(context).message(message).build();
event.getSession().setProperty("foo", "bar_old");
evaluate("sessionVars['foo']='bar'", event);
assertEquals("bar", event.getSession().getProperty("foo"));
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method sessionVariablesMap.
@Test
public void sessionVariablesMap() throws Exception {
Message message = of("");
CoreEvent event = InternalEvent.builder(context).message(message).build();
((PrivilegedEvent) event).getSession().setProperty("foo", "bar");
assertTrue(evaluate("sessionVars", event) instanceof Map);
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method assignValueToNewFlowVariable.
@Test
public void assignValueToNewFlowVariable() throws Exception {
Message message = of("");
CoreEvent event = InternalEvent.builder(context).message(message).build();
CoreEvent.Builder eventBuilder = CoreEvent.builder(event);
evaluate("flowVars['foo']='bar'", event, eventBuilder);
assertEquals("bar", eventBuilder.build().getVariables().get("foo").getValue());
}
Aggregations