Package de.hybris.bootstrap.testclasses
Class TestClassesUtil
java.lang.Object
de.hybris.bootstrap.testclasses.TestClassesUtil
Gets all test classes that have hybris testing annotations
All test classes that have the standard junit @Test annotation will be treated like a
IntegrationTest.
see IntegrationTest, DemoTest and UnitTest-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumFILTER_BY_EXTENSION
If set, this filter will only allow extensions to be scanned that are in the given list.
The expected format is a single String or aCollectionof Strings -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFilter(TestClassesUtil.FILTER filter, Object filterValue) This method adds a filter to the scanning process.static voidaddTestSrcFoldersToClassPath(PlatformConfig platformConfig, groovy.lang.GroovyClassLoader ret) static TestClassesUtilcreateBootstrapInstance(PlatformConfig platformConfig) Constructs an instance in the bootstrap environment.static TestClassesUtilcreateInstance(PlatformConfig platformConfig, PlatformInPlaceClassLoader inPlaceClassLoader) static TestClassesUtilcreateIntegrationInstance(PlatformConfig platformConfig) Constructs an instance in the integrated environment.static ClassLoadercreateTestClassLoader(PlatformConfig platformConfig, ClassLoader parent) This method resets all filters and scans forBugProofTestannotated classes.This method resets all filters and scans forDemoTestannotated classes.This method resets all filters and scans forIntegrationTestannotated classes.
This method also returns classes that only have Test annotations before test methods!This method resets all filters and scans forManualTestannotated classes.This method resets all filters and scans forPerformanceTestannotated classes.This method resets all filters and scans forUnitTest,IntegrationTest,DemoTest,ManualTestandPerformanceTestannotated classes.
Classes that only have @Test annotations before methods are treated as IntegrationTests.This method resets all filters and scans forUnitTestannotated classes.Returns all test classes according to the filters that are set.getModuleClasspaths(ExtensionModule... modules) Get classpaths for selected modules.booleanmatchesPackageFilters(Class clazz) booleanmatchesPackageFilters(String string) voidClears all filters!voidsetLogging(boolean logging) voidsetWebRelated(boolean webRelated)
-
Method Details
-
createBootstrapInstance
Constructs an instance in the bootstrap environment. Where we have to emulate aPlatformInPlaceClassLoaderfor give platformConfig. -
setWebRelated
public void setWebRelated(boolean webRelated) -
createIntegrationInstance
Constructs an instance in the integrated environment. Where the full blown class loader is current for thread. Which is TestServlet in the hybrisServer or any other app server. We use original passed class loader. -
createInstance
public static TestClassesUtil createInstance(PlatformConfig platformConfig, PlatformInPlaceClassLoader inPlaceClassLoader) -
createTestClassLoader
-
addTestSrcFoldersToClassPath
public static void addTestSrcFoldersToClassPath(PlatformConfig platformConfig, groovy.lang.GroovyClassLoader ret) -
getClassLoaderForTests
-
getAllTestClasses
This method resets all filters and scans forUnitTest,IntegrationTest,DemoTest,ManualTestandPerformanceTestannotated classes.
Classes that only have @Test annotations before methods are treated as IntegrationTests.- Returns:
- returns all test classes
-
getAllWebTestClasses
-
getAllUnitTestClasses
This method resets all filters and scans forUnitTestannotated classes.- Returns:
- returns all test classes that are annotated with
UnitTest
-
getAllIntegrationTestClasses
This method resets all filters and scans forIntegrationTestannotated classes.
This method also returns classes that only have Test annotations before test methods!- Returns:
- returns all test classes that are annotated with
IntegrationTestor have at least one @Test annotation
-
getAllDemoTestClasses
This method resets all filters and scans forDemoTestannotated classes.- Returns:
- returns all test classes that are annotated with
DemoTest
-
getAllPerformanceTestClasses
This method resets all filters and scans forPerformanceTestannotated classes.- Returns:
- returns all test classes that are annotated with
PerformanceTest
-
getAllManualTestClasses
This method resets all filters and scans forManualTestannotated classes.- Returns:
- returns all test classes that are annotated with
ManualTest
-
getAllBugProofTestClasses
This method resets all filters and scans forBugProofTestannotated classes.- Returns:
- returns all test classes that are annotated with
BugProofTest
-
addFilter
This method adds a filter to the scanning process. All filters can be deleted with the resetFilter method.
Please add all filters before you finally invoke a getAllClasses() method!- Parameters:
filter- seeTestClassesUtil.FILTERfilterValue- The filterValue can either be an Object or a Collection of Objects. See description ofTestClassesUtil.FILTER
-
resetFilter
public void resetFilter()Clears all filters! -
getFilteredTestClasses
Returns all test classes according to the filters that are set. If no filters are set, the result equals to the getAllTestClasses() method!- Returns:
- the filtered test classes
-
getWebModuleClasspaths
-
getModuleClasspaths
Get classpaths for selected modules.- Parameters:
modules- List of modules to retrieve classpaths for.- Returns:
- Comma-separated list of classpaths for the selected modules. If no classpaths exist for the given modules
or if no modules were selected,
nullis returned.
-
matchesPackageFilters
-
setLogging
public void setLogging(boolean logging) -
matchesPackageFilters
-