donaldp 2002/09/06 18:42:10
Modified: loader/src/test/org/apache/excalibur/loader/test
LoaderTestSuite.java
Added: loader/src/test/org/apache/excalibur/loader/builder/test
ReaderTestCase.java config1.xml
Log:
Start actually adding some tests.
Revision Changes Path
1.1
jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/loader/builder/test/ReaderTestCase.java
Index: ReaderTestCase.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.loader.builder.test;
import java.io.InputStream;
import junit.framework.TestCase;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.excalibur.loader.builder.ClassLoaderSetBuilder;
import org.apache.excalibur.loader.metadata.ClassLoaderSetDef;
/**
* TestCase for {@link ClassLoaderSetBuilder}.
*
* @author <a href="mailto:peter at apache.org">Peter Donald</a>
*/
public class ReaderTestCase
extends TestCase
{
private static final String[] BASE_PREDEFINED =
new String[]{"*system*"};
public ReaderTestCase( final String name )
{
super( name );
}
private ClassLoaderSetDef build( final InputStream stream,
final String[] predefined )
throws Exception
{
try
{
final ClassLoaderSetBuilder builder = new ClassLoaderSetBuilder();
final Configuration config = load( stream );
return builder.build( config, predefined );
}
catch( final Exception e )
{
fail( "Error building ClassLoaderSet: " + e );
return null;
}
}
private Configuration load( final InputStream stream )
throws Exception
{
final DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
return builder.build( stream );
}
private ClassLoaderSetDef build( final String resource )
throws Exception
{
final InputStream stream = getClass().getResourceAsStream( resource );
if( null == stream )
{
fail( "Missing resource " + resource );
}
return build( stream, BASE_PREDEFINED );
}
public void testConfig1()
throws Exception
{
final ClassLoaderSetDef defs = build( "config1.xml" );
}
}
1.1
jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/loader/builder/test/config1.xml
Index: config1.xml
===================================================================
<classloaders default="join2" version="1.0">
<classloader name="cl1" parent="*system*">
<entry location="someFile.jar"/>
<entry location="someOtherFile.jar"/>
<fileset dir="someDir">
<include name="**/*.jar"/>
<include name="**/*.bar"/>
<exclude name="**/unwanted/*"/>
</fileset>
<extension>
<name>Avalon.Framework</name>
<specification-version>4.1</specification-version>
<specification-vendor>Apache</specification-vendor>
<implementation-version>4.1</implementation-version>
<implementation-vendor>Apache</implementation-vendor>
<implementation-vendor-id>Apache</implementation-vendor-id>
<implementation-url>http://jakarta...</implementation-url>
</extension>
</classloader>
<classloader name="cl2" parent="*system*">
<entry location="aFile.jar"/>
</classloader>
<join name="join1">
<classloader-ref name="cl1"/>
</join>
<join name="join2">
<classloader-ref name="cl1"/>
<classloader-ref name="cl2"/>
</join>
</classloaders>
1.2 +2 -1
jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/loader/test/LoaderTestSuite.java
Index: LoaderTestSuite.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/loader/test/LoaderTestSuite.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoaderTestSuite.java 7 Sep 2002 01:16:08 -0000 1.1
+++ LoaderTestSuite.java 7 Sep 2002 01:42:10 -0000 1.2
@@ -9,6 +9,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.excalibur.loader.builder.test.ReaderTestCase;
/**
* A basic test suite that tests all the Loader package.
@@ -18,7 +19,7 @@
public static Test suite()
{
final TestSuite suite = new TestSuite( "Loader Utilities" );
- //suite.addTest( new TestSuite( ResourceManagerTestCase.class ) );
+ suite.addTest( new TestSuite( ReaderTestCase.class ) );
return suite;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>