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
FieldsModifier and TypeFieldDescriptionprotected AuthorizationServiceprotected CaseServiceprotected Stringprotected DecisionServiceprotected Stringprotected booleanprotected ExternalTaskServiceprotected FilterServiceprotected FormServiceprotected HistoryServiceprotected IdentityServiceprotected static final org.slf4j.Loggerprotected ManagementServiceprotected ProcessEngineprotected ProcessEngineConfigurationImplprotected RepositoryServiceprotected RuntimeServiceprotected 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) 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 voidprotected voidprotected voidbooleanmanageDeployment(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(AuthorizationService authorizationService) voidsetCaseService(CaseService caseService) voidsetConfigurationResource(String configurationResource) voidsetCurrentTime(Date currentTime) voidsetDecisionService(DecisionService decisionService) voidsetEnsureCleanAfterTest(boolean ensureCleanAfterTest) voidsetExternalTaskService(ExternalTaskService externalTaskService) voidsetFilterService(FilterService filterService) voidsetFormService(FormService formService) voidsetHistoryService(HistoryService historyService) voidsetIdentityService(IdentityService identityService) voidsetManagementService(ManagementService managementService) voidsetProcessEngine(ProcessEngine processEngine) voidsetProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) voidsetRepositoryService(RepositoryService repositoryService) voidsetRuntimeService(RuntimeService runtimeService) voidsetTaskService(TaskService taskService) booleansupportsParameter(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, 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
-
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:
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
-
build
-
illegalStateException
-
inject
-
setCurrentTime
-
getProcessEngine
-
setProcessEngine
-
getConfigurationResource
-
getProcessEngineConfiguration
-
getRepositoryService
Description copied from interface:ProcessEngineServicesReturns the process engine'sRepositoryService.- Specified by:
getRepositoryServicein interfaceProcessEngineServices- Returns:
- the
RepositoryServiceobject.
-
setRepositoryService
-
getRuntimeService
Description copied from interface:ProcessEngineServicesReturns the process engine'sRuntimeService.- Specified by:
getRuntimeServicein interfaceProcessEngineServices- Returns:
- the
RuntimeServiceobject.
-
setRuntimeService
-
getTaskService
Description copied from interface:ProcessEngineServicesReturns the process engine'sTaskService.- Specified by:
getTaskServicein interfaceProcessEngineServices- Returns:
- the
TaskServiceobject.
-
setTaskService
-
getHistoryService
Description copied from interface:ProcessEngineServicesReturns the process engine'sHistoryService.- Specified by:
getHistoryServicein interfaceProcessEngineServices- Returns:
- the
HistoryServiceobject.
-
setHistoryService
-
getIdentityService
Description copied from interface:ProcessEngineServicesReturns the process engine'sIdentityService.- Specified by:
getIdentityServicein interfaceProcessEngineServices- Returns:
- the
IdentityServiceobject.
-
setIdentityService
-
getManagementService
Description copied from interface:ProcessEngineServicesReturns the process engine'sManagementService.- Specified by:
getManagementServicein interfaceProcessEngineServices- Returns:
- the
ManagementServiceobject.
-
setManagementService
-
getFormService
Description copied from interface:ProcessEngineServicesReturns the process engine'sFormService.- Specified by:
getFormServicein interfaceProcessEngineServices- Returns:
- the
FormServiceobject.
-
setFormService
-
getFilterService
Description copied from interface:ProcessEngineServicesReturns the engine'sFilterService.- Specified by:
getFilterServicein interfaceProcessEngineServices- Returns:
- the
FilterServiceobject.
-
setFilterService
-
getAuthorizationService
Description copied from interface:ProcessEngineServicesReturns the process engine'sAuthorizationService.- Specified by:
getAuthorizationServicein interfaceProcessEngineServices- Returns:
- the
AuthorizationServiceobject.
-
setAuthorizationService
-
getCaseService
Description copied from interface:ProcessEngineServicesReturns the engine'sCaseService.- Specified by:
getCaseServicein interfaceProcessEngineServices- Returns:
- the
CaseServiceobject.
-
setCaseService
-
getExternalTaskService
Description copied from interface:ProcessEngineServicesReturns the engine'sExternalTaskService.- Specified by:
getExternalTaskServicein interfaceProcessEngineServices- Returns:
- the
ExternalTaskServiceobject.
-
setExternalTaskService
-
getDecisionService
Description copied from interface:ProcessEngineServicesReturns the engine'sDecisionService.- Specified by:
getDecisionServicein interfaceProcessEngineServices- Returns:
- the
DecisionServiceobject.
-
setDecisionService
-
setProcessEngineConfiguration
public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration) -
setConfigurationResource
-
getDeploymentId
-
isEnsureCleanAfterTest
public boolean isEnsureCleanAfterTest() -
setEnsureCleanAfterTest
public void setEnsureCleanAfterTest(boolean ensureCleanAfterTest)
-