public class IkasanStandaloneFlowTestRule extends Object implements org.junit.rules.TestRule
The rule will take care of starting up spring context bases on IkasanApplicationFactory and Application class provided in constructor.
The underlying Flow will be automatically stopped and checked when the rule is evaluated at the end of the test
| Constructor and Description |
|---|
IkasanStandaloneFlowTestRule(String flowUnderTest,
Class<?> applicationClass) |
IkasanStandaloneFlowTestRule(String flowUnderTest,
Class<?> applicationClass,
String[] args) |
IkasanStandaloneFlowTestRule(String flowUnderTest,
IkasanApplication ikasanApplication) |
| 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 |
assertFlowComponentExecution() |
IkasanStandaloneFlowTestRule |
blockEnd()
Close the current block of repeated components
|
IkasanStandaloneFlowTestRule |
blockStart()
Start a block of repeated components
|
IkasanStandaloneFlowTestRule |
broker(String name)
Expect a broker
|
IkasanStandaloneFlowTestRule |
consumer(String name)
Expect a consumer
|
IkasanStandaloneFlowTestRule |
converter(String name)
Expect a converter
|
IkasanStandaloneFlowTestRule |
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.
|
IkasanApplication |
getIkasanApplication() |
IkasanStandaloneFlowTestRule |
multiRecipientRouter(String name)
Expect a MultiRecipientRouter
|
IkasanStandaloneFlowTestRule |
producer(String name)
Expect a producer
|
IkasanStandaloneFlowTestRule |
repeat(int n)
Repeat the current block n times;
|
IkasanStandaloneFlowTestRule |
router(String name)
Expect a SingleRecipientRouter
|
IkasanStandaloneFlowTestRule |
scheduledConsumer(String name)
Expect a consumer
|
IkasanStandaloneFlowTestRule |
sequencer(String name)
Expect a sequencer
|
void |
sleep(long time)
Sleep for a bit to let a flow execution complete
|
IkasanStandaloneFlowTestRule |
splitter(String name)
Expect a splitter
|
void |
startFlow()
Setup the flow expectations, make sure that testHarness listener is attached to flow and start the given flow.
|
IkasanStandaloneFlowTestRule |
translator(String name)
Expect a translator
|
IkasanStandaloneFlowTestRule |
withErrorEndState()
Indicate the flow end state will be 'stoppedInError', used in negative testing
|
IkasanStandaloneFlowTestRule |
withFlow(Flow flow)
Set the flow which this Rule will check
|
public IkasanStandaloneFlowTestRule(String flowUnderTest, Class<?> applicationClass)
public IkasanStandaloneFlowTestRule(String flowUnderTest, Class<?> applicationClass, String[] args)
public IkasanStandaloneFlowTestRule(String flowUnderTest, IkasanApplication ikasanApplication)
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 void assertFlowComponentExecution()
public IkasanStandaloneFlowTestRule withFlow(Flow flow)
flow - the Flowpublic IkasanStandaloneFlowTestRule withErrorEndState()
public IkasanStandaloneFlowTestRule consumer(String name)
name - the consumer namepublic IkasanStandaloneFlowTestRule scheduledConsumer(String name)
name - the consumer namepublic IkasanStandaloneFlowTestRule splitter(String name)
name - the splitter namepublic IkasanStandaloneFlowTestRule converter(String name)
name - the converter namepublic IkasanStandaloneFlowTestRule producer(String name)
name - the producer namepublic IkasanStandaloneFlowTestRule router(String name)
name - the router namepublic IkasanStandaloneFlowTestRule multiRecipientRouter(String name)
name - the MRR namepublic IkasanStandaloneFlowTestRule translator(String name)
name - the translator namepublic IkasanStandaloneFlowTestRule broker(String name)
name - the broker namepublic IkasanStandaloneFlowTestRule filter(String name)
name - the filter namepublic IkasanStandaloneFlowTestRule sequencer(String name)
name - the sequencer namepublic IkasanStandaloneFlowTestRule blockStart()
public IkasanStandaloneFlowTestRule blockEnd()
public IkasanStandaloneFlowTestRule 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()
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 forpublic IkasanApplication getIkasanApplication()
Copyright © 2007-2020 Ikasan. All Rights Reserved.