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.TestWatcherpublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRuleapply in class org.junit.rules.TestWatcherprotected void initializeProcessEngine()
protected void initializeServices()
protected void clearServiceReferences()
public void finished(org.junit.runner.Description description)
finished in class org.junit.rules.TestWatcherpublic 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()
ProcessEngineServicesRepositoryService.getRepositoryService in interface ProcessEngineServicesRepositoryService object.public void setRepositoryService(RepositoryService repositoryService)
public RuntimeService getRuntimeService()
ProcessEngineServicesRuntimeService.getRuntimeService in interface ProcessEngineServicesRuntimeService object.public void setRuntimeService(RuntimeService runtimeService)
public TaskService getTaskService()
ProcessEngineServicesTaskService.getTaskService in interface ProcessEngineServicesTaskService object.public void setTaskService(TaskService taskService)
public HistoryService getHistoryService()
ProcessEngineServicesHistoryService.getHistoryService in interface ProcessEngineServicesHistoryService object.public void setHistoryService(HistoryService historyService)
public void setHistoricDataService(HistoryService historicService)
historicService - the historiy service instancesetHistoryService(HistoryService)public IdentityService getIdentityService()
ProcessEngineServicesIdentityService.getIdentityService in interface ProcessEngineServicesIdentityService object.public void setIdentityService(IdentityService identityService)
public ManagementService getManagementService()
ProcessEngineServicesManagementService.getManagementService in interface ProcessEngineServicesManagementService object.public AuthorizationService getAuthorizationService()
ProcessEngineServicesAuthorizationService.getAuthorizationService in interface ProcessEngineServicesAuthorizationService object.public void setAuthorizationService(AuthorizationService authorizationService)
public CaseService getCaseService()
ProcessEngineServicesCaseService.getCaseService in interface ProcessEngineServicesCaseService object.public void setCaseService(CaseService caseService)
public FormService getFormService()
ProcessEngineServicesFormService.getFormService in interface ProcessEngineServicesFormService object.public void setFormService(FormService formService)
public void setManagementService(ManagementService managementService)
public FilterService getFilterService()
ProcessEngineServicesFilterService.getFilterService in interface ProcessEngineServicesFilterService object.public void setFilterService(FilterService filterService)
public ExternalTaskService getExternalTaskService()
ProcessEngineServicesExternalTaskService.getExternalTaskService in interface ProcessEngineServicesExternalTaskService object.public void setExternalTaskService(ExternalTaskService externalTaskService)
public DecisionService getDecisionService()
ProcessEngineServicesDecisionService.getDecisionService in interface ProcessEngineServicesDecisionService object.public void setDecisionService(DecisionService decisionService)
public void manageDeployment(Deployment deployment)
Copyright © 2017. All rights reserved.