public class FlowRunner extends FlowConstructRunner<FlowRunner> implements org.mule.runtime.api.lifecycle.Disposable
This runner is not thread-safe.
eventBuilder, muleContext| Constructor and Description |
|---|
FlowRunner(MuleContext muleContext,
String flowName)
Initializes this flow runner.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispatch()
Dispatches to the specified flow with the provided event and configuration, and performs a
FlowAssert#verify(String))
afterwards. |
void |
dispatchAsync()
Dispatches to the specified flow with the provided event and configuration in a new IO thread, and performs a
FlowAssert#verify(String)) afterwards. |
void |
dispose() |
String |
getFlowConstructName() |
FlowRunner |
keepStreamsOpen()
Makes all open
cursors to not be closed when the executed flow is finished but when the test is disposed |
Event |
run()
Runs the specified flow with the provided event and configuration, and performs a
FlowAssert#verify(String))
afterwards. |
Event |
runAndVerify(String... flowNamesToVerify)
Runs the specified flow with the provided event and configuration, and performs a
FlowAssert#verify(String)) for each
flowNamesToVerify afterwards. |
MessagingException |
runExpectingException()
Runs the specified flow with the provided event and configuration expecting a failure.
|
Event |
runNoVerify()
Runs the specified flow with the provided event and configuration.
|
FlowRunner |
transactionally(TransactionConfigEnum action,
TransactionFactory factory)
Configures the flow to run inside a transaction.
|
FlowRunner |
withScheduler(org.mule.runtime.api.scheduler.Scheduler scheduler)
Run
Flow as a task of a given Scheduler. |
buildEvent, getFlowConstruct, getOrBuildEvent, reset, spyObjects, withAttributes, withCorrelation, withInboundAttachment, withInboundProperties, withInboundProperty, withMediaType, withOutboundProperty, withPayload, withSessionProperty, withSourceCorrelationId, withVariable, withVariablepublic FlowRunner(MuleContext muleContext, String flowName)
muleContext - the context of the mule applicationflowName - the name of the flow to run events throughpublic FlowRunner transactionally(TransactionConfigEnum action, TransactionFactory factory)
action - The action to do at the start of the transactional block. See TransactionConfig constants.factory - See MuleTransactionConfig.setFactory(TransactionFactory).FlowRunnerpublic FlowRunner keepStreamsOpen()
cursors to not be closed when the executed flow is finished but when the test is disposedthis FlowRunnerpublic FlowRunner withScheduler(org.mule.runtime.api.scheduler.Scheduler scheduler)
Flow as a task of a given Scheduler.scheduler - the scheduler to use to run the Flow.FlowRunnerorg.mule.runtime.core.api.scheduler.SchedulerService}public Event run() throws Exception
FlowAssert#verify(String))
afterwards.
If this is called multiple times, the same event will be sent. To force the creation of a new event, use
FlowConstructRunner.reset().
MuleEventExceptionpublic Event runNoVerify() throws Exception
If this is called multiple times, the same event will be sent. To force the creation of a new event, use
FlowConstructRunner.reset().
MuleEventExceptionpublic Event runAndVerify(String... flowNamesToVerify) throws Exception
FlowAssert#verify(String)) for each
flowNamesToVerify afterwards.
If this is called multiple times, the same event will be sent. To force the creation of a new event, use
FlowConstructRunner.reset().
flowNamesToVerify - the names of the flows to FlowAssert#verify(String)) afterwards.MuleEventExceptionpublic void dispatch()
throws Exception
FlowAssert#verify(String))
afterwards.
If this is called multiple times, the same event will be sent. To force the creation of a new event, use
FlowConstructRunner.reset().
Dispatch behaves differently to run() in that it does not propagate any exceptions to the test case or
return a result.
Exceptionpublic void dispatchAsync()
throws Exception
FlowAssert#verify(String)) afterwards.
If this is called multiple times, the same event will be sent. To force the creation of a new event, use
FlowConstructRunner.reset().
Dispatch behaves differently to run() in that it does not propagate any exceptions to the test case or
return a result.
Exceptionpublic MessagingException runExpectingException() throws Exception
Exceptionpublic String getFlowConstructName()
getFlowConstructName in class FlowConstructRunner<FlowRunner>FlowConstruct to use.public void dispose()
dispose in interface org.mule.runtime.api.lifecycle.DisposableCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.