public class IkasanFlowTestRule extends Object implements org.junit.rules.TestRule
The underlying Flow will be automatically stopped and checked when the rule is evaluated at the end of the test
| Constructor and Description |
|---|
IkasanFlowTestRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
Applies the basic flow test rules:
1.
|
void |
assertIsSatisfied() |
IkasanFlowTestRule |
blockEnd()
Close the current block of repeated components
|
IkasanFlowTestRule |
blockStart()
Start a block of repeated components
|
IkasanFlowTestRule |
broker(String name)
Expect a broker
|
IkasanFlowTestRule |
consumer(String name)
Expect a consumer
|
IkasanFlowTestRule |
converter(String name)
Expect a converter
|
IkasanFlowTestRule |
filter(String name)
Expect a filter
|
void |
fireScheduledConsumer()
Invoke the scheduled consumer via its triggerSchedulerNow method
|
void |
fireScheduledConsumerSynchronously(org.quartz.JobExecutionContext jobExecutionContext)
Invoke the scheduled consumer with a given JobExecutionContext (can be mocked).
|
Object |
getComponent(String componentName)
Gets component of given name from this flow.
|
<T> T |
getComponentConfig(String componentName,
Class<T> classType)
Gets configuration of component with given name from this flow.
|
String |
getFlowState() |
IkasanFlowTestRule |
multiRecipientRouter(String name)
Expect a MultiRecipientRouter
|
void |
pauseFlow()
Pause a running flow.
|
IkasanFlowTestRule |
producer(String name)
Expect a producer
|
IkasanFlowTestRule |
repeat(int n)
Repeat the current block n times;
|
void |
resumeFlow()
Resume a paused flow.
|
IkasanFlowTestRule |
router(String name)
Expect a SingleRecipientRouter
|
IkasanFlowTestRule |
scheduledConsumer(String name)
Expect a consumer
|
IkasanFlowTestRule |
sequencer(String name)
Expect a sequencer
|
void |
sleep(long time)
Sleep for a bit to let a flow execution complete
|
IkasanFlowTestRule |
splitter(String name)
Expect a splitter
|
void |
startFlow()
Setup the flow expectations and start the given flow.
|
void |
startFlow(FlowSubject testHarnessFlowEventListener)
Setup the flow expectations and start the given flow.
|
void |
startPauseFlow()
Setup the flow expectations and start and pause the given flow.
|
void |
stopFlow() |
IkasanFlowTestRule |
translator(String name)
Expect a translator
|
IkasanFlowTestRule |
withErrorEndState()
Indicate the flow end state will be 'stoppedInError', used in negative testing
|
IkasanFlowTestRule |
withFlow(Flow flow)
Set the flow which this Rule will check
|
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulebase - a base Statementdescription - a Description (not used)public IkasanFlowTestRule withFlow(Flow flow)
flow - the Flowpublic IkasanFlowTestRule withErrorEndState()
public IkasanFlowTestRule consumer(String name)
name - the consumer namepublic IkasanFlowTestRule scheduledConsumer(String name)
name - the consumer namepublic IkasanFlowTestRule splitter(String name)
name - the splitter namepublic IkasanFlowTestRule converter(String name)
name - the converter namepublic IkasanFlowTestRule producer(String name)
name - the producer namepublic IkasanFlowTestRule router(String name)
name - the router namepublic IkasanFlowTestRule multiRecipientRouter(String name)
name - the MRR namepublic IkasanFlowTestRule translator(String name)
name - the translator namepublic IkasanFlowTestRule broker(String name)
name - the broker namepublic IkasanFlowTestRule filter(String name)
name - the filter namepublic IkasanFlowTestRule sequencer(String name)
name - the sequencer namepublic IkasanFlowTestRule blockStart()
public IkasanFlowTestRule blockEnd()
public IkasanFlowTestRule repeat(int n)
n - number of times to repeat the blockpublic void fireScheduledConsumer()
This method executes the underlying Job asynchronously
public void fireScheduledConsumerSynchronously(org.quartz.JobExecutionContext jobExecutionContext)
jobExecutionContext - a JobExecutionContextpublic void startFlow(FlowSubject testHarnessFlowEventListener)
testHarnessFlowEventListener - the test harness flow listenerpublic void startFlow()
public void startPauseFlow()
public void resumeFlow()
public void pauseFlow()
public void stopFlow()
public void assertIsSatisfied()
public String getFlowState()
public Object getComponent(String componentName)
componentName - component name to be looked up in flowpublic <T> T getComponentConfig(String componentName, Class<T> classType)
componentName - component name to be looked up in flowclassType - class Type to configuration objectpublic void sleep(long time)
time - the number of milliseconds to sleep forCopyright © 2007-2020 Ikasan. All Rights Reserved.