public class ActivitiDmnRule extends Object implements org.junit.rules.TestRule
Usage:
public class YourTest {
@Rule
public ActivitiDmnRule activitiDmnRule = new ActivitiDmnRule();
...
}
The DmnEngine and the services will be made available to the test class
through the getters of the activitiRule. The dmnEngine will be initialized by
default with the activiti.dmn.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 DmnDeploymentAnnotation
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.
| Modifier and Type | Field and Description |
|---|---|
protected String |
configurationResource |
protected String |
deploymentId |
protected DmnEngine |
dmnEngine |
protected DmnEngineConfiguration |
dmnEngineConfiguration |
protected DmnRepositoryService |
repositoryService |
| Constructor and Description |
|---|
ActivitiDmnRule() |
ActivitiDmnRule(DmnEngine dmnEngine) |
ActivitiDmnRule(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 |
configureDmnEngine() |
protected void |
failed(Throwable e,
org.junit.runner.Description description)
Invoked when a test fails
|
protected void |
finished(org.junit.runner.Description description) |
String |
getConfigurationResource() |
DmnEngine |
getDmnEngine() |
DmnRepositoryService |
getRepositoryService() |
protected void |
initializeDmnEngine() |
protected void |
initializeServices() |
void |
setConfigurationResource(String configurationResource) |
void |
setDmnEngine(DmnEngine dmnEngine) |
void |
setDmnEngineConfiguration(DmnEngineConfiguration dmnEngineConfiguration) |
void |
setRepositoryService(DmnRepositoryService repositoryService) |
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 DmnEngineConfiguration dmnEngineConfiguration
protected DmnEngine dmnEngine
protected DmnRepositoryService repositoryService
public ActivitiDmnRule()
public ActivitiDmnRule(String configurationResource)
public ActivitiDmnRule(DmnEngine dmnEngine)
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.TestRuleprotected 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 initializeDmnEngine()
protected void initializeServices()
protected void configureDmnEngine()
protected void finished(org.junit.runner.Description description)
public String getConfigurationResource()
public void setConfigurationResource(String configurationResource)
public DmnEngine getDmnEngine()
public void setDmnEngine(DmnEngine dmnEngine)
public DmnRepositoryService getRepositoryService()
public void setRepositoryService(DmnRepositoryService repositoryService)
public void setDmnEngineConfiguration(DmnEngineConfiguration dmnEngineConfiguration)
Copyright © 2017 Alfresco. All rights reserved.