Class FlowableWorkObjectRule
java.lang.Object
com.flowable.workobject.engine.test.FlowableWorkObjectRule
- All Implemented Interfaces:
org.junit.rules.TestRule
public class FlowableWorkObjectRule
extends java.lang.Object
implements org.junit.rules.TestRule
Convenience for WorkObjectEngine and services initialization in the form of a JUnit rule.
Usage:
public class YourTest { @Rule public FlowableWorkObjectRule flowableWorkObjectRule = new FlowableWorkObjectRule(); ... }
The WorkObjectEngine and the services will be made available to the test class through the getters of the FlowableRule. The WorkObjectEngine will be initialized by default with the flowable.workobject.cfg.xml resource
on the classpath. To specify a different configuration file, pass the resource location in the appropriate constructor
. Work object engines will be cached statically.
Right before the first time the setUp is called for a given configuration resource, the work object engine will be constructed.
You can declare a deployment with the WorkObjectDeploymentAnnotation
annotation. This base class will make sure that this deployment gets deployed before the setUp and
cascade deleted
after the tearDown.
- Author:
- Tijs Rademakers
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
configurationResource
protected java.lang.String
deploymentId
protected WorkObjectRepositoryService
repositoryService
protected WorkObjectEngine
workObjectEngine
protected WorkObjectEngineConfiguration
workObjectEngineConfiguration
-
Constructor Summary
Constructors Constructor Description FlowableWorkObjectRule()
FlowableWorkObjectRule(WorkObjectEngine workObjectEngine)
FlowableWorkObjectRule(java.lang.String configurationResource)
-
Method Summary
Modifier and Type Method Description org.junit.runners.model.Statement
apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
Implementation based onTestWatcher
.protected void
configureWorkObjectEngine()
protected void
failed(java.lang.Throwable e, org.junit.runner.Description description)
Invoked when a test failsprotected void
finished(org.junit.runner.Description description)
java.lang.String
getConfigurationResource()
WorkObjectRepositoryService
getRepositoryService()
WorkObjectEngine
getWorkObjectEngine()
protected void
initializeServices()
protected void
initializeWorkObjectEngine()
void
setConfigurationResource(java.lang.String configurationResource)
void
setRepositoryService(WorkObjectRepositoryService repositoryService)
void
setWorkObjectEngine(WorkObjectEngine workObjectEngine)
void
setWorkObjectEngineConfiguration(WorkObjectEngineConfiguration workObjectEngineConfiguration)
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
-
Field Details
-
configurationResource
protected java.lang.String configurationResource -
deploymentId
protected java.lang.String deploymentId -
workObjectEngineConfiguration
-
workObjectEngine
-
repositoryService
-
-
Constructor Details
-
FlowableWorkObjectRule
public FlowableWorkObjectRule() -
FlowableWorkObjectRule
public FlowableWorkObjectRule(java.lang.String configurationResource) -
FlowableWorkObjectRule
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)Implementation based onTestWatcher
.- Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
succeeded
protected void succeeded(org.junit.runner.Description description)Invoked when a test succeeds -
failed
protected void failed(java.lang.Throwable e, org.junit.runner.Description description)Invoked when a test fails -
skipped
protected void skipped(org.junit.internal.AssumptionViolatedException e, org.junit.runner.Description description)Invoked when a test is skipped due to a failed assumption. -
starting
protected void starting(org.junit.runner.Description description) -
initializeWorkObjectEngine
protected void initializeWorkObjectEngine() -
initializeServices
protected void initializeServices() -
configureWorkObjectEngine
protected void configureWorkObjectEngine() -
finished
protected void finished(org.junit.runner.Description description) -
getConfigurationResource
public java.lang.String getConfigurationResource() -
setConfigurationResource
public void setConfigurationResource(java.lang.String configurationResource) -
getWorkObjectEngine
-
setWorkObjectEngine
-
getRepositoryService
-
setRepositoryService
-
setWorkObjectEngineConfiguration
public void setWorkObjectEngineConfiguration(WorkObjectEngineConfiguration workObjectEngineConfiguration)
-