use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class ExpressionLanguageExtensionTestCase method testVariableAlias.
@Test
public void testVariableAlias() throws Exception {
CoreEvent event = CoreEvent.builder(context).message(of("foo")).build();
assertThat(evaluate("p", event), is("foo"));
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class ExpressionLanguageExtensionTestCase method testAssignValueToVariableAlias.
@Test
public void testAssignValueToVariableAlias() throws Exception {
CoreEvent event = CoreEvent.builder(context).message(of("")).build();
CoreEvent.Builder eventBuilder = CoreEvent.builder(event);
evaluate("p='bar'", event, eventBuilder);
assertThat(eventBuilder.build().getMessage().getPayload().getValue(), is("bar"));
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class ExpressionLanguageExtensionTestCase method testMuleMessageAvailableAsVariable.
@Test
public void testMuleMessageAvailableAsVariable() throws Exception {
CoreEvent event = CoreEvent.builder(context).message(of("")).build();
evaluate("p=m.uniqueId", event);
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class MVELMapHandlingTestCase method nullKeyWhichGetsValueLater.
@Test
public void nullKeyWhichGetsValueLater() throws Exception {
Map<String, String> payload = new HashMap<>();
CoreEvent event = eventBuilder(muleContext).message(of(payload)).build();
assertMapKey(event, KEY, null);
payload.put(KEY, VALUE);
assertMapKey(event, KEY, VALUE);
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class MVELMapHandlingTestCase method keyWithNullableValue.
@Test
public void keyWithNullableValue() throws Exception {
Map<String, String> payload = new HashMap<>();
payload.put(KEY, VALUE);
CoreEvent event = eventBuilder(muleContext).message(of(payload)).build();
assertMapKey(event, KEY, VALUE);
payload.remove(KEY);
assertMapKey(event, KEY, null);
}
Aggregations