use of org.mule.runtime.core.api.event.CoreEvent 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(""));
}
use of org.mule.runtime.core.api.event.CoreEvent 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(""));
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class ExpressionLanguageEnrichmentTestCase method enrichFlowVariable.
@Test
public void enrichFlowVariable() throws Exception {
CoreEvent event = eventBuilder(muleContext).message(of("")).build();
CoreEvent.Builder eventBuilder = CoreEvent.builder(event);
expressionLanguage.enrich("flowVars['foo']", event, eventBuilder, ((Component) flowConstruct).getLocation(), "bar");
assertThat(eventBuilder.build().getVariables().get("foo").getValue(), is("bar"));
assertThat(((PrivilegedEvent) eventBuilder.build()).getSession().getProperty("foo"), nullValue());
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class ExpressionLanguageEnrichmentTestCase method enrichMessageProperty.
@Test
public void enrichMessageProperty() throws Exception {
CoreEvent event = CoreEvent.builder(context).message(of("foo")).build();
CoreEvent.Builder eventBuilder = CoreEvent.builder(event);
expressionLanguage.enrich("message.outboundProperties.foo", event, eventBuilder, ((Component) flowConstruct).getLocation(), "bar");
assertThat(((InternalMessage) eventBuilder.build().getMessage()).getOutboundProperty("foo"), is("bar"));
}
use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.
the class ExpressionLanguageEnrichmentTestCase method enrichWithDolarPlaceholder.
@Test
public void enrichWithDolarPlaceholder() throws Exception {
CoreEvent event = CoreEvent.builder(context).message(of("")).build();
CoreEvent.Builder eventBuilder = CoreEvent.builder(event);
expressionLanguage.enrich("message.outboundProperties.put('foo', $)", event, eventBuilder, ((Component) flowConstruct).getLocation(), "bar");
assertThat(((InternalMessage) eventBuilder.build().getMessage()).getOutboundProperty("foo"), is("bar"));
}
Aggregations