org.apache.fulcrum.testcontainer
Class BaseUnitTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.fulcrum.testcontainer.BaseUnitTest
All Implemented Interfaces:
junit.framework.Test

public class BaseUnitTest
extends junit.framework.TestCase

Base class for unit tests for components. This version doesn't load the container until the first request for a component. This allows the tester to populate the configurationFileName and roleFileName, possible one per test.

Version:
$Id: BaseUnitTest.java 223140 2004-11-01 13:29:25Z epugh $
Author:
Eric Pugh, Quinton McCombs

Field Summary
static java.lang.String COMPONENT_APP_ROOT
          Key used in the context for defining the application root
static java.lang.String CONTAINER_ECM
           
static java.lang.String CONTAINER_YAAFI
           
static java.lang.String containerType
          Pick the default container to be Yaafi
 
Constructor Summary
BaseUnitTest(java.lang.String testName)
          Constructor for test.
 
Method Summary
protected  java.lang.String getConfigurationFileName()
          Gets the configuration file name for the container should use for this test.
protected  java.lang.String getParameterFileName()
          Gets the parameter file name for the container should use for this test.
protected  java.lang.String getRoleFileName()
          Gets the role file name for the container should use for this test.
protected  java.lang.Object lookup(java.lang.String roleName)
          Returns an instance of the named component.
protected  void release(java.lang.Object component)
          Releases the component
protected  java.lang.Object resolve(java.lang.String roleName)
          Helper method for converting to and from Merlin Unit TestCase.
protected  void setConfigurationFileName(java.lang.String configurationFileName)
          Gets the configuration file name for the container should use for this test.
protected  void setRoleFileName(java.lang.String roleFileName)
          Override the role file name for the container should use for this test.
protected  void tearDown()
          Clean up after each test is run.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTAINER_ECM

public static final java.lang.String CONTAINER_ECM
See Also:
Constant Field Values

CONTAINER_YAAFI

public static final java.lang.String CONTAINER_YAAFI
See Also:
Constant Field Values

COMPONENT_APP_ROOT

public static java.lang.String COMPONENT_APP_ROOT
Key used in the context for defining the application root


containerType

public static java.lang.String containerType
Pick the default container to be Yaafi

Constructor Detail

BaseUnitTest

public BaseUnitTest(java.lang.String testName)
Constructor for test.

Parameters:
testName - name of the test being executed
Method Detail

setConfigurationFileName

protected void setConfigurationFileName(java.lang.String configurationFileName)
Gets the configuration file name for the container should use for this test. By default it is src/test/TestComponentConfig.

Parameters:
configurationFileName -

setRoleFileName

protected void setRoleFileName(java.lang.String roleFileName)
Override the role file name for the container should use for this test. By default it is src/test/TestRoleConfig.

Parameters:
roleFileName -

tearDown

protected void tearDown()
Clean up after each test is run.

Overrides:
tearDown in class junit.framework.TestCase

getConfigurationFileName

protected java.lang.String getConfigurationFileName()
Gets the configuration file name for the container should use for this test.

Returns:
The filename of the configuration file

getRoleFileName

protected java.lang.String getRoleFileName()
Gets the role file name for the container should use for this test.

Returns:
The filename of the role configuration file

getParameterFileName

protected java.lang.String getParameterFileName()
Gets the parameter file name for the container should use for this test.

Returns:
The filename of the role configuration file

lookup

protected java.lang.Object lookup(java.lang.String roleName)
                           throws org.apache.avalon.framework.component.ComponentException
Returns an instance of the named component. Starts the container if it hasn't been started.

Parameters:
roleName - Name of the role the component fills.
Throws:
org.apache.avalon.framework.component.ComponentException - generic exception

resolve

protected java.lang.Object resolve(java.lang.String roleName)
                            throws org.apache.avalon.framework.component.ComponentException
Helper method for converting to and from Merlin Unit TestCase.

Parameters:
roleName -
Returns:
Throws:
org.apache.avalon.framework.component.ComponentException

release

protected void release(java.lang.Object component)
Releases the component

Parameters:
component -


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.