Class FlowableCmmnExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback
,org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.ParameterResolver
- Direct Known Subclasses:
FlowableCmmnSpringExtension
Usage:
@ExtendWith(FlowableCmmnExtension.class) class YourTest { @BeforeEach void setUp(CmmnEngine cmmnEngine) { ... } @Test void myTest(CmmnRuntimeService cmmnRuntimeService) { ... } ... }
The CmmnEngine and the services will be made available to the test class through the parameter resolution (BeforeEach, AfterEach, test methods).
The CmmnEngine will be initialized by default with the flowable.cmmn.cfg.xml resource on the classpath.
To specify a different configuration file, annotate your class with CmmnConfigurationResource
.
Cmmn engines will be cached as part of the JUnit Jupiter Extension context.
Right before the first time the setUp is called for a given configuration resource, the cmmn engine will be constructed.
You can declare a deployment with the CmmnDeployment
annotation. This extension will make sure that this deployment gets deployed before the setUp
and cascade deleted
after the tearDown.
The id of the deployment can be accessed by using CmmnDeploymentId
in a test method.
can be used to set the current time used by the cmmn 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.
- Author:
- Filip Hrisafov
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterEach
(org.junit.jupiter.api.extension.ExtensionContext context) void
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context) protected CmmnEngine
createCmmnEngine
(org.junit.jupiter.api.extension.ExtensionContext context) protected String
getConfigurationResource
(org.junit.jupiter.api.extension.ExtensionContext context) protected org.junit.jupiter.api.extension.ExtensionContext.Store
getStore
(org.junit.jupiter.api.extension.ExtensionContext context) protected FlowableCmmnTestHelper
getTestHelper
(org.junit.jupiter.api.extension.ExtensionContext context) resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context) boolean
supportsParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context)
-
Field Details
-
DEFAULT_CONFIGURATION_RESOURCE
- See Also:
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
FlowableCmmnExtension
public FlowableCmmnExtension()
-
-
Method Details
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterEach
in interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
supportsParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
-
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
resolveParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
-
getConfigurationResource
-
getTestHelper
protected FlowableCmmnTestHelper getTestHelper(org.junit.jupiter.api.extension.ExtensionContext context) -
createCmmnEngine
-
getStore
protected org.junit.jupiter.api.extension.ExtensionContext.Store getStore(org.junit.jupiter.api.extension.ExtensionContext context)
-