|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl<T>
public abstract class AbstractTestSuiteChunkerImpl<T>
Abstract base class for test suite chunking, i.e. a suite is chunked into
several smaller pieces which are ran with different classloaders. A chunk is
defined by the PrepareForTest annotation. This to make sure that you
can byte-code manipulate classes in tests without impacting on other tests.
| Field Summary | |
|---|---|
protected java.util.List<T> |
delegates
|
protected java.util.Set<java.lang.Class<?>> |
delegatesCreatedForTheseClasses
|
protected static int |
NOT_INITIALIZED
|
protected TestClassesExtractor |
prepareForTestExtractor
|
protected TestClassesExtractor |
suppressionExtractor
|
protected java.util.LinkedHashMap<java.lang.Integer,java.util.List<java.lang.Integer>> |
testAtDelegateMapper
|
protected int |
testCount
|
| Constructor Summary | |
|---|---|
protected |
AbstractTestSuiteChunkerImpl(java.lang.Class<?>... testClasses)
|
protected |
AbstractTestSuiteChunkerImpl(java.lang.Class<?> testClass)
|
| Method Summary | |
|---|---|
protected void |
chunkClass(java.lang.Class<?> testClass)
|
protected abstract T |
createDelegatorFromClassloader(java.lang.ClassLoader classLoader,
java.lang.Class<?> testClass,
java.util.List<java.lang.reflect.Method> methodsToTest)
|
java.lang.ClassLoader |
createNewClassloader(java.lang.Class<?> testClass,
java.lang.String[] classesToLoadByMockClassloader,
java.lang.String[] packagesToIgnore)
Create a new class loader and load classes from this
classloader. |
void |
createTestDelegators(java.lang.Class<?> testClass,
java.util.List<TestChunk> chunks)
Create the test delegators needed for a whole class. |
int |
getChunkSize()
Get the number of chunks defined in this suite. |
int |
getDelegatorIndex(int testIndex)
Get the junit runner delegate that handles the test at index testIndex. |
int |
getInternalTestIndex(int originalTestIndex)
Get the internal test index for a junit runner delegate based on the "real" original test index. |
protected java.lang.Object |
getPowerMockTestListenersLoadedByASpecificClassLoader(java.lang.Class<?> clazz,
java.lang.ClassLoader classLoader)
|
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. |
java.lang.Class<?>[] |
getTestClasses()
|
protected boolean |
hasMockPolicyProvidedClasses(java.lang.Class<?> testClass)
|
| 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 |
|---|
getTestCount, shouldExecuteTestForMethod |
| Field Detail |
|---|
protected static final int NOT_INITIALIZED
protected final TestClassesExtractor prepareForTestExtractor
protected final TestClassesExtractor suppressionExtractor
protected final java.util.Set<java.lang.Class<?>> delegatesCreatedForTheseClasses
protected final java.util.List<T> delegates
protected final java.util.LinkedHashMap<java.lang.Integer,java.util.List<java.lang.Integer>> testAtDelegateMapper
protected volatile int testCount
| Constructor Detail |
|---|
protected AbstractTestSuiteChunkerImpl(java.lang.Class<?> testClass)
throws java.lang.Exception
java.lang.Exception
protected AbstractTestSuiteChunkerImpl(java.lang.Class<?>... testClasses)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
protected java.lang.Object getPowerMockTestListenersLoadedByASpecificClassLoader(java.lang.Class<?> clazz,
java.lang.ClassLoader classLoader)
protected void chunkClass(java.lang.Class<?> testClass)
throws java.lang.Exception
java.lang.Exception
public java.lang.ClassLoader createNewClassloader(java.lang.Class<?> testClass,
java.lang.String[] classesToLoadByMockClassloader,
java.lang.String[] packagesToIgnore)
TestSuiteChunkerclasses from this
classloader.
createNewClassloader in interface TestSuiteChunkertestClass - TODOclassesToLoadByMockClassloader - An array of the fully qualified name of the classes to modify.packagesToIgnore - Packages to ignore.
public void createTestDelegators(java.lang.Class<?> testClass,
java.util.List<TestChunk> chunks)
throws java.lang.Exception
createTestDelegators in interface TestSuiteChunkerjava.lang.Exception
protected abstract T createDelegatorFromClassloader(java.lang.ClassLoader classLoader,
java.lang.Class<?> testClass,
java.util.List<java.lang.reflect.Method> methodsToTest)
throws java.lang.Exception
java.lang.Exceptionpublic int getChunkSize()
TestSuiteChunker
getChunkSize in interface TestSuiteChunkerpublic java.util.List<TestChunk> getTestChunks()
TestSuiteChunker
getTestChunks in interface TestSuiteChunkerpublic int getInternalTestIndex(int originalTestIndex)
originalTestIndex - The original test index as seen by the test runner.
-1
if no index was found.public int getDelegatorIndex(int testIndex)
testIndex. Throws a RuntimeException if a delegator
is not found for the specific test index.
testIndex - The test index that a delegator should hold.
public java.util.List<TestChunk> getTestChunksEntries(java.lang.Class<?> testClass)
getTestChunksEntries in interface TestSuiteChunkertestClass - The class whose chunk entries to get.
public java.lang.Class<?>[] getTestClasses()
protected boolean hasMockPolicyProvidedClasses(java.lang.Class<?> testClass)
true if there are some mock policies that
contributes with classes that should be loaded by the mock
classloader, false otherwise.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||