Package org.powermock.tests.utils.impl
Class AbstractCommonTestSuiteChunkerImpl
- java.lang.Object
-
- org.powermock.tests.utils.impl.AbstractCommonTestSuiteChunkerImpl
-
- All Implemented Interfaces:
TestSuiteChunker
- Direct Known Subclasses:
AbstractTestSuiteChunkerImpl
,PowerMockRuleTestSuiteChunker
public abstract class AbstractCommonTestSuiteChunkerImpl extends java.lang.Object implements TestSuiteChunker
-
-
Field Summary
Fields Modifier and Type Field Description private ArrayMerger
arrayMerger
private int
currentTestIndex
protected static int
DEFAULT_TEST_LISTENERS_SIZE
private IgnorePackagesExtractor
ignorePackagesExtractor
protected static int
INTERNAL_INDEX_NOT_FOUND
private java.util.List<TestCaseEntry>
internalSuites
protected static int
NOT_INITIALIZED
private TestClassesExtractor
prepareForTestExtractor
private TestClassesExtractor
suppressionExtractor
protected java.util.LinkedHashMap<java.lang.Integer,java.util.List<java.lang.Integer>>
testAtDelegateMapper
protected java.lang.Class<?>[]
testClasses
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCommonTestSuiteChunkerImpl(java.lang.Class<?> testClass)
protected
AbstractCommonTestSuiteChunkerImpl(java.lang.Class<?>... testClasses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
chunkClass(java.lang.Class<?> testClass)
private MockTransformer[]
createDefaultExtraMockTransformers(java.lang.Class<?> testClass, java.util.List<java.lang.reflect.Method> testMethodsThatRunOnOtherClassLoaders)
private java.lang.ClassLoader
createDefaultMockLoader(java.lang.Class<?> testClass, MockTransformer[] extraMockTransformers, java.lang.String[] ignorePackages)
private java.lang.ClassLoader
createNewClassloader(java.lang.Class<?> testClass, java.lang.String[] classesToLoadByMockClassloader, java.lang.String[] packagesToIgnore, MockTransformer... extraMockTransformers)
private void
findMethods(TestCaseEntry testCaseEntry, java.lang.Class<?> testClass)
int
getChunkSize()
Get the number of chunks defined in this suite.protected MockClassLoaderFactory
getMockClassLoaderFactory(java.lang.Class<?> testClass, java.lang.String[] preliminaryClassesToLoadByMockClassloader, java.lang.String[] packagesToIgnore, MockTransformer[] extraMockTransformers)
private java.lang.String[]
getStaticSuppressionClasses(java.lang.Class<?> testClass, java.lang.reflect.Method method)
TestChunk
getTestChunk(java.lang.reflect.Method method)
Get TestChunk for the given method.java.util.List<TestChunk>
getTestChunks()
Get all chunk entries.java.util.List<TestChunk>
getTestChunksEntries(java.lang.Class<?> testClass)
Get all chunk entries for a specific class.private boolean
hasChunkAnnotation(java.lang.reflect.Method method)
private void
initEntries(java.util.List<TestCaseEntry> entries)
private void
putMethodToChunk(TestCaseEntry testCaseEntry, java.lang.Class<?> testClass, java.lang.reflect.Method method)
protected void
registerProxyframework(java.lang.ClassLoader classLoader)
protected java.lang.Class<? extends java.lang.annotation.Annotation>
testMethodAnnotation()
private void
updatedIndexes()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.powermock.tests.utils.TestSuiteChunker
shouldExecuteTestForMethod
-
-
-
-
Field Detail
-
DEFAULT_TEST_LISTENERS_SIZE
protected static final int DEFAULT_TEST_LISTENERS_SIZE
- See Also:
- Constant Field Values
-
NOT_INITIALIZED
protected static final int NOT_INITIALIZED
- See Also:
- Constant Field Values
-
INTERNAL_INDEX_NOT_FOUND
protected static final int INTERNAL_INDEX_NOT_FOUND
- See Also:
- Constant Field Values
-
internalSuites
private final java.util.List<TestCaseEntry> internalSuites
-
prepareForTestExtractor
private final TestClassesExtractor prepareForTestExtractor
-
suppressionExtractor
private final TestClassesExtractor suppressionExtractor
-
testAtDelegateMapper
protected final java.util.LinkedHashMap<java.lang.Integer,java.util.List<java.lang.Integer>> testAtDelegateMapper
-
testClasses
protected final java.lang.Class<?>[] testClasses
-
ignorePackagesExtractor
private final IgnorePackagesExtractor ignorePackagesExtractor
-
arrayMerger
private final ArrayMerger arrayMerger
-
currentTestIndex
private int currentTestIndex
-
-
Constructor Detail
-
AbstractCommonTestSuiteChunkerImpl
protected AbstractCommonTestSuiteChunkerImpl(java.lang.Class<?> testClass) throws java.lang.Exception
- Throws:
java.lang.Exception
-
AbstractCommonTestSuiteChunkerImpl
protected AbstractCommonTestSuiteChunkerImpl(java.lang.Class<?>... testClasses) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
getChunkSize
public int getChunkSize()
Description copied from interface:TestSuiteChunker
Get the number of chunks defined in this suite.- Specified by:
getChunkSize
in interfaceTestSuiteChunker
- Returns:
- The number of chunks defined in the correct suite.
-
getTestChunks
public java.util.List<TestChunk> getTestChunks()
Description copied from interface:TestSuiteChunker
Get all chunk entries.- Specified by:
getTestChunks
in interfaceTestSuiteChunker
- Returns:
- An set of entries that contains a list of methods contained in the chunk and the class loader that loaded these methods.
-
getTestChunksEntries
public java.util.List<TestChunk> getTestChunksEntries(java.lang.Class<?> testClass)
Get all chunk entries for a specific class.- Specified by:
getTestChunksEntries
in interfaceTestSuiteChunker
- Parameters:
testClass
- The class whose chunk entries to get.- Returns:
- An set of entries that contains a list of methods contained in the chunk for the specific test class and the class loader that loaded these methods.
-
getTestChunk
public TestChunk getTestChunk(java.lang.reflect.Method method)
Description copied from interface:TestSuiteChunker
Get TestChunk for the given method.- Specified by:
getTestChunk
in interfaceTestSuiteChunker
- Parameters:
method
- - method for which test chunk should be found.- Returns:
- TestChunk for this method.
-
registerProxyframework
protected void registerProxyframework(java.lang.ClassLoader classLoader)
-
chunkClass
protected void chunkClass(java.lang.Class<?> testClass) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createDefaultMockLoader
private java.lang.ClassLoader createDefaultMockLoader(java.lang.Class<?> testClass, MockTransformer[] extraMockTransformers, java.lang.String[] ignorePackages)
-
createNewClassloader
private java.lang.ClassLoader createNewClassloader(java.lang.Class<?> testClass, java.lang.String[] classesToLoadByMockClassloader, java.lang.String[] packagesToIgnore, MockTransformer... extraMockTransformers)
-
getMockClassLoaderFactory
protected MockClassLoaderFactory getMockClassLoaderFactory(java.lang.Class<?> testClass, java.lang.String[] preliminaryClassesToLoadByMockClassloader, java.lang.String[] packagesToIgnore, MockTransformer[] extraMockTransformers)
-
createDefaultExtraMockTransformers
private MockTransformer[] createDefaultExtraMockTransformers(java.lang.Class<?> testClass, java.util.List<java.lang.reflect.Method> testMethodsThatRunOnOtherClassLoaders)
-
testMethodAnnotation
protected java.lang.Class<? extends java.lang.annotation.Annotation> testMethodAnnotation()
-
initEntries
private void initEntries(java.util.List<TestCaseEntry> entries)
-
findMethods
private void findMethods(TestCaseEntry testCaseEntry, java.lang.Class<?> testClass)
-
putMethodToChunk
private void putMethodToChunk(TestCaseEntry testCaseEntry, java.lang.Class<?> testClass, java.lang.reflect.Method method)
-
hasChunkAnnotation
private boolean hasChunkAnnotation(java.lang.reflect.Method method)
-
getStaticSuppressionClasses
private java.lang.String[] getStaticSuppressionClasses(java.lang.Class<?> testClass, java.lang.reflect.Method method)
-
updatedIndexes
private void updatedIndexes()
-
-