Search in sources :

Example 36 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.

the class MessageContextTestCase method assignToMessage.

@Test
public void assignToMessage() throws Exception {
    CoreEvent event = CoreEvent.builder(context).message(Message.of("")).build();
    assertImmutableVariable("message='foo'", event);
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 37 with CoreEvent

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

Example 38 with CoreEvent

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

Example 39 with CoreEvent

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

Example 40 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent 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);
}
Also used : Message(org.mule.runtime.api.message.Message) 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