org.apache.myfaces.test.runners
Class TestClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.apache.myfaces.test.runners.TestClassLoader

public class TestClassLoader
extends ClassLoader

A Classloader that delegates the loading of the classes to the parent if it is in the excluded list or does it itself otherwise. Useful for a system that sets up a classloader per Test system.

Since:
1.0.0
Author:
Rudy De Busscher

Constructor Summary
TestClassLoader()
          Constructs a TestCaseLoader.
TestClassLoader(String classPath)
          Constructs a TestCaseLoader.
 
Method Summary
 URL getResource(String name)
           
 InputStream getResourceAsStream(String name)
           
 boolean isExcluded(String name)
          Checks if path is excluded.
 Class loadClass(String name, boolean resolve)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestClassLoader

public TestClassLoader()
Constructs a TestCaseLoader. It scans the class path and the excluded package paths


TestClassLoader

public TestClassLoader(String classPath)
Constructs a TestCaseLoader. It scans the class path and the excluded package paths

Method Detail

getResource

public URL getResource(String name)
Overrides:
getResource in class ClassLoader

getResourceAsStream

public InputStream getResourceAsStream(String name)
Overrides:
getResourceAsStream in class ClassLoader

isExcluded

public boolean isExcluded(String name)
Checks if path is excluded.

Parameters:
name - the name
Returns:
true, if is excluded

loadClass

public Class loadClass(String name,
                       boolean resolve)
                throws ClassNotFoundException
Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.