org.apache.avalon.excalibur.testcase
クラス ExcaliburTestCase
java.lang.Object
|
+--junit.framework.Assert
|
+--junit.framework.TestCase
|
+--org.apache.avalon.excalibur.testcase.ExcaliburTestCase
- すべての実装インタフェース:
- junit.framework.Test
- public class ExcaliburTestCase
- extends junit.framework.TestCase
JUnit TestCase for Avalon Components
This class will extends the JUnit TestCase class to setup an environment
to easily test Avalon Components. The following methods and instance variables
are exposed for convenience testing:
- m_logPriority
-
This variable contains the log priority of the default logger setup
at startup of the test. Overwrite the initialize() method to set a
different Priority.
- manager
-
This instance variable contains a initialized ComponentManager
according to the test case configuration file (see below)
- getLogger()
-
This method returns the default logger for this test case
The test case configuration file has the following structure:
<testcase>
<annotation>
<![CDATA[
<title>DataSourceComponent tests</title>
<para>
This is some <emphasis>text</emphasis> to
describethe tests made herein. Unfortunately the
ConfigurationBuilder used to read the test case configuration
file doesn't allow to have mixed context. This should be fixed
in a future version .
</para>
]]>
</annotation>
<logkit>
<factories>
<factory type="file" class="org.apache.avalon.excalibur.logger.facatory.FileTargetFactory"/>
<factory type="property-filter" class="org.apache.avalon.excalibur.logger.facatory.FilterTargetFactory"/>
<factory type="servlet" class="org.apache.avalon.excalibur.logger.facatory.ServletTargetFactory"/>
...
</factories>
<targets>
<file id="root">
<filename>dev/logs/main.log</filename>
</file>
<file id="classloader">
<filename>dev/logs/classloader.log</filename>
</file>
<priority-filter id="servlet" log-level="ERROR">
<servlet/>
</priority-filter>
</targets>
<categories>
<category name="cocoon" log-level="INFO">
<log-target id-ref="root"/>
<log-target id-ref="servlet"/>
<category name="classloader" log-level="DEBUG">
<log-target id-ref="classloader"/>
</category>
</category>
</categories>
</logkit>
<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>
- バージョン:
- $Id: ExcaliburTestCase.java,v 1.15 2001/12/11 09:53:32 jefft Exp $
- 作成者:
- Giacomo Pati
フィールドの概要 |
protected org.apache.log.Priority |
m_logPriority
|
protected org.apache.avalon.framework.component.ComponentManager |
manager
|
メソッドの概要 |
protected void |
addContext(org.apache.avalon.framework.context.DefaultContext context)
This method may be overwritten by subclasses to put additional objects
into the context programmatically. |
protected org.apache.avalon.framework.logger.LogKitLogger |
getLogEnabledLogger()
Return the logger |
protected org.apache.log.Logger |
getLogger()
Return the logger |
protected void |
prepare()
Initializes the ComponentManager
The configuration file is determined by the class name plus .xtest appended,
all '.' replaced by '/' and loaded as a resource via classpath |
protected void |
prepare(java.io.InputStream testconf)
Initializes the ComponentManager |
void |
run(junit.framework.TestResult result)
Override run so that we can have code that is run once. |
クラス junit.framework.TestCase から継承したメソッド |
countTestCases, createResult, getName, name, run, runBare, runTest, setName, setUp, tearDown, toString |
クラス junit.framework.Assert から継承したメソッド |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
m_logPriority
protected org.apache.log.Priority m_logPriority
manager
protected org.apache.avalon.framework.component.ComponentManager manager
ExcaliburTestCase
public ExcaliburTestCase(java.lang.String name)
getLogger
protected org.apache.log.Logger getLogger()
- Return the logger
getLogEnabledLogger
protected org.apache.avalon.framework.logger.LogKitLogger getLogEnabledLogger()
- Return the logger
prepare
protected void prepare()
throws java.lang.Exception
- Initializes the ComponentManager
The configuration file is determined by the class name plus .xtest appended,
all '.' replaced by '/' and loaded as a resource via classpath
prepare
protected final void prepare(java.io.InputStream testconf)
throws java.lang.Exception
- Initializes the ComponentManager
- パラメータ:
testconf
- The configuration file is passed as a InputStream
A common way to supply a InputStream is to overwrite the initialize() method
in the sub class, do there whatever is needed to get the right InputStream object
supplying a conformant xtest configuartion and pass it to this initialize method.
the mentioned initialize method is also the place to set a different logging priority
to the member variable m_logPriority.
run
public final void run(junit.framework.TestResult result)
- Override
run
so that we can have code that is run once.
- オーバーライド:
- クラス
junit.framework.TestCase
内の run
addContext
protected void addContext(org.apache.avalon.framework.context.DefaultContext context)
- This method may be overwritten by subclasses to put additional objects
into the context programmatically.
"Copyright ? 2001 Apache Jakarta Project. All Rights Reserved."