Search in sources :

Example 26 with CoreEvent

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"));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 27 with CoreEvent

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"));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 28 with CoreEvent

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);
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 29 with CoreEvent

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);
}
Also used : HashMap(java.util.HashMap) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 30 with CoreEvent

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);
}
Also used : HashMap(java.util.HashMap) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Aggregations

CoreEvent (org.mule.runtime.core.api.event.CoreEvent)485 Test (org.junit.Test)394 Message (org.mule.runtime.api.message.Message)103 SmallTest (org.mule.tck.size.SmallTest)100 TypedValue (org.mule.runtime.api.metadata.TypedValue)44 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)39 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)38 Description (io.qameta.allure.Description)37 InternalMessage (org.mule.runtime.core.internal.message.InternalMessage)37 List (java.util.List)36 MuleException (org.mule.runtime.api.exception.MuleException)33 Processor (org.mule.runtime.core.api.processor.Processor)33 DataType (org.mule.runtime.api.metadata.DataType)28 InternalEvent (org.mule.runtime.core.internal.message.InternalEvent)28 ComponentLocation (org.mule.runtime.api.component.location.ComponentLocation)27 ArrayList (java.util.ArrayList)26 Map (java.util.Map)26 Optional (java.util.Optional)25 PrivilegedEvent (org.mule.runtime.core.privileged.event.PrivilegedEvent)23 InOrder (org.mockito.InOrder)22