Search in sources :

Example 1 with PipelineMessageNotification

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

the class MessageProcessingFlowTraceManagerTestCase method buildPipelineNotification.

protected PipelineMessageNotification buildPipelineNotification(CoreEvent event, String name) {
    Pipeline flowConstruct = mock(Pipeline.class, withSettings().extraInterfaces(Component.class));
    when(flowConstruct.getName()).thenReturn(name);
    return new PipelineMessageNotification(createInfo(event, null, flowConstruct), flowConstruct.getName(), PROCESS_START);
}
Also used : PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) Component(org.mule.runtime.api.component.Component) Pipeline(org.mule.runtime.core.api.construct.Pipeline)

Example 2 with PipelineMessageNotification

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

the class MessageProcessingFlowTraceManagerTestCase method newComponentCall.

@Test
public void newComponentCall() {
    CoreEvent event = buildEvent("newComponentCall");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + ROOT_FLOW_NAME));
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, createMockProcessor("/comp", false)));
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + ROOT_FLOW_NAME + "(/comp @ " + 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 3 with PipelineMessageNotification

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

the class MessageProcessingFlowTraceManagerTestCase method newFlowInvocation.

@Test
public void newFlowInvocation() {
    CoreEvent event = buildEvent("newFlowInvocation");
    PipelineMessageNotification pipelineNotification = buildPipelineNotification(event, rootFlowConstruct.getName());
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    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 4 with PipelineMessageNotification

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

the class MessageProcessingFlowTraceManagerTestCase method newAnnotatedComponentCall.

@Test
public void newAnnotatedComponentCall() {
    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()));
    Component annotatedMessageProcessor = (Component) createMockProcessor("/comp", true);
    when(annotatedMessageProcessor.getAnnotation(docNameAttrName)).thenReturn("annotatedName");
    manager.onMessageProcessorNotificationPreInvoke(buildProcessorNotification(event, (Processor) annotatedMessageProcessor));
    assertThat(getContextInfo(event, rootFlowConstruct), is("at " + rootFlowConstruct.getName() + "(/comp @ " + APP_ID + ":muleApp.xml:10 (annotatedName))"));
    manager.onPipelineNotificationComplete(pipelineNotification);
    assertThat(getContextInfo(event, rootFlowConstruct), is(""));
}
Also used : Processor(org.mule.runtime.core.api.processor.Processor) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) Component(org.mule.runtime.api.component.Component) SmallTest(org.mule.tck.size.SmallTest) Test(org.junit.Test)

Example 5 with PipelineMessageNotification

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

the class MessageProcessingFlowTraceManagerTestCase method mixedEvents.

@Test
public void mixedEvents() {
    CoreEvent event1 = buildEvent("mixedEvents_1");
    CoreEvent event2 = buildEvent("mixedEvents_2");
    PipelineMessageNotification pipelineNotification1 = buildPipelineNotification(event1, rootFlowConstruct.getName());
    PipelineMessageNotification pipelineNotification2 = buildPipelineNotification(event2, rootFlowConstruct.getName());
    assertThat(getContextInfo(event1, rootFlowConstruct), is(""));
    assertThat(getContextInfo(event2, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification1);
    assertThat(getContextInfo(event1, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    assertThat(getContextInfo(event2, rootFlowConstruct), is(""));
    manager.onPipelineNotificationStart(pipelineNotification2);
    assertThat(getContextInfo(event1, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    assertThat(getContextInfo(event2, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    manager.onPipelineNotificationComplete(pipelineNotification1);
    assertThat(getContextInfo(event1, rootFlowConstruct), is(""));
    assertThat(getContextInfo(event2, rootFlowConstruct), is("at " + rootFlowConstruct.getName()));
    manager.onPipelineNotificationComplete(pipelineNotification2);
    assertThat(getContextInfo(event1, rootFlowConstruct), is(""));
    assertThat(getContextInfo(event2, 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)

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