public class FlowRunner extends FlowConstructRunner<FlowRunner>
This runner is not thread-safe.
eventBuilder, registry
PHASE_NAME
Constructor and Description |
---|
FlowRunner(Registry registry,
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(Scheduler scheduler)
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()
A lifecycle method where implementor should free up any resources.
|
String |
getFlowConstructName() |
FlowRunner |
keepStreamsOpen()
Makes all open
cursors to not be closed when the executed flow is finished but when the test is disposed |
CoreEvent |
run()
Runs the specified flow with the provided event and configuration, and performs a
FlowAssert#verify(String))
afterwards. |
CoreEvent |
runAndVerify(String... flowNamesToVerify)
Runs the specified flow with the provided event and configuration, and performs a
FlowAssert#verify(String)) for each
flowNamesToVerify afterwards. |
Exception |
runExpectingException()
Runs the specified flow with the provided event and configuration expecting a failure.
|
void |
runExpectingException(org.mule.tck.junit4.matcher.ErrorTypeMatcher matcher)
Runs the specified flow with the provided event and configuration expecting a failure with an error type that matches the
given
matcher . |
void |
runExpectingException(org.mule.tck.junit4.matcher.ErrorTypeMatcher matcher,
org.hamcrest.Matcher<CoreEvent> errorEventMatcher)
Runs the specified flow with the provided event and configuration expecting a failure with an
CoreEvent that matches
the given errorEventMatcher . |
void |
runExpectingException(org.mule.tck.junit4.matcher.EventMatcher errorEventMatcher)
Runs the specified flow with the provided event and configuration expecting a failure with an
CoreEvent that matches
the given errorEventMatcher . |
void |
runExpectingException(org.hamcrest.Matcher<Throwable> causeMatcher)
Runs the specified flow with the provided event and configuration expecting a failure with a cause that matches the given
matcher . |
void |
runExpectingException(org.hamcrest.Matcher<Throwable> causeMatcher,
org.hamcrest.Matcher<CoreEvent> errorEventMatcher)
Runs the specified flow with the provided event and configuration expecting a failure with an
CoreEvent that matches
the given errorEventMatcher . |
CoreEvent |
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(Scheduler scheduler)
|
buildEvent, getFlowConstruct, getOrBuildEvent, reset, spyObjects, withAttributes, withCorrelation, withInboundAttachment, withInboundProperties, withInboundProperty, withItemSequenceInfo, withMediaType, withOutboundProperty, withPayload, withSessionProperty, withSourceCorrelationId, withVariable, withVariable
public 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)
.FlowRunner
public FlowRunner keepStreamsOpen()
cursors
to not be closed when the executed flow is finished but when the test is disposedthis
FlowRunner
public FlowRunner withScheduler(Scheduler scheduler)
scheduler
- the scheduler to use to run the Flow
.FlowRunner
SchedulerService}
public CoreEvent 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()
.
MuleEvent
Exception
public CoreEvent 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()
.
MuleEvent
Exception
public CoreEvent 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.MuleEvent
Exception
public 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.
Exception
public void dispatchAsync(Scheduler scheduler) 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.
Exception
public Exception runExpectingException() throws Exception
Exception
public void runExpectingException(org.mule.tck.junit4.matcher.ErrorTypeMatcher matcher) throws Exception
matcher
.
Will fail if there's no failure running the flow.
Exception
public void runExpectingException(org.hamcrest.Matcher<Throwable> causeMatcher) throws Exception
matcher
.
Will fail if there's no failure running the flow.
Exception
public void runExpectingException(org.mule.tck.junit4.matcher.EventMatcher errorEventMatcher) throws Exception
CoreEvent
that matches
the given errorEventMatcher
.
Will fail if there's no failure running the flow.
Exception
public void runExpectingException(org.mule.tck.junit4.matcher.ErrorTypeMatcher matcher, org.hamcrest.Matcher<CoreEvent> errorEventMatcher) throws Exception
CoreEvent
that matches
the given errorEventMatcher
.
Will fail if there's no failure running the flow.
Exception
public void runExpectingException(org.hamcrest.Matcher<Throwable> causeMatcher, org.hamcrest.Matcher<CoreEvent> errorEventMatcher) throws Exception
CoreEvent
that matches
the given errorEventMatcher
.
Will fail if there's no failure running the flow.
Exception
public String getFlowConstructName()
getFlowConstructName
in class FlowConstructRunner<FlowRunner>
FlowConstruct
to use.public void dispose()
Disposable
dispose
in interface Disposable
dispose
in class FlowConstructRunner<FlowRunner>
Copyright © 2018. All rights reserved.