public class FlowableEventExtension extends Object implements org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
Usage:
@ExtendWith(FlowableEventExtension.class)
class YourTest {
@BeforeEach
void setUp(EventRegistryEngine eventRegistryEngine) {
...
}
@Test
void myTest(EventRepositoryService eventRepositoryService) {
...
}
...
}
The EventRegistryEngine and the services will be made available to the test class through the parameter resolution (BeforeEach, AfterEach, test methods).
The EventRegistryEngine will be initialized by default with the flowable.eventregistry.cfg.xml resource on the classpath.
To specify a different configuration file, annotate your class with EventConfigurationResource.
Event registry 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 event registry engine will be constructed.
You can declare a deployment with the EventDeploymentAnnotation annotation. This extension will make sure that this deployment gets deployed
before the setUp and deleted after the tearDown.
The id of the deployment can be accessed by using EventDeploymentId in a test method.
FlowableEventTestHelper.setCurrentTime(Date) can be used to set the current time used by the event registry 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.
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.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CONFIGURATION_RESOURCE |
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
FlowableEventExtension() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterEach(org.junit.jupiter.api.extension.ExtensionContext context) |
protected void |
assertAndEnsureCleanDb(EventRegistryEngine eventRegistryEngine,
org.junit.jupiter.api.extension.ExtensionContext context,
EnsureCleanDb ensureCleanDb)
Each test is assumed to clean up all DB content it entered.
|
void |
beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) |
protected void |
cleanTestAndAssertAndEnsureCleanDb(org.junit.jupiter.api.extension.ExtensionContext context,
EventRegistryEngine eventRegistryEngine) |
protected EventRegistryEngine |
createEventRegistryEngine(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 FlowableEventTestHelper |
getTestHelper(org.junit.jupiter.api.extension.ExtensionContext context) |
Object |
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) |
public static final String DEFAULT_CONFIGURATION_RESOURCE
protected final org.slf4j.Logger logger
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallbackpublic void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
afterEach in interface org.junit.jupiter.api.extension.AfterEachCallbackprotected void cleanTestAndAssertAndEnsureCleanDb(org.junit.jupiter.api.extension.ExtensionContext context,
EventRegistryEngine eventRegistryEngine)
protected void assertAndEnsureCleanDb(EventRegistryEngine eventRegistryEngine, org.junit.jupiter.api.extension.ExtensionContext context, EnsureCleanDb ensureCleanDb)
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext,
org.junit.jupiter.api.extension.ExtensionContext context)
supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolverpublic Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext context)
resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolverprotected String getConfigurationResource(org.junit.jupiter.api.extension.ExtensionContext context)
protected FlowableEventTestHelper getTestHelper(org.junit.jupiter.api.extension.ExtensionContext context)
protected EventRegistryEngine createEventRegistryEngine(org.junit.jupiter.api.extension.ExtensionContext context)
protected org.junit.jupiter.api.extension.ExtensionContext.Store getStore(org.junit.jupiter.api.extension.ExtensionContext context)
Copyright © 2020 Flowable. All rights reserved.