|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader junit.runner.TestCaseClassLoader
public class TestCaseClassLoader
A custom class loader which enables the reloading of classes for each test run. The class loader can be configured with a list of package paths that should be excluded from loading. The loading of these packages is delegated to the system class loader. They will be shared across test runs.
The list of excluded package paths is specified in a properties file "excluded.properties" that is located in the same place as the TestCaseClassLoader class.
Known limitation: the TestCaseClassLoader cannot load classes from jar files.
Field Summary | |
---|---|
private String[] |
defaultExclusions
default excluded paths |
(package private) static String |
EXCLUDED_FILE
name of excluded properties file |
private Vector |
fExcluded
excluded paths |
private Vector |
fPathItems
scanned class path |
Constructor Summary | |
---|---|
TestCaseClassLoader()
Constructs a TestCaseLoader. |
|
TestCaseClassLoader(String classPath)
Constructs a TestCaseLoader. |
Method Summary | |
---|---|
private byte[] |
getClassData(File f)
|
URL |
getResource(String name)
|
InputStream |
getResourceAsStream(String name)
|
boolean |
isExcluded(String name)
|
(package private) boolean |
isJar(String pathEntry)
|
Class |
loadClass(String name,
boolean resolve)
|
private byte[] |
loadFileData(String path,
String fileName)
|
private byte[] |
loadJarData(String path,
String fileName)
|
private byte[] |
lookupClassData(String className)
|
private void |
readExcludedPackages()
|
private void |
scanPath(String classPath)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Vector fPathItems
private String[] defaultExclusions
static final String EXCLUDED_FILE
private Vector fExcluded
Constructor Detail |
---|
public TestCaseClassLoader()
public TestCaseClassLoader(String classPath)
Method Detail |
---|
private void scanPath(String classPath)
public URL getResource(String name)
getResource
in class ClassLoader
public InputStream getResourceAsStream(String name)
getResourceAsStream
in class ClassLoader
public boolean isExcluded(String name)
public Class loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
private byte[] lookupClassData(String className) throws ClassNotFoundException
ClassNotFoundException
boolean isJar(String pathEntry)
private byte[] loadFileData(String path, String fileName)
private byte[] getClassData(File f)
private byte[] loadJarData(String path, String fileName)
private void readExcludedPackages()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |