Class ProcessEngineExtension
- All Implemented Interfaces:
ProcessEngineServices
,org.junit.jupiter.api.extension.AfterAllCallback
,org.junit.jupiter.api.extension.AfterTestExecutionCallback
,org.junit.jupiter.api.extension.BeforeTestExecutionCallback
,org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.ParameterResolver
,org.junit.jupiter.api.extension.TestInstancePostProcessor
,org.junit.jupiter.api.extension.TestWatcher
ProcessEngine
into the test class.
If you provide a camunda.cfg.xml
file on the classpath. This file is used to configure the process engine.
Usage:
@ExtendWith(ProcessEngineExtension.class)
public class YourTest {
// provide a property where the extension can inject the process engine
public ProcessEngine processEngine;
...
}
If you want to choose the camunda.cfg.xml
file that is used in the test programmatically,
you can register the extension directly and use the builder pattern to configure it.
Usage with configuration:
@RegisterExtension
ProcessEngineExtension extension = ProcessEngineExtension.builder()
.configurationResource("myConfigurationFile.xml")
.build();}
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.
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.
-
Field Summary
Modifier and TypeFieldDescriptionprotected AuthorizationService
protected CaseService
protected String
protected DecisionService
protected String
protected boolean
protected ExternalTaskService
protected FilterService
protected FormService
protected HistoryService
protected IdentityService
protected static final org.slf4j.Logger
protected ManagementService
protected ProcessEngine
protected ProcessEngineConfigurationImpl
protected RepositoryService
protected RuntimeService
protected TaskService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterAll
(org.junit.jupiter.api.extension.ExtensionContext context) void
afterTestExecution
(org.junit.jupiter.api.extension.ExtensionContext context) void
beforeTestExecution
(org.junit.jupiter.api.extension.ExtensionContext context) build()
static ProcessEngineExtension
builder()
protected void
configurationResource
(String configurationResource) ensureCleanAfterTest
(boolean ensureCleanAfterTest) Returns the process engine'sAuthorizationService
.Returns the engine'sCaseService
.Returns the engine'sDecisionService
.Returns the engine'sExternalTaskService
.Returns the engine'sFilterService
.Returns the process engine'sFormService
.Returns the process engine'sHistoryService
.Returns the process engine'sIdentityService
.Returns the process engine'sManagementService
.Returns the process engine'sRepositoryService
.Returns the process engine'sRuntimeService
.Returns the process engine'sTaskService
.protected Supplier<IllegalStateException>
protected void
protected void
protected void
boolean
manageDeployment
(Deployment deployment) void
postProcessTestInstance
(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) void
setAuthorizationService
(AuthorizationService authorizationService) void
setCaseService
(CaseService caseService) void
setConfigurationResource
(String configurationResource) void
setCurrentTime
(Date currentTime) void
setDecisionService
(DecisionService decisionService) void
setEnsureCleanAfterTest
(boolean ensureCleanAfterTest) void
setExternalTaskService
(ExternalTaskService externalTaskService) void
setFilterService
(FilterService filterService) void
setFormService
(FormService formService) void
setHistoryService
(HistoryService historyService) void
setIdentityService
(IdentityService identityService) void
setManagementService
(ManagementService managementService) void
setProcessEngine
(ProcessEngine processEngine) void
setProcessEngineConfiguration
(ProcessEngineConfigurationImpl processEngineConfiguration) void
setRepositoryService
(RepositoryService repositoryService) void
setRuntimeService
(RuntimeService runtimeService) void
setTaskService
(TaskService taskService) boolean
supportsParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) useProcessEngine
(ProcessEngine engine) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.junit.jupiter.api.extension.TestWatcher
testAborted, testDisabled, testFailed, testSuccessful
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
processEngine
-
processEngineConfiguration
-
repositoryService
-
runtimeService
-
taskService
-
historyService
-
identityService
-
managementService
-
formService
-
filterService
-
authorizationService
-
caseService
-
externalTaskService
-
decisionService
-
configurationResource
-
deploymentId
-
ensureCleanAfterTest
protected boolean ensureCleanAfterTest -
additionalDeployments
-
-
Constructor Details
-
ProcessEngineExtension
public ProcessEngineExtension()
-
-
Method Details
-
initializeProcessEngine
protected void initializeProcessEngine() -
initializeServices
protected void initializeServices() -
clearServiceReferences
protected void clearServiceReferences() -
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException - Specified by:
supportsParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException - Specified by:
resolveParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
beforeTestExecution
public void beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeTestExecution
in interfaceorg.junit.jupiter.api.extension.BeforeTestExecutionCallback
-
afterTestExecution
public void afterTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterTestExecution
in interfaceorg.junit.jupiter.api.extension.AfterTestExecutionCallback
-
afterAll
- Specified by:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
- Throws:
Exception
-
postProcessTestInstance
public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
postProcessTestInstance
in interfaceorg.junit.jupiter.api.extension.TestInstancePostProcessor
-
builder
-
configurationResource
-
useProcessEngine
-
ensureCleanAfterTest
-
manageDeployment
-
build
-
illegalStateException
-
inject
-
setCurrentTime
-
getProcessEngine
-
setProcessEngine
-
getConfigurationResource
-
getProcessEngineConfiguration
-
getRepositoryService
Description copied from interface:ProcessEngineServices
Returns the process engine'sRepositoryService
.- Specified by:
getRepositoryService
in interfaceProcessEngineServices
- Returns:
- the
RepositoryService
object.
-
setRepositoryService
-
getRuntimeService
Description copied from interface:ProcessEngineServices
Returns the process engine'sRuntimeService
.- Specified by:
getRuntimeService
in interfaceProcessEngineServices
- Returns:
- the
RuntimeService
object.
-
setRuntimeService
-
getTaskService
Description copied from interface:ProcessEngineServices
Returns the process engine'sTaskService
.- Specified by:
getTaskService
in interfaceProcessEngineServices
- Returns:
- the
TaskService
object.
-
setTaskService
-
getHistoryService
Description copied from interface:ProcessEngineServices
Returns the process engine'sHistoryService
.- Specified by:
getHistoryService
in interfaceProcessEngineServices
- Returns:
- the
HistoryService
object.
-
setHistoryService
-
getIdentityService
Description copied from interface:ProcessEngineServices
Returns the process engine'sIdentityService
.- Specified by:
getIdentityService
in interfaceProcessEngineServices
- Returns:
- the
IdentityService
object.
-
setIdentityService
-
getManagementService
Description copied from interface:ProcessEngineServices
Returns the process engine'sManagementService
.- Specified by:
getManagementService
in interfaceProcessEngineServices
- Returns:
- the
ManagementService
object.
-
setManagementService
-
getFormService
Description copied from interface:ProcessEngineServices
Returns the process engine'sFormService
.- Specified by:
getFormService
in interfaceProcessEngineServices
- Returns:
- the
FormService
object.
-
setFormService
-
getFilterService
Description copied from interface:ProcessEngineServices
Returns the engine'sFilterService
.- Specified by:
getFilterService
in interfaceProcessEngineServices
- Returns:
- the
FilterService
object.
-
setFilterService
-
getAuthorizationService
Description copied from interface:ProcessEngineServices
Returns the process engine'sAuthorizationService
.- Specified by:
getAuthorizationService
in interfaceProcessEngineServices
- Returns:
- the
AuthorizationService
object.
-
setAuthorizationService
-
getCaseService
Description copied from interface:ProcessEngineServices
Returns the engine'sCaseService
.- Specified by:
getCaseService
in interfaceProcessEngineServices
- Returns:
- the
CaseService
object.
-
setCaseService
-
getExternalTaskService
Description copied from interface:ProcessEngineServices
Returns the engine'sExternalTaskService
.- Specified by:
getExternalTaskService
in interfaceProcessEngineServices
- Returns:
- the
ExternalTaskService
object.
-
setExternalTaskService
-
getDecisionService
Description copied from interface:ProcessEngineServices
Returns the engine'sDecisionService
.- Specified by:
getDecisionService
in interfaceProcessEngineServices
- Returns:
- the
DecisionService
object.
-
setDecisionService
-
setProcessEngineConfiguration
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) -
setConfigurationResource
-
getDeploymentId
-
isEnsureCleanAfterTest
public boolean isEnsureCleanAfterTest() -
setEnsureCleanAfterTest
public void setEnsureCleanAfterTest(boolean ensureCleanAfterTest)
-