Search in sources :

Example 6 with PipelineMessageNotification

use of org.mule.runtime.api.notification.PipelineMessageNotification in project mule by mulesoft.

the class MessageProcessingFlowTraceManagerTestCase method joinStack.

@Test
public void joinStack() {
    CoreEvent event = buildEvent("joinStack");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, createMockProcessor("/scatter-gather", false)));
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName() + "(/scatter-gather @ " + APP_ID + ":unknown:-1)"));
    CoreEvent eventCopy0 = buildEvent("joinStack_0", event.getFlowCallStack().clone());
    CoreEvent eventCopy1 = buildEvent("joinStack_1", event.getFlowCallStack().clone());
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy0, createMockProcessor("/route_0", false)));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy1, createMockProcessor(NESTED_FLOW_NAME + "_ref", false)));
    PipelineMessageNotification pipelineNotificationNested = buildPipelineNotification(eventCopy1, NESTED_FLOW_NAME);
    manager.onPipelineNotificationStart(pipelineNotificationNested);
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy1, createMockProcessor("/route_1", false)));
    assertThat(getContextInfo(eventCopy1, rootFlowConstruct), is("at " + NESTED_FLOW_NAME + "(/route_1 @ " + APP_ID + ":unknown:-1)" + lineSeparator() + "at " + ROOT_FLOW_NAME + "(" + NESTED_FLOW_NAME + "_ref @ " + APP_ID + ":unknown:-1)"));
    manager.onPipelineNotificationComplete(pipelineNotificationNested);
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName() + "(/scatter-gather @ " + APP_ID + ":unknown:-1)"));
    manager.onPipelineNotificationComplete(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 7 with PipelineMessageNotification

use of org.mule.runtime.api.notification.PipelineMessageNotification in project mule by mulesoft.

the class MessageProcessingFlowTraceManagerTestCase method nestedFlowInvocations.

@Test
public void nestedFlowInvocations() {
    CoreEvent event = buildEvent("nestedFlowInvocations");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification);
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, createMockProcessor(NESTED_FLOW_NAME + "_ref", false)));
    PipelineMessageNotification pipelineNotificationNested = buildPipelineNotification(event, NESTED_FLOW_NAME);
    manager.onPipelineNotificationStart(pipelineNotificationNested);
    String rootEntry = "at " + rootFlowConstruct.getName() + "(" + NESTED_FLOW_NAME + "_ref @ " + APP_ID + ":unknown:-1)";
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + NESTED_FLOW_NAME + lineSeparator() + rootEntry));
    manager.onPipelineNotificationComplete(pipelineNotificationNested);
    assertThat(getContextInfo(event, rootFlowConstruct), is(rootEntry));
    manager.onPipelineNotificationComplete(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 8 with PipelineMessageNotification

use of org.mule.runtime.api.notification.PipelineMessageNotification in project mule by mulesoft.

the class MessageProcessingFlowTraceManagerTestCase method splitStack.

@Test
public void splitStack() {
    CoreEvent event = buildEvent("newAnnotatedComponentCall");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, createMockProcessor("/comp", false)));
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName() + "(/comp @ " + APP_ID + ":unknown:-1)"));
    CoreEvent eventCopy = buildEvent("newAnnotatedComponentCall", event.getFlowCallStack().clone());
    assertThat(getContextInfo(eventCopy, rootFlowConstruct), is("at " + rootFlowConstruct.getName() + "(/comp @ " + APP_ID + ":unknown:-1)"));
    manager.onPipelineNotificationComplete(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
    final FlowConstruct asyncFlowConstruct = mock(FlowConstruct.class);
    when(asyncFlowConstruct.getName()).thenReturn("asyncFlow");
    manager.onPipelineNotificationStart(buildPipelineNotification(eventCopy, asyncFlowConstruct.getName()));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy, createMockProcessor("/asyncComp", false)));
    assertThat(getContextInfo(eventCopy, asyncFlowConstruct), is("at " + asyncFlowConstruct.getName() + "(/asyncComp @ " + APP_ID + ":unknown:-1)" + lineSeparator() + "at " + rootFlowConstruct.getName() + "(/comp @ " + APP_ID + ":unknown:-1)"));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) FlowConstruct(org.mule.runtime.core.api.construct.FlowConstruct) PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 9 with PipelineMessageNotification

