use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class ExceptionTestCase method exceptionCausedBy.
@Test
public void exceptionCausedBy() throws Exception {
CoreEvent event = createEvent();
Message message = event.getMessage();
MessagingException me = new MessagingException(CoreMessages.createStaticMessage(""), InternalEvent.builder(context).message(message).build(), new IllegalAccessException());
when(mockError.getCause()).thenReturn(me);
assertTrue((Boolean) evaluate("exception.causedBy(java.lang.IllegalAccessException)", event));
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class MessagePropertiesTestCase method inboundKeySet.
@Test
public void inboundKeySet() throws Exception {
Message message = event.getMessage();
mock(DataHandler.class);
event = CoreEvent.builder(event).message(InternalMessage.builder(message).addInboundProperty("foo", "abc").addInboundProperty("bar", "xyz").build()).build();
assertThat((Iterable<String>) evaluate("message.inboundProperties.keySet()", event), hasItems("foo", "bar"));
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method localVariable.
@Test
public void localVariable() throws Exception {
Message message = of("");
CoreEvent event = InternalEvent.builder(context).message(message).build();
assertEquals("bar", evaluate("localVar='bar';localVar", event));
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method variableFromSessionScope.
@Test
public void variableFromSessionScope() throws Exception {
Message message = of("");
PrivilegedEvent event = (PrivilegedEvent) InternalEvent.builder(context).message(message).build();
event.getSession().setProperty("foo", "bar");
assertEquals(event.getSession().getProperty("foo"), evaluate("foo", event));
}
use of org.mule.runtime.api.message.Message in project mule by mulesoft.
the class VariablesTestCase method updateVariableFromFlowScope.
@Test
public void updateVariableFromFlowScope() throws Exception {
Message message = of("");
CoreEvent event = InternalEvent.builder(context).message(message).addVariable("foo", "bar").build();
assertEquals("bar_new", evaluate("foo='bar_new'", event));
}
Aggregations