Class ProcessEngineExtension
- All Implemented Interfaces:
org.camunda.bpm.engine.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
FieldsModifier and TypeFieldDescriptionprotected org.camunda.bpm.engine.AuthorizationServiceprotected org.camunda.bpm.engine.CaseServiceprotected Stringprotected org.camunda.bpm.engine.DecisionServiceprotected Stringprotected booleanprotected org.camunda.bpm.engine.ExternalTaskServiceprotected org.camunda.bpm.engine.FilterServiceprotected org.camunda.bpm.engine.FormServiceprotected org.camunda.bpm.engine.HistoryServiceprotected org.camunda.bpm.engine.IdentityServiceprotected static final org.slf4j.Loggerprotected org.camunda.bpm.engine.ManagementServiceprotected org.camunda.bpm.engine.ProcessEngineprotected org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImplprotected org.camunda.bpm.engine.RepositoryServiceprotected org.camunda.bpm.engine.RuntimeServiceprotected org.camunda.bpm.engine.TaskService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAll(org.junit.jupiter.api.extension.ExtensionContext context) voidafterTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) voidbeforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) build()static ProcessEngineExtensionbuilder()protected voidconfigurationResource(String configurationResource) ensureCleanAfterTest(boolean ensureCleanAfterTest) org.camunda.bpm.engine.AuthorizationServiceorg.camunda.bpm.engine.CaseServiceorg.camunda.bpm.engine.DecisionServiceorg.camunda.bpm.engine.ExternalTaskServiceorg.camunda.bpm.engine.FilterServiceorg.camunda.bpm.engine.FormServiceorg.camunda.bpm.engine.HistoryServiceorg.camunda.bpm.engine.IdentityServiceorg.camunda.bpm.engine.ManagementServiceorg.camunda.bpm.engine.ProcessEngineorg.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImplorg.camunda.bpm.engine.RepositoryServiceorg.camunda.bpm.engine.RuntimeServiceorg.camunda.bpm.engine.TaskServiceprotected Supplier<IllegalStateException>protected voidprotected voidprotected voidbooleanmanageDeployment(org.camunda.bpm.engine.repository.Deployment deployment) voidpostProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) voidsetAuthorizationService(org.camunda.bpm.engine.AuthorizationService authorizationService) voidsetCaseService(org.camunda.bpm.engine.CaseService caseService) voidsetConfigurationResource(String configurationResource) voidsetCurrentTime(Date currentTime) voidsetDecisionService(org.camunda.bpm.engine.DecisionService decisionService) voidsetEnsureCleanAfterTest(boolean ensureCleanAfterTest) voidsetExternalTaskService(org.camunda.bpm.engine.ExternalTaskService externalTaskService) voidsetFilterService(org.camunda.bpm.engine.FilterService filterService) voidsetFormService(org.camunda.bpm.engine.FormService formService) voidsetHistoryService(org.camunda.bpm.engine.HistoryService historyService) voidsetIdentityService(org.camunda.bpm.engine.IdentityService identityService) voidsetManagementService(org.camunda.bpm.engine.ManagementService managementService) voidsetProcessEngine(org.camunda.bpm.engine.ProcessEngine processEngine) voidsetProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl processEngineConfiguration) voidsetRepositoryService(org.camunda.bpm.engine.RepositoryService repositoryService) voidsetRuntimeService(org.camunda.bpm.engine.RuntimeService runtimeService) voidsetTaskService(org.camunda.bpm.engine.TaskService taskService) booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) useProcessEngine(org.camunda.bpm.engine.ProcessEngine engine) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.TestWatcher
testAborted, testDisabled, testFailed, testSuccessful
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
processEngine
protected org.camunda.bpm.engine.ProcessEngine processEngine -
processEngineConfiguration
protected org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl processEngineConfiguration -
repositoryService
protected org.camunda.bpm.engine.RepositoryService repositoryService -
runtimeService
protected org.camunda.bpm.engine.RuntimeService runtimeService -
taskService
protected org.camunda.bpm.engine.TaskService taskService -
historyService
protected org.camunda.bpm.engine.HistoryService historyService -
identityService
protected org.camunda.bpm.engine.IdentityService identityService -
managementService
protected org.camunda.bpm.engine.ManagementService managementService -
formService
protected org.camunda.bpm.engine.FormService formService -
filterService
protected org.camunda.bpm.engine.FilterService filterService -
authorizationService
protected org.camunda.bpm.engine.AuthorizationService authorizationService -
caseService
protected org.camunda.bpm.engine.CaseService caseService -
externalTaskService
protected org.camunda.bpm.engine.ExternalTaskService externalTaskService -
decisionService
protected org.camunda.bpm.engine.DecisionService 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:
supportsParameterin 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:
resolveParameterin 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:
beforeTestExecutionin interfaceorg.junit.jupiter.api.extension.BeforeTestExecutionCallback
-
afterTestExecution
public void afterTestExecution(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterTestExecutionin interfaceorg.junit.jupiter.api.extension.AfterTestExecutionCallback
-
afterAll
- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback- Throws:
Exception
-
postProcessTestInstance
public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
postProcessTestInstancein interfaceorg.junit.jupiter.api.extension.TestInstancePostProcessor
-
builder
-
configurationResource
-
useProcessEngine
-
ensureCleanAfterTest
-
manageDeployment
public ProcessEngineExtension manageDeployment(org.camunda.bpm.engine.repository.Deployment deployment) -
build
-
illegalStateException
-
inject
-
setCurrentTime
-
getProcessEngine
public org.camunda.bpm.engine.ProcessEngine getProcessEngine() -
setProcessEngine
public void setProcessEngine(org.camunda.bpm.engine.ProcessEngine processEngine) -
getConfigurationResource
-
getProcessEngineConfiguration
public org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl getProcessEngineConfiguration() -
getRepositoryService
public org.camunda.bpm.engine.RepositoryService getRepositoryService()- Specified by:
getRepositoryServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setRepositoryService
public void setRepositoryService(org.camunda.bpm.engine.RepositoryService repositoryService) -
getRuntimeService
public org.camunda.bpm.engine.RuntimeService getRuntimeService()- Specified by:
getRuntimeServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setRuntimeService
public void setRuntimeService(org.camunda.bpm.engine.RuntimeService runtimeService) -
getTaskService
public org.camunda.bpm.engine.TaskService getTaskService()- Specified by:
getTaskServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setTaskService
public void setTaskService(org.camunda.bpm.engine.TaskService taskService) -
getHistoryService
public org.camunda.bpm.engine.HistoryService getHistoryService()- Specified by:
getHistoryServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setHistoryService
public void setHistoryService(org.camunda.bpm.engine.HistoryService historyService) -
getIdentityService
public org.camunda.bpm.engine.IdentityService getIdentityService()- Specified by:
getIdentityServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setIdentityService
public void setIdentityService(org.camunda.bpm.engine.IdentityService identityService) -
getManagementService
public org.camunda.bpm.engine.ManagementService getManagementService()- Specified by:
getManagementServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setManagementService
public void setManagementService(org.camunda.bpm.engine.ManagementService managementService) -
getFormService
public org.camunda.bpm.engine.FormService getFormService()- Specified by:
getFormServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setFormService
public void setFormService(org.camunda.bpm.engine.FormService formService) -
getFilterService
public org.camunda.bpm.engine.FilterService getFilterService()- Specified by:
getFilterServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setFilterService
public void setFilterService(org.camunda.bpm.engine.FilterService filterService) -
getAuthorizationService
public org.camunda.bpm.engine.AuthorizationService getAuthorizationService()- Specified by:
getAuthorizationServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setAuthorizationService
public void setAuthorizationService(org.camunda.bpm.engine.AuthorizationService authorizationService) -
getCaseService
public org.camunda.bpm.engine.CaseService getCaseService()- Specified by:
getCaseServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setCaseService
public void setCaseService(org.camunda.bpm.engine.CaseService caseService) -
getExternalTaskService
public org.camunda.bpm.engine.ExternalTaskService getExternalTaskService()- Specified by:
getExternalTaskServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setExternalTaskService
public void setExternalTaskService(org.camunda.bpm.engine.ExternalTaskService externalTaskService) -
getDecisionService
public org.camunda.bpm.engine.DecisionService getDecisionService()- Specified by:
getDecisionServicein interfaceorg.camunda.bpm.engine.ProcessEngineServices
-
setDecisionService
public void setDecisionService(org.camunda.bpm.engine.DecisionService decisionService) -
setProcessEngineConfiguration
public void setProcessEngineConfiguration(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl processEngineConfiguration) -
setConfigurationResource
-
getDeploymentId
-
isEnsureCleanAfterTest
public boolean isEnsureCleanAfterTest() -
setEnsureCleanAfterTest
public void setEnsureCleanAfterTest(boolean ensureCleanAfterTest)
-