Package org.camunda.bpm.engine.impl.test
Class TestHelper
- java.lang.Object
-
- org.camunda.bpm.engine.impl.test.TestHelper
-
public abstract class TestHelper extends java.lang.Object- Author:
- Tom Baeyens
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEMPTY_LINEstatic java.util.List<java.lang.String>RESOURCE_SUFFIXESstatic java.util.List<java.lang.String>TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK
-
Constructor Summary
Constructors Constructor Description TestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.StringannotationDeploymentSetUp(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)static java.lang.StringannotationDeploymentSetUp(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, Deployment deploymentAnnotation, java.lang.Class<?>... parameterTypes)static java.lang.StringannotationDeploymentSetUp(ProcessEngine processEngine, java.lang.String[] resources, java.lang.Class<?> testClass, boolean onMethod, java.lang.String methodName)static java.lang.StringannotationDeploymentSetUp(ProcessEngine processEngine, java.lang.String[] resources, java.lang.Class<?> testClass, java.lang.String methodName)static voidannotationDeploymentTearDown(ProcessEngine processEngine, java.lang.String deploymentId, java.lang.Class<?> testClass, java.lang.String methodName)static booleanannotationRequiredDatabaseCheck(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)static booleanannotationRequiredDatabaseCheck(ProcessEngine processEngine, RequiredDatabase annotation, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)static booleanannotationRequiredHistoryLevelCheck(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)static booleanannotationRequiredHistoryLevelCheck(ProcessEngine processEngine, RequiredHistoryLevel annotation, java.lang.Class<?> testClass, java.lang.String methodName)static booleanareJobsAvailable(ProcessEngineConfigurationImpl processEngineConfiguration)static voidassertAndEnsureCleanDbAndCache(ProcessEngine processEngine)Ensures that the deployment cache and database is clean after a test.static java.lang.StringassertAndEnsureCleanDbAndCache(ProcessEngine processEngine, boolean fail)Ensures that the deployment cache and database is clean after a test.static voidassertAndEnsureCleanDeploymentCache(ProcessEngine processEngine)Ensures that the deployment cache is empty after a test.static java.lang.StringassertAndEnsureCleanDeploymentCache(ProcessEngine processEngine, boolean fail)Ensures that the deployment cache is empty after a test.static java.lang.StringassertAndEnsureNoProcessApplicationsRegistered(ProcessEngine processEngine)static voidassertProcessEnded(ProcessEngine processEngine, java.lang.String processInstanceId)Deprecated.static voidclearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration)static voidcloseProcessEngines()static voidcreateOrUpdateHistoryLevel(ProcessEngineConfigurationImpl processEngineConfiguration)static voidcreateSchema(ProcessEngineConfigurationImpl processEngineConfiguration)static java.lang.ObjectdefaultManualActivation()static voiddeleteDeployment(ProcessEngine processEngine, java.lang.String deploymentId)static voiddeleteHistoryLevel(ProcessEngineConfigurationImpl processEngineConfiguration)static voiddeleteInstallationId(ProcessEngineConfigurationImpl processEngineConfiguration)static voiddeleteTelemetryProperty(ProcessEngineConfigurationImpl processEngineConfiguration)static voiddropSchema(ProcessEngineConfigurationImpl processEngineConfiguration)protected static voidfail(java.lang.String message)static java.lang.StringgetBpmnProcessDefinitionResource(java.lang.Class<?> type, java.lang.String name)get a resource location by convention based on a class (type) and a relative resource name.protected static java.lang.reflect.MethodgetMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)static ProcessEnginegetProcessEngine(java.lang.String configurationResource)static voidresetIdGenerator(ProcessEngineConfigurationImpl processEngineConfiguration)static voidwaitForJobExecutorToProcessAllJobs(ProcessEngineConfigurationImpl processEngineConfiguration, long maxMillisToWait, long intervalMillis)
-
-
-
Field Detail
-
EMPTY_LINE
public static final java.lang.String EMPTY_LINE
- See Also:
- Constant Field Values
-
TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK
public static final java.util.List<java.lang.String> TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK
-
RESOURCE_SUFFIXES
public static final java.util.List<java.lang.String> RESOURCE_SUFFIXES
-
-
Method Detail
-
assertProcessEnded
@Deprecated public static void assertProcessEnded(ProcessEngine processEngine, java.lang.String processInstanceId)
Deprecated.useProcessEngineAssertinstead.
-
annotationDeploymentSetUp
public static java.lang.String annotationDeploymentSetUp(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, Deployment deploymentAnnotation, java.lang.Class<?>... parameterTypes)
-
annotationDeploymentSetUp
public static java.lang.String annotationDeploymentSetUp(ProcessEngine processEngine, java.lang.String[] resources, java.lang.Class<?> testClass, java.lang.String methodName)
-
annotationDeploymentSetUp
public static java.lang.String annotationDeploymentSetUp(ProcessEngine processEngine, java.lang.String[] resources, java.lang.Class<?> testClass, boolean onMethod, java.lang.String methodName)
-
annotationDeploymentSetUp
public static java.lang.String annotationDeploymentSetUp(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
-
annotationDeploymentTearDown
public static void annotationDeploymentTearDown(ProcessEngine processEngine, java.lang.String deploymentId, java.lang.Class<?> testClass, java.lang.String methodName)
-
deleteDeployment
public static void deleteDeployment(ProcessEngine processEngine, java.lang.String deploymentId)
-
getBpmnProcessDefinitionResource
public static java.lang.String getBpmnProcessDefinitionResource(java.lang.Class<?> type, java.lang.String name)get a resource location by convention based on a class (type) and a relative resource name. The return value will be the full classpath location of the type, plus a suffix built from the name parameter:BpmnDeployer.BPMN_RESOURCE_SUFFIXES. The first resource matching a suffix will be returned.
-
annotationRequiredHistoryLevelCheck
public static boolean annotationRequiredHistoryLevelCheck(ProcessEngine processEngine, RequiredHistoryLevel annotation, java.lang.Class<?> testClass, java.lang.String methodName)
-
annotationRequiredHistoryLevelCheck
public static boolean annotationRequiredHistoryLevelCheck(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
-
annotationRequiredDatabaseCheck
public static boolean annotationRequiredDatabaseCheck(ProcessEngine processEngine, RequiredDatabase annotation, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
-
annotationRequiredDatabaseCheck
public static boolean annotationRequiredDatabaseCheck(ProcessEngine processEngine, java.lang.Class<?> testClass, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
-
getMethod
protected static java.lang.reflect.Method getMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes) throws java.lang.SecurityException, java.lang.NoSuchMethodException- Throws:
java.lang.SecurityExceptionjava.lang.NoSuchMethodException
-
assertAndEnsureCleanDbAndCache
public static void assertAndEnsureCleanDbAndCache(ProcessEngine processEngine)
Ensures that the deployment cache and database is clean after a test. If not the cache and database will be cleared.- Parameters:
processEngine- theProcessEngineto test- Throws:
java.lang.AssertionError- if the deployment cache or database was not clean
-
assertAndEnsureCleanDbAndCache
public static java.lang.String assertAndEnsureCleanDbAndCache(ProcessEngine processEngine, boolean fail)
Ensures that the deployment cache and database is clean after a test. If not the cache and database will be cleared.- Parameters:
processEngine- theProcessEngineto testfail- if true the method will throw anAssertionErrorif the deployment cache or database is not clean- Throws:
java.lang.AssertionError- if the deployment cache or database was not clean
-
fail
protected static void fail(java.lang.String message)
-
assertAndEnsureCleanDeploymentCache
public static void assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine)
Ensures that the deployment cache is empty after a test. If not the cache will be cleared.- Parameters:
processEngine- theProcessEngineto test- Throws:
java.lang.AssertionError- if the deployment cache was not clean
-
assertAndEnsureCleanDeploymentCache
public static java.lang.String assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine, boolean fail)
Ensures that the deployment cache is empty after a test. If not the cache will be cleared.- Parameters:
processEngine- theProcessEngineto testfail- if true the method will throw anAssertionErrorif the deployment cache is not clean- Returns:
- the deployment cache summary if fail is set to false or null if deployment cache was clean
- Throws:
java.lang.AssertionError- if the deployment cache was not clean and fail is set to true
-
assertAndEnsureNoProcessApplicationsRegistered
public static java.lang.String assertAndEnsureNoProcessApplicationsRegistered(ProcessEngine processEngine)
-
waitForJobExecutorToProcessAllJobs
public static void waitForJobExecutorToProcessAllJobs(ProcessEngineConfigurationImpl processEngineConfiguration, long maxMillisToWait, long intervalMillis)
-
areJobsAvailable
public static boolean areJobsAvailable(ProcessEngineConfigurationImpl processEngineConfiguration)
-
resetIdGenerator
public static void resetIdGenerator(ProcessEngineConfigurationImpl processEngineConfiguration)
-
getProcessEngine
public static ProcessEngine getProcessEngine(java.lang.String configurationResource)
-
closeProcessEngines
public static void closeProcessEngines()
-
createSchema
public static void createSchema(ProcessEngineConfigurationImpl processEngineConfiguration)
-
dropSchema
public static void dropSchema(ProcessEngineConfigurationImpl processEngineConfiguration)
-
createOrUpdateHistoryLevel
public static void createOrUpdateHistoryLevel(ProcessEngineConfigurationImpl processEngineConfiguration)
-
deleteHistoryLevel
public static void deleteHistoryLevel(ProcessEngineConfigurationImpl processEngineConfiguration)
-
clearUserOperationLog
public static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration)
-
deleteTelemetryProperty
public static void deleteTelemetryProperty(ProcessEngineConfigurationImpl processEngineConfiguration)
-
deleteInstallationId
public static void deleteInstallationId(ProcessEngineConfigurationImpl processEngineConfiguration)
-
defaultManualActivation
public static java.lang.Object defaultManualActivation()
-
-