Search in sources :

Example 6 with DefaultInterceptionEvent

use of org.mule.runtime.core.internal.interception.DefaultInterceptionEvent in project mule by mulesoft.

the class DefaultInterceptionEventTestCase method addSession.

@Test
public void addSession() throws MuleException {
    final InternalEvent event = this.<InternalEvent.Builder>getEventBuilder().message(of(TEST_PAYLOAD)).build();
    final DefaultInterceptionEvent interceptionEvent = new DefaultInterceptionEvent(event);
    final MuleSession session = mock(MuleSession.class);
    interceptionEvent.session(session);
    assertThat(((PrivilegedEvent) interceptionEvent.resolve()).getSession(), sameInstance(session));
}
Also used : DefaultInterceptionEvent(org.mule.runtime.core.internal.interception.DefaultInterceptionEvent) MuleSession(org.mule.runtime.core.privileged.event.MuleSession) InternalEvent(org.mule.runtime.core.internal.message.InternalEvent) Test(org.junit.Test)

Example 7 with DefaultInterceptionEvent

use of org.mule.runtime.core.internal.interception.DefaultInterceptionEvent in project mule by mulesoft.

the class DefaultInterceptionEventTestCase method changeSession.

@Test
public void changeSession() throws MuleException {
    final InternalEvent event = this.<InternalEvent.Builder>getEventBuilder().message(of(TEST_PAYLOAD)).session(mock(MuleSession.class)).build();
    final DefaultInterceptionEvent interceptionEvent = new DefaultInterceptionEvent(event);
    final MuleSession session = mock(MuleSession.class);
    interceptionEvent.session(session);
    assertThat(((PrivilegedEvent) interceptionEvent.resolve()).getSession(), sameInstance(session));
}
Also used : DefaultInterceptionEvent(org.mule.runtime.core.internal.interception.DefaultInterceptionEvent) MuleSession(org.mule.runtime.core.privileged.event.MuleSession) InternalEvent(org.mule.runtime.core.internal.message.InternalEvent) Test(org.junit.Test)

Aggregations

DefaultInterceptionEvent (org.mule.runtime.core.internal.interception.DefaultInterceptionEvent)7 InternalEvent (org.mule.runtime.core.internal.message.InternalEvent)7 Test (org.junit.Test)6 MuleSession (org.mule.runtime.core.privileged.event.MuleSession)3 Map (java.util.Map)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletionException (java.util.concurrent.CompletionException)1 Component (org.mule.runtime.api.component.Component)1 ComponentLocation (org.mule.runtime.api.component.location.ComponentLocation)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 InterceptionAction (org.mule.runtime.api.interception.InterceptionAction)1 InterceptionEvent (org.mule.runtime.api.interception.InterceptionEvent)1 ProcessorInterceptor (org.mule.runtime.api.interception.ProcessorInterceptor)1 ProcessorInterceptorFactory (org.mule.runtime.api.interception.ProcessorInterceptorFactory)1 FlowExceptionHandler (org.mule.runtime.core.api.exception.FlowExceptionHandler)1 Processor (org.mule.runtime.core.api.processor.Processor)1 ReactiveProcessor (org.mule.runtime.core.api.processor.ReactiveProcessor)1 ClassUtils.withContextClassLoader (org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader)1 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)1 PrivilegedMuleContext (org.mule.runtime.core.privileged.PrivilegedMuleContext)1