Package org.codehaus.plexus
Class PlexusJUnit4TestCase
- java.lang.Object
-
- org.codehaus.plexus.PlexusJUnit4TestCase
-
public abstract class PlexusJUnit4TestCase extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Stringbasedirprivate PlexusContainercontainer
-
Constructor Summary
Constructors Constructor Description PlexusJUnit4TestCase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterTest()voidbeforeTest()protected PlexusConfigurationcustomizeComponentConfiguration()protected voidcustomizeContainerConfiguration(ContainerConfiguration containerConfiguration)Allow custom test case implementations do augment the default container configuration before executing tests.protected voidcustomizeContext(Context context)static java.lang.StringgetBasedir()protected java.lang.ClassLoadergetClassLoader()protected java.io.InputStreamgetConfiguration()protected java.io.InputStreamgetConfiguration(java.lang.String subname)protected java.lang.StringgetConfigurationName(java.lang.String subname)Allow the retrieval of a container configuration that is based on the name of the test class being run.protected PlexusContainergetContainer()protected java.lang.StringgetCustomConfigurationName()protected java.io.InputStreamgetResourceAsStream(java.lang.String resource)java.lang.StringgetTestConfiguration()static java.lang.StringgetTestConfiguration(java.lang.Class<?> clazz)static java.io.FilegetTestFile(java.lang.String path)static java.io.FilegetTestFile(java.lang.String basedir, java.lang.String path)static java.lang.StringgetTestPath(java.lang.String path)static java.lang.StringgetTestPath(java.lang.String basedir, java.lang.String path)protected <T> Tlookup(java.lang.Class<T> componentClass)protected <T> Tlookup(java.lang.Class<T> componentClass, java.lang.String roleHint)protected java.lang.Objectlookup(java.lang.String componentKey)protected java.lang.Objectlookup(java.lang.String role, java.lang.String roleHint)protected voidrelease(java.lang.Object component)protected voidsetupContainer()
-
-
-
Field Detail
-
container
private PlexusContainer container
-
basedir
private static java.lang.String basedir
-
-
Method Detail
-
beforeTest
public void beforeTest() throws java.lang.Exception- Throws:
java.lang.Exception
-
setupContainer
protected void setupContainer()
-
customizeContainerConfiguration
protected void customizeContainerConfiguration(ContainerConfiguration containerConfiguration)
Allow custom test case implementations do augment the default container configuration before executing tests.- Parameters:
containerConfiguration- The configuration
-
customizeContext
protected void customizeContext(Context context)
-
customizeComponentConfiguration
protected PlexusConfiguration customizeComponentConfiguration()
-
afterTest
public void afterTest() throws java.lang.Exception- Throws:
java.lang.Exception
-
getContainer
protected PlexusContainer getContainer()
-
getConfiguration
protected java.io.InputStream getConfiguration()
-
getConfiguration
protected java.io.InputStream getConfiguration(java.lang.String subname)
-
getCustomConfigurationName
protected java.lang.String getCustomConfigurationName()
-
getConfigurationName
protected java.lang.String getConfigurationName(java.lang.String subname)
Allow the retrieval of a container configuration that is based on the name of the test class being run. So if you have a test class called org.foo.FunTest, then this will produce a resource name of org/foo/FunTest.xml which would be used to configure the Plexus container before running your test.- Parameters:
subname- the subname (not used)- Returns:
- A configuration name
-
getResourceAsStream
protected java.io.InputStream getResourceAsStream(java.lang.String resource)
-
getClassLoader
protected java.lang.ClassLoader getClassLoader()
-
lookup
protected java.lang.Object lookup(java.lang.String componentKey)
-
lookup
protected java.lang.Object lookup(java.lang.String role, java.lang.String roleHint) throws ComponentLookupRuntimeException- Throws:
ComponentLookupRuntimeException
-
lookup
protected <T> T lookup(java.lang.Class<T> componentClass) throws ComponentLookupRuntimeException- Throws:
ComponentLookupRuntimeException
-
lookup
protected <T> T lookup(java.lang.Class<T> componentClass, java.lang.String roleHint) throws ComponentLookupRuntimeException- Throws:
ComponentLookupRuntimeException
-
release
protected void release(java.lang.Object component) throws java.lang.Exception- Throws:
java.lang.Exception
-
getTestFile
public static java.io.File getTestFile(java.lang.String path)
-
getTestFile
public static java.io.File getTestFile(java.lang.String basedir, java.lang.String path)
-
getTestPath
public static java.lang.String getTestPath(java.lang.String path)
-
getTestPath
public static java.lang.String getTestPath(java.lang.String basedir, java.lang.String path)
-
getBasedir
public static java.lang.String getBasedir()
-
getTestConfiguration
public java.lang.String getTestConfiguration()
-
getTestConfiguration
public static java.lang.String getTestConfiguration(java.lang.Class<?> clazz)
-
-