| org.apache.cocoon.core.container.ContainerTestCase
All known Subclasses: org.apache.cocoon.forms.formmodel.FieldTestCase, org.apache.cocoon.woody.datatype.DynamicSelectionListTestCase, org.apache.cocoon.forms.formmodel.GroupTestCase, org.apache.lenya.net.InetAddressUtilTest, org.apache.cocoon.components.source.impl.ZipSourceTestCase, org.apache.cocoon.woody.datatype.EnumSelectionListTestCase, org.apache.cocoon.jcr.source.JCRSourceTestCase, org.apache.lenya.transaction.TransactionTest, org.apache.cocoon.components.source.impl.WebDAVSourceTestCase, org.apache.cocoon.woody.datatype.FlowJXPathSelectionListTestCase, org.apache.lenya.cms.LenyaTestCase, org.apache.cocoon.SitemapComponentTestCase, org.apache.cocoon.forms.datatype.AbstractSelectionListTestCase,
ContainerTestCase | public class ContainerTestCase extends TestCase (Code) | | JUnit TestCase for Cocoon Components.
This class extends the JUnit TestCase class to setup an environment which
makes it possible to easily test Cocoon Components. The following methods
and instance variables are exposed for convenience testing:
- getManager()
-
This instance variable contains an initialized service manager which
can be used to lookup components configured in the test configuration
file. (see below)
- getLogger()
-
This method returns a logger for this test case. By default this
logger logs with log level DEBUG.
The following test case configuration can be used as a basis for new tests.
Detailed explanations of the configuration elements can be found after
the example.
<testcase>
<context>
<entry name="foo" value="bar"/>
<entry name="baz" class="my.context.Class"/>
</context>
<roles>
<role name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
shorthand="datasources"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="jdbc" class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
</role>
</roles>
<components>
<datasources>
<jdbc name="personell">
<pool-controller min="5" max="10"/>
<jdbc name="personnel"/>
<dburl>jdbc:odbc:test</dburl>
<user>test</user>
<password>test</password>
<driver>sun.jdbc.odbc.JdbcOdbcDriver</driver>
</jdbc>
</datasources>
</components>
</testcase>
Element Explanation:
- testcase
- Defines a test case configuration. Must contain one each of the
following elements:
annotation ,
context , roles , and components
.
- context
- Allows context properties to be set in the context passed to any
Contextualizable components.
- roles
- Roles configuration for the components configured in the
components element.
- components
- Used to configure any Components used by the test cases.
version: $Id: $ |
Inner Class :protected static class DefaultLoggerManager implements LoggerManager | |
addContext | protected void addContext(DefaultContext context)(Code) | | This method may be overwritten by subclasses to put additional objects
into the context programmatically.
|
getLogger | protected Logger getLogger()(Code) | | Return the logger
|
getManager | protected ServiceManager getManager()(Code) | | Return the service manager
|
prepare | protected void prepare() throws Exception(Code) | | Initializes the ComponentLocator
The configuration file is determined by the class name plus .xtest appended,
all '.' replaced by '/' and loaded as a resource via classpath
|
prepare | final protected void prepare(InputStream testconf) throws Exception(Code) | | Initializes the ComponentLocator
Parameters: testconf - The configuration file is passed as a InputStream A common way to supply a InputStream is to overwrite the initialize() methodin the sub class, do there whatever is needed to get the right InputStream objectsupplying a conformant xtest configuartion and pass it to this initialize method.the mentioned initialize method is also the place to set a different logging priorityto the member variable m_logPriority. |
|
|