use of org.mule.runtime.api.notification.PipelineMessageNotification in project mule by mulesoft.

the class MessageProcessingFlowTraceManagerTestCase method joinStackEnd.

@Test
public void joinStackEnd() {
    CoreEvent event = buildEvent("joinStack");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    manager.onPipelineNotificationStart(pipelineNotification);
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, createMockProcessor("/scatter-gather", false)));
    FlowCallStack flowCallStack = event.getFlowCallStack();
    CoreEvent eventCopy0 = buildEvent("joinStack_0", flowCallStack.clone());
    CoreEvent eventCopy1 = buildEvent("joinStack_1", flowCallStack.clone());
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy0, createMockProcessor("/route_0", false)));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy1, createMockProcessor(NESTED_FLOW_NAME + "_ref", false)));
    PipelineMessageNotification pipelineNotificationNested = buildPipelineNotification(eventCopy1, NESTED_FLOW_NAME);
    manager.onPipelineNotificationStart(pipelineNotificationNested);
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy1, createMockProcessor("/route_1", false)));
    manager.onPipelineNotificationComplete(pipelineNotificationNested);
    manager.onPipelineNotificationComplete(pipelineNotification);
    assertThat(((BaseEventContext) event.getContext()).getProcessorsTrace(), hasExecutedProcessors("/scatter-gather @ " + APP_ID + ":unknown:-1", "/route_0 @ " + APP_ID + ":unknown:-1", NESTED_FLOW_NAME + "_ref @ " + APP_ID + ":unknown:-1", "/route_1 @ " + APP_ID + ":unknown:-1"));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) FlowCallStack(org.mule.runtime.core.api.context.notification.FlowCallStack) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 10 with PipelineMessageNotification

use of org.mule.runtime.api.notification.PipelineMessageNotification in project mule by mulesoft.

the class MessageProcessingFlowTraceManagerTestCase method splitStackEnd.

@Test
public void splitStackEnd() {
    CoreEvent event = buildEvent("newAnnotatedComponentCall");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    manager.onPipelineNotificationStart(pipelineNotification);
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, createMockProcessor("/comp", false)));
    FlowCallStack flowCallStack = event.getFlowCallStack();
    CoreEvent eventCopy = buildEvent("newAnnotatedComponentCall", flowCallStack.clone());
    manager.onPipelineNotificationComplete(pipelineNotification);
    String asyncFlowName = "asyncFlow";
    manager.onPipelineNotificationStart(buildPipelineNotification(eventCopy, asyncFlowName));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(eventCopy, createMockProcessor("/asyncComp", false)));
    assertThat(((BaseEventContext) event.getContext()).getProcessorsTrace(), hasExecutedProcessors("/comp @ " + APP_ID + ":unknown:-1", "/asyncComp @ " + APP_ID + ":unknown:-1"));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) FlowCallStack(org.mule.runtime.core.api.context.notification.FlowCallStack) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Aggregations

PipelineMessageNotification (org.mule.runtime.api.notification.PipelineMessageNotification)10 Test (org.junit.Test)9 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)9 SmallTest (org.mule.tck.size.SmallTest)9 Component (org.mule.runtime.api.component.Component)2 FlowCallStack (org.mule.runtime.core.api.context.notification.FlowCallStack)2 FlowConstruct (org.mule.runtime.core.api.construct.FlowConstruct)1 Pipeline (org.mule.runtime.core.api.construct.Pipeline)1 Processor (org.mule.runtime.core.api.processor.Processor)1