Class FlowableExtension
- java.lang.Object
-
- org.flowable.engine.test.FlowableExtension
-
- 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
public class FlowableExtension extends Object implements org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
JUnit Jupiter extension for the Flowable ProcessEngine and services initialization.Usage:
@FlowableTest class YourTest { @BeforeEach void setUp(ProcessEngine processEngine) { ... } @Test void myTest(RuntimeService runtimeService) { ... } ... }The ProcessEngine and the services will be made available to the test class through the parameter resolution (BeforeEach, AfterEach, test methods). The ProcessEngine will be initialized by default with the flowable.cfg.xml resource on the classpath. To specify a different configuration file, annotate your class with
ConfigurationResource. Process 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 process engine will be constructed.You can declare a deployment with the
Deploymentannotation. This extension will make sure that this deployment gets deployed before the setUp andcascade deletedafter the tearDown. The id of the deployment can be accessed by usingDeploymentIdin a test method.can be used to set the current time used by the process engineThis 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 Modifier and Type Field Description static StringDEFAULT_CONFIGURATION_RESOURCEprotected org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description FlowableExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEach(org.junit.jupiter.api.extension.ExtensionContext context)voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)protected ProcessEnginecreateProcessEngine(org.junit.jupiter.api.extension.ExtensionContext context)protected StringgetConfigurationResource(org.junit.jupiter.api.extension.ExtensionContext context)protected org.junit.jupiter.api.extension.ExtensionContext.StoregetStore(org.junit.jupiter.api.extension.ExtensionContext context)protected FlowableTestHelpergetTestHelper(org.junit.jupiter.api.extension.ExtensionContext context)ObjectresolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context)booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context)
-
-
-
Field Detail
-
DEFAULT_CONFIGURATION_RESOURCE
public static final String DEFAULT_CONFIGURATION_RESOURCE
- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
-
-
Method Detail
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
Exception
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context)- Specified by:
supportsParameterin 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:
resolveParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver
-
getConfigurationResource
protected String getConfigurationResource(org.junit.jupiter.api.extension.ExtensionContext context)
-
getTestHelper
protected FlowableTestHelper getTestHelper(org.junit.jupiter.api.extension.ExtensionContext context)
-
createProcessEngine
protected ProcessEngine createProcessEngine(org.junit.jupiter.api.extension.ExtensionContext context)
-
getStore
protected org.junit.jupiter.api.extension.ExtensionContext.Store getStore(org.junit.jupiter.api.extension.ExtensionContext context)
-
-