use of org.mule.runtime.core.privileged.event.DefaultMuleSession in project mule by mulesoft.
the class AbstractPolicyProcessorTestCase method sessionModifiedBeforeNextProcessorIsPropagatedToIt.
@Test
public void sessionModifiedBeforeNextProcessorIsPropagatedToIt() throws MuleException {
DefaultMuleSession session = new DefaultMuleSession();
CoreEvent modifiedSessionEvent = PrivilegedEvent.builder(initialEvent).session(session).build();
when(flowProcessor.apply(any())).thenReturn(just(modifiedSessionEvent));
when(policy.getPolicyChain().apply(any())).thenAnswer(invocation -> just(modifiedSessionEvent).transform(policyStateHandler.retrieveNextOperation(executionId)));
just(initialEvent).transform(policyProcessor).block();
verify(flowProcessor).apply(eventCaptor.capture());
assertEquals(((PrivilegedEvent) from(eventCaptor.getValue()).block()).getSession(), session);
}
Aggregations