crafterm 2002/10/08 05:49:22
Modified: xfc/src/test/org/apache/excalibur/xfc/test/util
ECMTestRig.java
xfc/src/test/org/apache/excalibur/xfc/test xfcTestCase.java
xfc/src/java/org/apache/excalibur/xfc/modules ECM.java
xfc default.properties build.xml
Log:
* Added method to test class handler analysis in the ECM module.
* Fixed a class handler analysis bug discovered by this method! :)
Revision Changes Path
1.3 +7 -1
jakarta-avalon-excalibur/xfc/src/test/org/apache/excalibur/xfc/test/util/ECMTestRig.java
Index: ECMTestRig.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xfc/src/test/org/apache/excalibur/xfc/test/util/ECMTestRig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ECMTestRig.java 8 Oct 2002 10:39:37 -0000 1.2
+++ ECMTestRig.java 8 Oct 2002 12:49:22 -0000 1.3
@@ -68,6 +68,12 @@
{
return super.buildRole( roleref );
}
+
+ public String getHandler( final String classname )
+ throws Exception
+ {
+ return super.getHandler( classname );
+ }
}
1.4 +45 -4
jakarta-avalon-excalibur/xfc/src/test/org/apache/excalibur/xfc/test/xfcTestCase.java
Index: xfcTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xfc/src/test/org/apache/excalibur/xfc/test/xfcTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xfcTestCase.java 8 Oct 2002 10:39:38 -0000 1.3
+++ xfcTestCase.java 8 Oct 2002 12:49:22 -0000 1.4
@@ -90,7 +90,7 @@
// misc internals
private DefaultConfigurationBuilder m_builder = new
DefaultConfigurationBuilder();
- private Logger m_logger = new NullLogger();
+ private Logger m_logger = new ConsoleLogger();
public xfcTestCase()
{
@@ -245,7 +245,7 @@
public void testXFC_Fortress_generate()
throws Exception
{
- // create an ECM module test rig instance
+ // create a Fortress module test rig instance
FortressTestRig ecm = new FortressTestRig();
ecm.enableLogging( m_logger );
@@ -315,7 +315,7 @@
{
String FORTRESS_ROLES_GENERATED = "fortress-generated.roles";
- // create an ECM module test rig instance
+ // create a Fortress module test rig instance
FortressTestRig ecm = new FortressTestRig();
ecm.enableLogging( m_logger );
@@ -336,6 +336,47 @@
);
// all done, good show
+ }
+
+ /**
+ * Method to test class handler analysis on the ECM module. ECM roles
+ * do not specify component handlers like Fortress roles do, so the ECM
+ * module examines the given class to find out what handler it should use.
+ *
+ * @exception Exception if an error occurs
+ */
+ public void testXFC_ECM_ClassHandlerAnalysis()
+ throws Exception
+ {
+ // create an ECM module instance
+ ECMTestRig ecm = new ECMTestRig();
+ ecm.enableLogging( m_logger );
+
+ // input classes to analyse
+ final String[] classes =
+ {
+ "org.apache.avalon.excalibur.xml.JaxpParser",
+ "org.apache.avalon.excalibur.xml.xslt.XSLTProcessorImpl",
+ "org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl",
+ };
+
+ // actual handlers these classes should use
+ final String[] handlers =
+ {
+ "pooled", //
org.apache.excalibur.fortress.handler.PoolableComponentHandler
+ "transient", //
org.apache.excalibur.fortress.handler.FactoryComponentHandler
+ "singleton", //
org.apache.excalibur.fortress.handler.ThreadSafeComponentHandler
+ };
+
+ for ( int i = 0; i < classes.length; ++i )
+ {
+ String result = ecm.getHandler( classes[i] );
+ assertTrue(
+ "Class handler analysis failed for :" + classes[i] +
+ ", expected was '" + handlers[i] + "', received was '" + result +
"'",
+ handlers[i].equals( result )
+ );
+ }
}
public static final void main( String[] args )
1.6 +7 -5
jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/modules/ECM.java
Index: ECM.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/xfc/src/java/org/apache/excalibur/xfc/modules/ECM.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ECM.java 8 Oct 2002 10:40:30 -0000 1.5
+++ ECM.java 8 Oct 2002 12:49:22 -0000 1.6
@@ -90,9 +90,9 @@
private static final String THREADSAFE =
"org.apache.avalon.framework.thread.ThreadSafe";
private static final String POOLABLE =
- "org.apache.avalon.excalibur.mpool.Poolable";
+ "org.apache.avalon.excalibur.pool.Poolable";
private static final String RECYCLABLE =
- "org.apache.avalon.excalibur.mpool.Recyclable";
+ "org.apache.avalon.excalibur.pool.Recyclable";
// ExcaliburComponentSelector name
private static final String ECS =
@@ -334,9 +334,11 @@
for ( int i = 0; i < interfaces.length; ++i )
{
- if ( m_handlers.containsKey( interfaces[ i ] ) )
+ String interfaze = interfaces[i].getName();
+
+ if ( m_handlers.containsKey( interfaze ) )
{
- return (String) m_handlers.get( interfaces[ i ] );
+ return (String) m_handlers.get( interfaze );
}
}
1.3 +15 -0 jakarta-avalon-excalibur/xfc/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/xfc/default.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- default.properties 7 Oct 2002 17:14:53 -0000 1.2
+++ default.properties 8 Oct 2002 12:49:22 -0000 1.3
@@ -36,6 +36,21 @@
excalibur-configuration.lib=${excalibur-configuration.home}/build/lib
excalibur-configuration.jar=${excalibur-configuration.lib}/excalibur-configuration-1.0.jar
+# ----- Excalibur XMLUtil -----
+excalibur-xmlutil.home=${basedir}/../xmlutil
+excalibur-xmlutil.lib=${excalibur-xmlutil.home}/build/lib
+excalibur-xmlutil.jar=${excalibur-xmlutil.lib}/excalibur-xmlutil-1.0.jar
+
+# ----- Excalibur Pool -----
+excalibur-pool.home=${basedir}/../pool
+excalibur-pool.lib=${excalibur-pool.home}/build/lib
+excalibur-pool.jar=${excalibur-pool.lib}/excalibur-pool-1.1.jar
+
+# ----- Excalibur SourceResolve -----
+excalibur-sourceresolve.home=${basedir}/../sourceresolve
+excalibur-sourceresolve.lib=${excalibur-sourceresolve.home}/build/lib
+excalibur-sourceresolve.jar=${excalibur-sourceresolve.lib}/excalibur-sourceresolve-1.0.jar
+
# ----- Misc tools -----
tools.dir=${basedir}/../../jakarta-avalon/tools
xml-apis.jar = ${tools.dir}/lib/xml-apis.jar
1.4 +6 -0 jakarta-avalon-excalibur/xfc/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/xfc/build.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.xml 7 Oct 2002 17:14:53 -0000 1.3
+++ build.xml 8 Oct 2002 12:49:22 -0000 1.4
@@ -26,6 +26,9 @@
<path id="test.class.path">
<pathelement location="${build.testclasses}"/>
<pathelement location="${excalibur-configuration.jar}"/>
+ <pathelement location="${excalibur-xmlutil.jar}"/>
+ <pathelement location="${excalibur-pool.jar}"/>
+ <pathelement location="${excalibur-sourceresolve.jar}"/>
<pathelement location="${junit.jar}"/>
<path refid="project.class.path"/>
</path>
@@ -51,6 +54,9 @@
<!-- Need the jar to prevent recursive deps. -->
<ant antfile="${depchecker.prefix}/depchecker.xml" target="checkJUnit"/>
+ <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkXMLUtil"/>
+ <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkPool"/>
+ <ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkSourceResolve"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkConfiguration"/>
</target>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>