Class TestHelper


  • public abstract class TestHelper
    extends java.lang.Object
    Author:
    Tom Baeyens
    • Field Detail

      • 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
    • Constructor Detail

      • TestHelper

        public TestHelper()
    • Method Detail

      • assertProcessEnded

        @Deprecated
        public static void assertProcessEnded​(ProcessEngine processEngine,
                                              java.lang.String processInstanceId)
        Deprecated.
        use ProcessEngineAssert instead.
      • annotationDeploymentSetUp

        public static java.lang.String annotationDeploymentSetUp​(ProcessEngine processEngine,
                                                                 java.lang.Class<?> testClass,
                                                                 java.lang.String methodName,
                                                                 Deployment deploymentAnnotation)
      • 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)
      • 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)
      • annotationRequiredDatabaseCheck

        public static boolean annotationRequiredDatabaseCheck​(ProcessEngine processEngine,
                                                              RequiredDatabase annotation,
                                                              java.lang.Class<?> testClass,
                                                              java.lang.String methodName)
      • annotationRequiredDatabaseCheck

        public static boolean annotationRequiredDatabaseCheck​(ProcessEngine processEngine,
                                                              java.lang.Class<?> testClass,
                                                              java.lang.String methodName)
      • getMethod

        protected static java.lang.reflect.Method getMethod​(java.lang.Class<?> clazz,
                                                            java.lang.String methodName)
                                                     throws java.lang.SecurityException,
                                                            java.lang.NoSuchMethodException
        Throws:
        java.lang.SecurityException
        java.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 - the ProcessEngine to 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 - the ProcessEngine to test
        fail - if true the method will throw an AssertionError if the deployment cache or database is not clean
        Throws:
        java.lang.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:
        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 - 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:
        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)
      • getProcessEngine

        public static ProcessEngine getProcessEngine​(java.lang.String configurationResource)
      • closeProcessEngines

        public static void closeProcessEngines()
      • defaultManualActivation

        public static java.lang.Object defaultManualActivation()