public class FlowableCmmnRule extends Object implements org.junit.rules.TestRule
Usage:
public class YourTest {
@Rule
public FlowableCmmnRule flowableRule = new FlowableCmmnRule();
...
}
The CmmnEngine and the services will be made available to the test class through the getters of the FlowableCmmnRule. The cmmnEngine will be initialized by default with the flowable.cfg.xml
resource on the classpath. To specify a different configuration file, pass the resource location in the appropriate constructor. Cmmn engines will be cached
statically. Right before the first time the setUp is called for a given configuration resource, the cmmn engine will be constructed.
You can declare a deployment with the CmmnDeployment annotation. This base class will make sure that this deployment gets deployed before the setUp and
cascade deleted after the tearDown.
The FlowableRule also lets you set the current time used by the process engine. This can be handy to control the exact time that is used by the engine in
order to verify e.g. e.g. due dates of timers. Or start, end and duration times in the history service. In the tearDown, the internal clock will automatically be reset to use the current system
time rather then the time that was set during a test method.
| Modifier and Type | Field and Description |
|---|---|
protected CmmnEngine |
cmmnEngine |
protected CmmnEngineConfiguration |
cmmnEngineConfiguration |
protected CmmnHistoryService |
cmmnHistoryService |
protected CmmnManagementService |
cmmnManagementService |
protected CmmnRepositoryService |
cmmnRepositoryService |
protected CmmnRuntimeService |
cmmnRuntimeService |
protected CmmnTaskService |
cmmnTaskService |
protected String |
configurationResource |
protected String |
deploymentId |
| Constructor and Description |
|---|
FlowableCmmnRule() |
FlowableCmmnRule(CmmnEngine cmmnEngine) |
FlowableCmmnRule(String configurationResource) |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
Implementation based on
TestWatcher. |
protected void |
configureProcessEngine() |
protected void |
failed(Throwable e,
org.junit.runner.Description description)
Invoked when a test fails
|
protected void |
finished(org.junit.runner.Description description) |
CmmnEngine |
getCmmnEngine() |
CmmnEngineConfiguration |
getCmmnEngineConfiguration() |
CmmnHistoryService |
getCmmnHistoryService() |
CmmnManagementService |
getCmmnManagementService() |
CmmnRepositoryService |
getCmmnRepositoryService() |
CmmnRuntimeService |
getCmmnRuntimeService() |
String |
getConfigurationResource() |
protected void |
initializeCmmnEngine() |
protected void |
initializeServices() |
void |
setCmmnEngine(CmmnEngine cmmnEngine) |
void |
setConfigurationResource(String configurationResource) |
void |
setCurrentTime(Date currentTime) |
protected void |
skipped(org.junit.internal.AssumptionViolatedException e,
org.junit.runner.Description description)
Invoked when a test is skipped due to a failed assumption.
|
protected void |
starting(org.junit.runner.Description description) |
protected void |
succeeded(org.junit.runner.Description description)
Invoked when a test succeeds
|
protected String configurationResource
protected String deploymentId
protected CmmnEngineConfiguration cmmnEngineConfiguration
protected CmmnEngine cmmnEngine
protected CmmnRepositoryService cmmnRepositoryService
protected CmmnRuntimeService cmmnRuntimeService
protected CmmnTaskService cmmnTaskService
protected CmmnHistoryService cmmnHistoryService
protected CmmnManagementService cmmnManagementService
public FlowableCmmnRule()
public FlowableCmmnRule(String configurationResource)
public FlowableCmmnRule(CmmnEngine cmmnEngine)
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
TestWatcher.apply in interface org.junit.rules.TestRuleprotected void succeeded(org.junit.runner.Description description)
protected void failed(Throwable e, org.junit.runner.Description description)
protected void skipped(org.junit.internal.AssumptionViolatedException e,
org.junit.runner.Description description)
protected void starting(org.junit.runner.Description description)
protected void initializeCmmnEngine()
protected void initializeServices()
protected void configureProcessEngine()
protected void finished(org.junit.runner.Description description)
public void setCurrentTime(Date currentTime)
public String getConfigurationResource()
public void setConfigurationResource(String configurationResource)
public CmmnEngine getCmmnEngine()
public void setCmmnEngine(CmmnEngine cmmnEngine)
public CmmnEngineConfiguration getCmmnEngineConfiguration()
public CmmnRepositoryService getCmmnRepositoryService()
public CmmnRuntimeService getCmmnRuntimeService()
public CmmnHistoryService getCmmnHistoryService()
public CmmnManagementService getCmmnManagementService()
Copyright © 2019 Flowable. All rights reserved.