org.camunda.bpm.engine.impl.test
Class TestHelper

java.lang.Object
  extended by org.camunda.bpm.engine.impl.test.TestHelper

public abstract class TestHelper
extends Object

Author:
Tom Baeyens

Field Summary
static String EMPTY_LINE
           
static List<String> RESOURCE_SUFFIXES
           
static List<String> TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK
           
 
Constructor Summary
TestHelper()
           
 
Method Summary
static String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName)
           
static String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName, Deployment deploymentAnnotation)
           
static void annotationDeploymentTearDown(ProcessEngine processEngine, String deploymentId, Class<?> testClass, String methodName)
           
static boolean annotationRequiredHistoryLevelCheck(ProcessEngine processEngine, Class<?> testClass, String methodName)
           
static boolean annotationRequiredHistoryLevelCheck(ProcessEngine processEngine, org.junit.runner.Description description)
           
static boolean areJobsAvailable(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static void assertAndEnsureCleanDbAndCache(ProcessEngine processEngine)
          Ensures that the deployment cache and database is clean after a test.
static String assertAndEnsureCleanDbAndCache(ProcessEngine processEngine, boolean fail)
          Ensures that the deployment cache and database is clean after a test.
static void assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine)
          Ensures that the deployment cache is empty after a test.
static String assertAndEnsureCleanDeploymentCache(ProcessEngine processEngine, boolean fail)
          Ensures that the deployment cache is empty after a test.
static String assertAndEnsureNoProcessApplicationsRegistered(ProcessEngine processEngine)
           
static void assertProcessEnded(ProcessEngine processEngine, String processInstanceId)
          Deprecated. 
static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static void closeProcessEngines()
           
static void createOrUpdateHistoryLevel(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static void createSchema(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static void deleteDeployment(ProcessEngine processEngine, String deploymentId)
           
static void deleteHistoryLevel(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static void dropSchema(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static String getBpmnProcessDefinitionResource(Class<?> type, String name)
          get a resource location by convention based on a class (type) and a relative resource name.
protected static Method getMethod(Class<?> clazz, String methodName)
           
static ProcessEngine getProcessEngine(String configurationResource)
           
static void resetIdGenerator(ProcessEngineConfigurationImpl processEngineConfiguration)
           
static void waitForJobExecutorToProcessAllJobs(ProcessEngineConfigurationImpl processEngineConfiguration, long maxMillisToWait, long intervalMillis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_LINE

public static final String EMPTY_LINE
See Also:
Constant Field Values

TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK

public static final List<String> TABLENAMES_EXCLUDED_FROM_DB_CLEAN_CHECK

RESOURCE_SUFFIXES

public static final List<String> RESOURCE_SUFFIXES
Constructor Detail

TestHelper

public TestHelper()
Method Detail

assertProcessEnded

@Deprecated
public static void assertProcessEnded(ProcessEngine processEngine,
                                                 String processInstanceId)
Deprecated. 

use ProcessEngineAssert instead.


annotationDeploymentSetUp

public static String annotationDeploymentSetUp(ProcessEngine processEngine,
                                               Class<?> testClass,
                                               String methodName,
                                               Deployment deploymentAnnotation)

annotationDeploymentSetUp

public static String annotationDeploymentSetUp(ProcessEngine processEngine,
                                               Class<?> testClass,
                                               String methodName)

annotationDeploymentTearDown

public static void annotationDeploymentTearDown(ProcessEngine processEngine,
                                                String deploymentId,
                                                Class<?> testClass,
                                                String methodName)

deleteDeployment

public static void deleteDeployment(ProcessEngine processEngine,
                                    String deploymentId)

getBpmnProcessDefinitionResource

public static String getBpmnProcessDefinitionResource(Class<?> type,
                                                      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,
                                                          org.junit.runner.Description description)

annotationRequiredHistoryLevelCheck

public static boolean annotationRequiredHistoryLevelCheck(ProcessEngine processEngine,
                                                          Class<?> testClass,
                                                          String methodName)

getMethod

protected static Method getMethod(Class<?> clazz,
                                  String methodName)
                           throws SecurityException,
                                  NoSuchMethodException
Throws:
SecurityException
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 - the ProcessEngine to test
Throws:
AssertionError - if the deployment cache or database was not clean

assertAndEnsureCleanDbAndCache

public static 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 - the ProcessEngine to test
fail - if true the method will throw an AssertionError if the deployment cache or database is not clean
Throws:
AssertionError - if the deployment cache or database was not clean

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 - the ProcessEngine to test
Throws:
AssertionError - if the deployment cache was not clean

assertAndEnsureCleanDeploymentCache

public static 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 - the ProcessEngine to test
fail - if true the method will throw an AssertionError if 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:
AssertionError - if the deployment cache was not clean and fail is set to true

assertAndEnsureNoProcessApplicationsRegistered

public static 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(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)


Copyright © 2018 camunda services GmbH. All rights reserved.