Package com.flowable.content.engine.test
Class FlowableContentExtension
- java.lang.Object
-
- com.flowable.content.engine.test.FlowableContentExtension
-
- 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:
FlowableContentSpringExtension
public class FlowableContentExtension 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 ContentEngine and services initialization.Usage:
@ExtendWith(FlowableContentExtension.class) class YourTest { @BeforeEach void setUp(ContentEngine contentEngine) { ... } @Test void myTest(DocumentRepositoryService documentRepositoryService) { ... } ... }
The ContentEngine and the services will be made available to the test class through the parameter resolution (BeforeEach, AfterEach, test methods). The ContentEngine will be initialized by default with the flowable.content.cfg.xml resource on the classpath. To specify a different configuration file, annotate your class with
ContentConfigurationResource
. Content 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 content engine will be constructed.- Author:
- Filip Hrisafov
-
-
Field Summary
Fields Modifier and Type Field Description protected String
configurationResource
static String
DEFAULT_CONFIGURATION_RESOURCE
protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description FlowableContentExtension()
FlowableContentExtension(String configurationResource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
void
beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
protected ContentEngine
createContentEngine(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 FlowableContentTestHelper
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)
-
-
-
Field Detail
-
DEFAULT_CONFIGURATION_RESOURCE
public static final String DEFAULT_CONFIGURATION_RESOURCE
- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
-
configurationResource
protected final String configurationResource
-
-
Constructor Detail
-
FlowableContentExtension
public FlowableContentExtension()
-
FlowableContentExtension
public FlowableContentExtension(String configurationResource)
-
-
Method Detail
-
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
protected String getConfigurationResource(org.junit.jupiter.api.extension.ExtensionContext context)
-
getTestHelper
protected FlowableContentTestHelper getTestHelper(org.junit.jupiter.api.extension.ExtensionContext context)
-
createContentEngine
protected ContentEngine createContentEngine(org.junit.jupiter.api.extension.ExtensionContext context)
-
getStore
protected org.junit.jupiter.api.extension.ExtensionContext.Store getStore(org.junit.jupiter.api.extension.ExtensionContext context)
-
-