Search in sources :

Example 21 with Flow

use of org.mule.runtime.core.api.construct.Flow in project mule by mulesoft.

the class ParameterInjectionSourceTestCase method injectMapParameters.

@Test
public void injectMapParameters() throws Exception {
    Flow flow = (Flow) getFlowConstruct("source");
    flow.start();
    probe(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> HeisenbergSource.receivedDebtProperties != null && HeisenbergSource.receivedDebtProperties.containsKey("maxDebt") && HeisenbergSource.receivedUsableWeapons != null && HeisenbergSource.receivedUsableWeapons.containsKey("Ricin"));
}
Also used : Flow(org.mule.runtime.core.api.construct.Flow) Test(org.junit.Test)

Example 22 with Flow

use of org.mule.runtime.core.api.construct.Flow in project mule by mulesoft.

the class FunctionalTestCase method stopFlowConstruct.

protected void stopFlowConstruct(String flowName) throws Exception {
    FlowConstruct flowConstruct = getFlowConstruct(flowName);
    Flow flow = (Flow) flowConstruct;
    flow.stop();
}
Also used : FlowConstruct(org.mule.runtime.core.api.construct.FlowConstruct) Flow(org.mule.runtime.core.api.construct.Flow)

Example 23 with Flow

use of org.mule.runtime.core.api.construct.Flow in project mule by mulesoft.

the class FlowRunner method dispatch.

/**
 * Dispatches to the specified flow with the provided event and configuration, and performs a {@link FlowAssert#verify(String))}
 * afterwards.
 * <p>
 * If this is called multiple times, the <b>same</b> event will be sent. To force the creation of a new event, use
 * {@link #reset()}.
 * <p>
 * Dispatch behaves differently to {@link FlowRunner#run()} in that it does not propagate any exceptions to the test case or
 * return a result.
 */
public void dispatch() throws Exception {
    Flow flow = (Flow) getFlowConstruct();
    try {
        txExecutionTemplate.execute(getFlowDispatchCallback(flow));
    } catch (Exception e) {
    // Ignore
    }
    FlowAssert.verify(flowName);
}
Also used : EventProcessingException(org.mule.runtime.core.privileged.exception.EventProcessingException) ExecutionException(java.util.concurrent.ExecutionException) Flow(org.mule.runtime.core.api.construct.Flow)

Example 24 with Flow

use of org.mule.runtime.core.api.construct.Flow in project mule by mulesoft.

the class FlowRunner method dispatchAsync.

/**
 * Dispatches to the specified flow with the provided event and configuration in a new IO thread, and performs a
 * {@link FlowAssert#verify(String))} afterwards.
 * <p>
 * If this is called multiple times, the <b>same</b> event will be sent. To force the creation of a new event, use
 * {@link #reset()}.
 * <p>
 * Dispatch behaves differently to {@link FlowRunner#run()} in that it does not propagate any exceptions to the test case or
 * return a result.
 */
public void dispatchAsync(Scheduler scheduler) throws Exception {
    this.scheduler = scheduler;
    Flow flow = (Flow) getFlowConstruct();
    try {
        scheduler.submit(() -> txExecutionTemplate.execute(getFlowDispatchCallback(flow)));
    } catch (Exception e) {
    // Ignore
    }
    FlowAssert.verify(flowName);
}
Also used : EventProcessingException(org.mule.runtime.core.privileged.exception.EventProcessingException) ExecutionException(java.util.concurrent.ExecutionException) Flow(org.mule.runtime.core.api.construct.Flow)

Example 25 with Flow

use of org.mule.runtime.core.api.construct.Flow in project mule by mulesoft.

the class TypedValueParameterOperationExecutionTestCase method typedValueForStringOnSourceOnSuccess.

@Test
public void typedValueForStringOnSourceOnSuccess() throws Exception {
    Flow flow = (Flow) getFlowConstruct("typedValueForStringOnSourceOnSuccess");
    flow.start();
    new PollingProber(100000, 100).check(new JUnitLambdaProbe(() -> TypedValueSource.onSuccessValue != null));
    assertTypedValue(TypedValueSource.onSuccessValue, STRING_VALUE, WILDCARD, null);
}
Also used : JUnitLambdaProbe(org.mule.tck.probe.JUnitLambdaProbe) PollingProber(org.mule.tck.probe.PollingProber) Flow(org.mule.runtime.core.api.construct.Flow) Test(org.junit.Test)

Aggregations

Flow (org.mule.runtime.core.api.construct.Flow)37 Test (org.junit.Test)25 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)19 Message (org.mule.runtime.api.message.Message)14 MuleException (org.mule.runtime.api.exception.MuleException)10 Processor (org.mule.runtime.core.api.processor.Processor)10 EventContext (org.mule.runtime.api.event.EventContext)9 ArrayList (java.util.ArrayList)8 Arrays.asList (java.util.Arrays.asList)8 List (java.util.List)8 AtomicReference (java.util.concurrent.atomic.AtomicReference)8 Collectors.toList (java.util.stream.Collectors.toList)8 Assert.assertThat (org.junit.Assert.assertThat)8 Thread.currentThread (java.lang.Thread.currentThread)7 Collection (java.util.Collection)7 After (org.junit.After)7 Before (org.junit.Before)7 Rule (org.junit.Rule)7 ExpectedException (org.junit.rules.ExpectedException)7 RunWith (org.junit.runner.RunWith)7