Package org.apache.maven.scm
Class PlexusJUnit4TestCase
- java.lang.Object
-
- org.apache.maven.scm.PlexusJUnit4TestCase
-
- Direct Known Subclasses:
ScmTestCase
public class PlexusJUnit4TestCase extends Object
Based on PlexusTestCase from org.sonatype.sisu:sisu-inject-plexus. Note: this class is copied from maven-release.- Author:
- Robert Scholte
-
-
Field Summary
Fields Modifier and Type Field Description org.junit.rules.TestName
testName
-
Constructor Summary
Constructors Constructor Description PlexusJUnit4TestCase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.codehaus.plexus.configuration.PlexusConfiguration
customizeComponentConfiguration()
protected void
customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration containerConfiguration)
Allow custom test case implementations do augment the default container configuration before executing tests.protected void
customizeContext(org.codehaus.plexus.context.Context context)
static String
getBasedir()
protected ClassLoader
getClassLoader()
protected InputStream
getConfiguration()
protected InputStream
getConfiguration(String subname)
protected String
getConfigurationName(String subname)
Allow the retrieval of a container configuration that is based on the name of the test class being run.protected org.codehaus.plexus.PlexusContainer
getContainer()
protected String
getCustomConfigurationName()
com.google.inject.Module[]
getCustomModules()
Allows test to define custom modules.String
getName()
protected InputStream
getResourceAsStream(String resource)
String
getTestConfiguration()
static String
getTestConfiguration(Class<?> clazz)
static File
getTestFile(String path)
static File
getTestFile(String basedir, String path)
static String
getTestPath(String path)
static String
getTestPath(String basedir, String path)
protected <T> T
lookup(Class<T> componentClass)
protected <T> T
lookup(Class<T> componentClass, String roleHint)
protected Object
lookup(String componentKey)
protected Object
lookup(String role, String roleHint)
protected <T> Map<String,T>
lookupMap(Class<T> componentClass)
protected void
release(Object component)
void
setUp()
protected void
setupContainer()
void
tearDown()
-
-
-
Field Detail
-
testName
public org.junit.rules.TestName testName
-
-
Constructor Detail
-
PlexusJUnit4TestCase
public PlexusJUnit4TestCase()
-
-
Method Detail
-
setupContainer
protected void setupContainer()
-
getCustomModules
public com.google.inject.Module[] getCustomModules()
Allows test to define custom modules.
-
customizeContainerConfiguration
protected void customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration containerConfiguration)
Allow custom test case implementations do augment the default container configuration before executing tests.- Parameters:
containerConfiguration
-
-
customizeContext
protected void customizeContext(org.codehaus.plexus.context.Context context)
-
customizeComponentConfiguration
protected org.codehaus.plexus.configuration.PlexusConfiguration customizeComponentConfiguration()
-
getContainer
protected org.codehaus.plexus.PlexusContainer getContainer()
-
getConfiguration
protected InputStream getConfiguration() throws Exception
- Throws:
Exception
-
getConfiguration
protected InputStream getConfiguration(String subname) throws Exception
- Throws:
Exception
-
getCustomConfigurationName
protected String getCustomConfigurationName()
-
getConfigurationName
protected String getConfigurationName(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
-- Returns:
-
getResourceAsStream
protected InputStream getResourceAsStream(String resource)
-
getClassLoader
protected ClassLoader getClassLoader()
-
lookup
protected <T> T lookup(Class<T> componentClass, String roleHint) throws Exception
- Throws:
Exception
-
lookupMap
protected <T> Map<String,T> lookupMap(Class<T> componentClass) throws Exception
- Throws:
Exception
-
getTestFile
public static File getTestFile(String path)
-
getTestFile
public static File getTestFile(String basedir, String path)
-
getTestPath
public static String getTestPath(String path)
-
getTestPath
public static String getTestPath(String basedir, String path)
-
getBasedir
public static String getBasedir()
-
getTestConfiguration
public String getTestConfiguration()
-
getTestConfiguration
public static String getTestConfiguration(Class<?> clazz)
-
-