public class FlowableAppRule extends Object implements org.junit.rules.TestRule
Usage:
public class YourTest { @Rule public FlowableAppRule flowableRule = new FlowableAppRule(); ... }
The AppEngine and the services will be made available to the test class through the getters of the FlowableAppRule. The appEngine 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
. App engines will be cached
statically. Right before the first time the setUp is called for a given configuration resource, the app engine will be constructed.
You can declare a deployment with the AppDeployment
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. 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 AppEngine |
appEngine |
protected AppEngineConfiguration |
appEngineConfiguration |
protected AppManagementService |
appManagementService |
protected AppRepositoryService |
appRepositoryService |
protected String |
configurationResource |
protected String |
deploymentId |
Constructor and Description |
---|
FlowableAppRule() |
FlowableAppRule(AppEngine appEngine) |
FlowableAppRule(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 |
configureAppEngine() |
protected void |
failed(Throwable e,
org.junit.runner.Description description)
Invoked when a test fails
|
protected void |
finished(org.junit.runner.Description description) |
AppEngine |
getAppEngine() |
AppManagementService |
getAppManagementService() |
AppRepositoryService |
getAppRepositoryService() |
String |
getConfigurationResource() |
protected void |
initializeAppEngine() |
protected void |
initializeServices() |
void |
setAppEngine(AppEngine appEngine) |
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 AppEngineConfiguration appEngineConfiguration
protected AppEngine appEngine
protected AppRepositoryService appRepositoryService
protected AppManagementService appManagementService
public FlowableAppRule()
public FlowableAppRule(String configurationResource)
public FlowableAppRule(AppEngine appEngine)
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.TestRule
protected 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 initializeAppEngine()
protected void initializeServices()
protected void configureAppEngine()
protected void finished(org.junit.runner.Description description)
public void setCurrentTime(Date currentTime)
public String getConfigurationResource()
public void setConfigurationResource(String configurationResource)
public AppEngine getAppEngine()
public void setAppEngine(AppEngine appEngine)
public AppRepositoryService getAppRepositoryService()
public AppManagementService getAppManagementService()