public class ProcessEngineRule extends org.junit.rules.TestWatcher implements ProcessEngineServices
Usage:
public class YourTest { @Rule public ProcessEngineRule processEngineRule = new ProcessEngineRule(); ... }
The ProcessEngine and the services will be made available to the test class
through the getters of the processEngineRule. The processEngine will be
initialized by default with the camunda.cfg.xml resource on the classpath. To
specify a different configuration file, pass the resource location in
the appropriate constructor
. Process
engines will be cached statically. Right before the first time the setUp is
called for a given configuration resource, the process engine will be
constructed.
You can declare a deployment with the Deployment
annotation. This
base class will make sure that this deployment gets deployed before the setUp
and cascade
deleted
after the tearDown.
The processEngineRule 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. In other words, you don't have to
clean up your own time messing mess ;-)
If you need the history service for your tests then you can specify the
required history level of the test method or class, using the
RequiredHistoryLevel
annotation. If the current history level of the
process engine is lower than the specified one then the test is skipped.
Modifier and Type | Field and Description |
---|---|
protected List<String> |
additionalDeployments |
protected AuthorizationService |
authorizationService |
protected CaseService |
caseService |
protected String |
configurationResource |
protected String |
configurationResourceCompat |
protected DecisionService |
decisionService |
protected String |
deploymentId |
protected boolean |
ensureCleanAfterTest |
protected ExternalTaskService |
externalTaskService |
protected FilterService |
filterService |
protected FormService |
formService |
protected HistoryService |
historyService |
protected IdentityService |
identityService |
protected ManagementService |
managementService |
protected ProcessEngine |
processEngine |
protected ProcessEngineConfigurationImpl |
processEngineConfiguration |
protected RepositoryService |
repositoryService |
protected RuntimeService |
runtimeService |
protected TaskService |
taskService |
Constructor and Description |
---|
ProcessEngineRule() |
ProcessEngineRule(boolean ensureCleanAfterTest) |
ProcessEngineRule(ProcessEngine processEngine) |
ProcessEngineRule(ProcessEngine processEngine,
boolean ensureCleanAfterTest) |
ProcessEngineRule(String configurationResource) |
ProcessEngineRule(String configurationResource,
boolean ensureCleanAfterTest) |
protected String configurationResource
protected String configurationResourceCompat
protected String deploymentId
protected boolean ensureCleanAfterTest
protected ProcessEngine processEngine
protected ProcessEngineConfigurationImpl processEngineConfiguration
protected RepositoryService repositoryService
protected RuntimeService runtimeService
protected TaskService taskService
protected HistoryService historyService
protected IdentityService identityService
protected ManagementService managementService
protected FormService formService
protected FilterService filterService
protected AuthorizationService authorizationService
protected CaseService caseService
protected ExternalTaskService externalTaskService
protected DecisionService decisionService
public ProcessEngineRule()
public ProcessEngineRule(boolean ensureCleanAfterTest)
public ProcessEngineRule(String configurationResource)
public ProcessEngineRule(String configurationResource, boolean ensureCleanAfterTest)
public ProcessEngineRule(ProcessEngine processEngine)
public ProcessEngineRule(ProcessEngine processEngine, boolean ensureCleanAfterTest)
public void starting(org.junit.runner.Description description)
starting
in class org.junit.rules.TestWatcher
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
apply
in class org.junit.rules.TestWatcher
protected void initializeProcessEngine()
protected void initializeServices()
protected void clearServiceReferences()
public void finished(org.junit.runner.Description description)
finished
in class org.junit.rules.TestWatcher
public void setCurrentTime(Date currentTime)
public String getConfigurationResource()
public void setConfigurationResource(String configurationResource)
public ProcessEngine getProcessEngine()
public void setProcessEngine(ProcessEngine processEngine)
public ProcessEngineConfigurationImpl getProcessEngineConfiguration()
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration)
public RepositoryService getRepositoryService()
ProcessEngineServices
RepositoryService
.getRepositoryService
in interface ProcessEngineServices
RepositoryService
object.public void setRepositoryService(RepositoryService repositoryService)
public RuntimeService getRuntimeService()
ProcessEngineServices
RuntimeService
.getRuntimeService
in interface ProcessEngineServices
RuntimeService
object.public void setRuntimeService(RuntimeService runtimeService)
public TaskService getTaskService()
ProcessEngineServices
TaskService
.getTaskService
in interface ProcessEngineServices
TaskService
object.public void setTaskService(TaskService taskService)
public HistoryService getHistoryService()
ProcessEngineServices
HistoryService
.getHistoryService
in interface ProcessEngineServices
HistoryService
object.public void setHistoryService(HistoryService historyService)
public void setHistoricDataService(HistoryService historicService)
historicService
- the historiy service instancesetHistoryService(HistoryService)
public IdentityService getIdentityService()
ProcessEngineServices
IdentityService
.getIdentityService
in interface ProcessEngineServices
IdentityService
object.public void setIdentityService(IdentityService identityService)
public ManagementService getManagementService()
ProcessEngineServices
ManagementService
.getManagementService
in interface ProcessEngineServices
ManagementService
object.public AuthorizationService getAuthorizationService()
ProcessEngineServices
AuthorizationService
.getAuthorizationService
in interface ProcessEngineServices
AuthorizationService
object.public void setAuthorizationService(AuthorizationService authorizationService)
public CaseService getCaseService()
ProcessEngineServices
CaseService
.getCaseService
in interface ProcessEngineServices
CaseService
object.public void setCaseService(CaseService caseService)
public FormService getFormService()
ProcessEngineServices
FormService
.getFormService
in interface ProcessEngineServices
FormService
object.public void setFormService(FormService formService)
public void setManagementService(ManagementService managementService)
public FilterService getFilterService()
ProcessEngineServices
FilterService
.getFilterService
in interface ProcessEngineServices
FilterService
object.public void setFilterService(FilterService filterService)
public ExternalTaskService getExternalTaskService()
ProcessEngineServices
ExternalTaskService
.getExternalTaskService
in interface ProcessEngineServices
ExternalTaskService
object.public void setExternalTaskService(ExternalTaskService externalTaskService)
public DecisionService getDecisionService()
ProcessEngineServices
DecisionService
.getDecisionService
in interface ProcessEngineServices
DecisionService
object.public void setDecisionService(DecisionService decisionService)
public void manageDeployment(Deployment deployment)
Copyright © 2017. All rights reserved.