Search in sources :

Example 16 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.

the class ExtendedExpressionLanguageAdapterTestCase method enrichObjectCompatibility.

@Test
@Description("Verifies that enrichment using an Object only works for MVEL.")
public void enrichObjectCompatibility() throws MuleException {
    CoreEvent event = testEvent();
    CoreEvent.Builder builder = builder(event);
    String myPayload = "myPayload";
    String expression = "payload";
    expressionLanguageAdapter.enrich(melify(expression), event, builder, TEST_CONNECTOR_LOCATION, myPayload);
    assertThat(builder.build().getMessage().getPayload().getValue(), is(myPayload));
    expectedException.expect(UnsupportedOperationException.class);
    expressionLanguageAdapter.enrich(expression, event, builder, TEST_CONNECTOR_LOCATION, myPayload);
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Description(io.qameta.allure.Description) Test(org.junit.Test)

Example 17 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.

the class DefaultFlowTestCase method testProcessRequestResponseEndpoint.

@Test
public void testProcessRequestResponseEndpoint() throws Exception {
    flow.initialise();
    flow.start();
    CoreEvent response = triggerFunction.apply(directInboundMessageSource.getListener(), testEvent());
    assertSucessfulProcessing((PrivilegedEvent) response);
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Test(org.junit.Test)

Example 18 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent in project mule by mulesoft.

the class DefaultFlowTestCase method restartWithBlockingProcessingStrategy.

@Test
public void restartWithBlockingProcessingStrategy() throws Exception {
    after();
    flow = (DefaultFlow) Flow.builder(FLOW_NAME, muleContext).source(flow.getSource()).processors(flow.getProcessors()).processingStrategyFactory(new BlockingProcessingStrategyFactory()).build();
    flow.initialise();
    flow.start();
    flow.stop();
    flow.start();
    CoreEvent response = triggerFunction.apply(directInboundMessageSource.getListener(), testEvent());
    assertThat(response, not(nullValue()));
}
Also used : CoreEvent(org.mule.runtime.core.api.event.CoreEvent) BlockingProcessingStrategyFactory(org.mule.runtime.core.internal.processor.strategy.BlockingProcessingStrategyFactory) Test(org.junit.Test)

Example 19 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent 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 20 with CoreEvent

use of org.mule.runtime.core.api.event.CoreEvent 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)

Aggregations

CoreEvent (org.mule.runtime.core.api.event.CoreEvent)485 Test (org.junit.Test)394 Message (org.mule.runtime.api.message.Message)103 SmallTest (org.mule.tck.size.SmallTest)100 TypedValue (org.mule.runtime.api.metadata.TypedValue)44 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)39 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)38 Description (io.qameta.allure.Description)37 InternalMessage (org.mule.runtime.core.internal.message.InternalMessage)37 List (java.util.List)36 MuleException (org.mule.runtime.api.exception.MuleException)33 Processor (org.mule.runtime.core.api.processor.Processor)33 DataType (org.mule.runtime.api.metadata.DataType)28 InternalEvent (org.mule.runtime.core.internal.message.InternalEvent)28 ComponentLocation (org.mule.runtime.api.component.location.ComponentLocation)27 ArrayList (java.util.ArrayList)26 Map (java.util.Map)26 Optional (java.util.Optional)25 PrivilegedEvent (org.mule.runtime.core.privileged.event.PrivilegedEvent)23 InOrder (org.mockito.InOrder)22