public class ProcessEngineRule
extends org.junit.rules.TestWatchman
Usage:
public class YourTest { @Rule public ProcessEngineRule activitiRule = new ProcessEngineRule(); ... }
The ProcessEngine and the services will be made available to the test class
through the getters of the activitiRule.
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 activitiRule 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 ;-)
Modifier and Type | Field and Description |
---|---|
protected String |
configurationResource |
protected String |
configurationResourceCompat |
protected String |
deploymentId |
protected FormService |
formService |
protected HistoryService |
historyService |
protected IdentityService |
identityService |
protected ManagementService |
managementService |
protected ProcessEngine |
processEngine |
protected RepositoryService |
repositoryService |
protected RuntimeService |
runtimeService |
protected TaskService |
taskService |
Constructor and Description |
---|
ProcessEngineRule() |
ProcessEngineRule(ProcessEngine processEngine) |
ProcessEngineRule(String configurationResource) |
protected String configurationResource
protected String configurationResourceCompat
protected String deploymentId
protected ProcessEngine processEngine
protected RepositoryService repositoryService
protected RuntimeService runtimeService
protected TaskService taskService
protected HistoryService historyService
protected IdentityService identityService
protected ManagementService managementService
protected FormService formService
public ProcessEngineRule()
public ProcessEngineRule(String configurationResource)
public ProcessEngineRule(ProcessEngine processEngine)
public void starting(org.junit.runners.model.FrameworkMethod method)
starting
in class org.junit.rules.TestWatchman
protected void initializeProcessEngine()
protected void initializeServices()
public void finished(org.junit.runners.model.FrameworkMethod method)
finished
in class org.junit.rules.TestWatchman
public void setCurrentTime(Date currentTime)
public String getConfigurationResource()
public void setConfigurationResource(String configurationResource)
public ProcessEngine getProcessEngine()
public void setProcessEngine(ProcessEngine processEngine)
public RepositoryService getRepositoryService()
public void setRepositoryService(RepositoryService repositoryService)
public RuntimeService getRuntimeService()
public void setRuntimeService(RuntimeService runtimeService)
public TaskService getTaskService()
public void setTaskService(TaskService taskService)
public HistoryService getHistoryService()
public void setHistoricDataService(HistoryService historicDataService)
public IdentityService getIdentityService()
public void setIdentityService(IdentityService identityService)
public ManagementService getManagementService()
public FormService getFormService()
public void setManagementService(ManagementService managementService)
Copyright © 2015. All rights reserved.