org.codehaus.plexus
Class PlexusTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.codehaus.plexus.PlexusTestCase
All Implemented Interfaces:
junit.framework.Test

public class PlexusTestCase
extends junit.framework.TestCase


Field Summary
 java.lang.String basedir
          Basedir for all file I/O.
(package private)  DefaultPlexusContainer container
          Plexus container to run test in.
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
PlexusTestCase(java.lang.String testName)
          Constructor.
 
Method Summary
protected  java.lang.ClassLoader getClassLoader()
          Get the classloader used by the testcase.
protected  java.io.InputStream getConfiguration()
          Get the configuration for this test.
protected  java.io.InputStream getConfiguration(java.lang.String subname)
          Retrieve the default Plexus configuration.
protected  DefaultPlexusContainer getContainer()
          Get the container container manager.
 java.io.InputStream getCustomConfiguration()
           
protected  java.io.InputStream getResourceAsStream(java.lang.String resource)
          Retrieve a test resource that is in the same package as the test case.
 java.lang.String getTestFile(java.lang.String path)
          Get test input file.
 java.lang.String getTestFile(java.lang.String basedir, java.lang.String path)
          Get test input file.
protected  java.lang.Object lookup(java.lang.String componentKey)
           
protected  java.lang.Object lookup(java.lang.String role, java.lang.String id)
           
protected  void release(java.lang.Object component)
           
 void setUp()
          Set up the test-case by starting the container.
 void tearDown()
          Tear down the test-case by stopping the container container manager..
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

container

DefaultPlexusContainer container
Plexus container to run test in.


basedir

public java.lang.String basedir
Basedir for all file I/O. Important when running tests from the reactor.

Constructor Detail

PlexusTestCase

public PlexusTestCase(java.lang.String testName)
Constructor.

Parameters:
testName -
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Set up the test-case by starting the container.

Throws:
java.lang.Exception

getCustomConfiguration

public java.io.InputStream getCustomConfiguration()
                                           throws java.lang.Exception
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Tear down the test-case by stopping the container container manager..

Throws:
java.lang.Exception

getContainer

protected DefaultPlexusContainer getContainer()
Get the container container manager.

Returns:
The container manager.

getConfiguration

protected java.io.InputStream getConfiguration()
                                        throws java.lang.Exception
Get the configuration for this test.

Returns:
Configuration for this test.
Throws:
java.lang.Exception - If an error occurs retrieve the container configuration.

getConfiguration

protected java.io.InputStream getConfiguration(java.lang.String subname)
                                        throws java.lang.Exception
Retrieve the default Plexus configuration.

Returns:
The configuration.
Throws:
java.lang.Exception

getResourceAsStream

protected java.io.InputStream getResourceAsStream(java.lang.String resource)
Retrieve a test resource that is in the same package as the test case.

Parameters:
resource - Resource to find.
Returns:
The input stream or null if the resource couldn't be located.

getClassLoader

protected java.lang.ClassLoader getClassLoader()
Get the classloader used by the testcase.

Returns:
The classloader used by test case.

lookup

protected java.lang.Object lookup(java.lang.String componentKey)
                           throws java.lang.Exception
Parameters:
componentKey -
Returns:
Throws:
java.lang.Exception

lookup

protected java.lang.Object lookup(java.lang.String role,
                                  java.lang.String id)
                           throws java.lang.Exception
Throws:
java.lang.Exception

release

protected void release(java.lang.Object component)
                throws java.lang.Exception
Throws:
java.lang.Exception

getTestFile

public java.lang.String getTestFile(java.lang.String path)
Get test input file.

Parameters:
path - Path to test input file.

getTestFile

public java.lang.String getTestFile(java.lang.String basedir,
                                    java.lang.String path)
Get test input file.

Parameters:
path - Path to test input file.