Class InternalFlowableFormExtension
- java.lang.Object
-
- org.flowable.form.engine.impl.test.InternalFlowableFormExtension
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback,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 abstract class InternalFlowableFormExtension extends Object implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.ParameterResolver
Base internal extension for JUnit Jupiter. This is a basis for other internal extensions. It allows:-
Performs a deployment before each test when a test method is annotated with
FormDeploymentAnnotation - Validates the history data after each test
- Delete history jobs and deployment after each test
-
Assert and ensure a clean db after each test or after all tests (depending on the
TestInstance.Lifecycle. -
Support for injecting the
FormEngine,FormDeploymentAnnotationinto test methods and lifecycle methods within tests.
- Author:
- Filip Hrisafov
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringANNOTATION_DEPLOYMENT_ID_KEYprotected static StringEMPTY_LINEprotected org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description InternalFlowableFormExtension()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidafterAll(org.junit.jupiter.api.extension.ExtensionContext context)voidafterEach(org.junit.jupiter.api.extension.ExtensionContext context)protected voidassertAndEnsureCleanDb(FormEngine formEngine, org.junit.jupiter.api.extension.ExtensionContext context, EnsureCleanDb ensureCleanDb)Each test is assumed to clean up all DB content it entered.voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)protected voidcleanTestAndAssertAndEnsureCleanDb(org.junit.jupiter.api.extension.ExtensionContext context, FormEngine formEngine)protected voiddoFinally(org.junit.jupiter.api.extension.ExtensionContext context, org.junit.jupiter.api.TestInstance.Lifecycle lifecycleForClean)protected abstract FormEnginegetFormEngine(org.junit.jupiter.api.extension.ExtensionContext context)protected abstract org.junit.jupiter.api.extension.ExtensionContext.StoregetStore(org.junit.jupiter.api.extension.ExtensionContext context)protected voidremoveDeployments(FormRepositoryService repositoryService)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
-
EMPTY_LINE
protected static final String EMPTY_LINE
- See Also:
- Constant Field Values
-
ANNOTATION_DEPLOYMENT_ID_KEY
protected static final String ANNOTATION_DEPLOYMENT_ID_KEY
- 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)
- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
Exception
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback- Throws:
Exception
-
doFinally
protected void doFinally(org.junit.jupiter.api.extension.ExtensionContext context, org.junit.jupiter.api.TestInstance.Lifecycle lifecycleForClean)
-
cleanTestAndAssertAndEnsureCleanDb
protected void cleanTestAndAssertAndEnsureCleanDb(org.junit.jupiter.api.extension.ExtensionContext context, FormEngine formEngine)
-
assertAndEnsureCleanDb
protected void assertAndEnsureCleanDb(FormEngine formEngine, org.junit.jupiter.api.extension.ExtensionContext context, EnsureCleanDb ensureCleanDb)
Each test is assumed to clean up all DB content it entered. After a test method executed, this method scans all tables to see if the DB is completely clean. It throws AssertionFailed in case the DB is not clean. If the DB is not clean, it is cleaned by performing a create a drop.
-
removeDeployments
protected void removeDeployments(FormRepositoryService repositoryService)
-
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
-
getFormEngine
protected abstract FormEngine getFormEngine(org.junit.jupiter.api.extension.ExtensionContext context)
-
getStore
protected abstract org.junit.jupiter.api.extension.ExtensionContext.Store getStore(org.junit.jupiter.api.extension.ExtensionContext context)
-
-