Package org.apache.fulcrum.testcontainer
Class BaseUnit5Test
java.lang.Object
org.apache.fulcrum.testcontainer.BaseUnit5Test
Alternative Base class to
BaseUnit4Test
for component tests.
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.
JUnit 5 Version of BaseUnitTest class.- Version:
- $Id$
- Author:
- Eric Pugh, Quinton McCombs
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Gets the configuration file name for the container should use for this test.int
protected jakarta.servlet.http.HttpServletRequest
Get a mock requestionprotected String
Gets the parameter file name for the container should use for this test.protected String
Gets the role file name for the container should use for this test.protected Object
Returns an instance of the named component.protected void
Releases the component.protected void
setConfigurationFileName
(String configurationFileName) Gets the configuration file name for the container should use for this test.void
setContainerType
(String containerType) protected void
setLogLevel
(int logLevel) Set the console logger levelprotected void
setRoleFileName
(String roleFileName) Override the role file name for the container should use for this test.void
tearDown()
Clean up after each test is run.
-
Field Details
-
CONTAINER_ECM
- See Also:
-
CONTAINER_YAAFI
- See Also:
-
COMPONENT_APP_ROOT
Key used in the context for defining the application root- See Also:
-
defaultLogLevel
public static final int defaultLogLevelUse INFO for ConsoleLogger- See Also:
-
attributes
Hash map to store attributes for the test -
maxInactiveInterval
public int maxInactiveIntervalset the Max inactive interval
-
-
Constructor Details
-
BaseUnit5Test
public BaseUnit5Test()Constructor for test.
-
-
Method Details
-
setConfigurationFileName
Gets the configuration file name for the container should use for this test. By default it is src/test/TestComponentConfig.- Parameters:
configurationFileName
- the location of the config file
-
setRoleFileName
Override the role file name for the container should use for this test. By default it is src/test/TestRoleConfig.- Parameters:
roleFileName
- location of the role file
-
setLogLevel
protected void setLogLevel(int logLevel) Set the console logger level- Parameters:
logLevel
- set valid logging level- See Also:
-
getLogLevel
public int getLogLevel() -
tearDown
@AfterEach public void tearDown()Clean up after each test is run. -
getConfigurationFileName
Gets the configuration file name for the container should use for this test.- Returns:
- The filename of the configuration file
-
getRoleFileName
Gets the role file name for the container should use for this test.- Returns:
- The filename of the role configuration file
-
getParameterFileName
Gets the parameter file name for the container should use for this test.- Returns:
- The filename of the role configuration file
-
lookup
protected Object lookup(String roleName) throws org.apache.avalon.framework.component.ComponentException Returns an instance of the named component. This method will also start the container if it has not been started already- Parameters:
roleName
- Name of the role the component fills.- Returns:
- instance of the component
- Throws:
org.apache.avalon.framework.component.ComponentException
- generic exception
-
release
Releases the component.- Parameters:
component
- component to be released
-
getMockRequest
protected jakarta.servlet.http.HttpServletRequest getMockRequest()Get a mock requestion- Returns:
- HttpServletRequest a mock servlet request
-
getContainerType
- Returns:
- the container type
-
setContainerType
- Parameters:
containerType
- container type to set
-