You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2003/03/18 13:53:40 UTC
cvs commit: avalon-phoenix/src/test/org/apache/avalon/phoenix/test/data Component3.java Component4.java
donaldp 2003/03/18 04:53:40
Modified: src/test/org/apache/avalon/phoenix/components/application/test
ApplicationTestCase.java
src/test/org/apache/avalon/phoenix/test/data Component3.java
Component4.java
Added: src/test/org/apache/avalon/phoenix/components/application/test
assembly4.xml assembly5.xml
Log:
Add in unit tests that demonstrate failure reported by TerryLaurenzo@amexbf.com (Terry Laurenzo)
Revision Changes Path
1.5 +13 -1 avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test/ApplicationTestCase.java
Index: ApplicationTestCase.java
===================================================================
RCS file: /home/cvs/avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test/ApplicationTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ApplicationTestCase.java 1 Mar 2003 08:39:15 -0000 1.4
+++ ApplicationTestCase.java 18 Mar 2003 12:53:40 -0000 1.5
@@ -44,6 +44,18 @@
runApplicationTest( "assembly3.xml" );
}
+ public void testArrayAssemblyWithDependenciesAfterUser()
+ throws Exception
+ {
+ runApplicationTest( "assembly4.xml" );
+ }
+
+ public void testMapAssemblyWithDependenciesAfterUser()
+ throws Exception
+ {
+ runApplicationTest( "assembly5.xml" );
+ }
+
private void runApplicationTest( final String config )
throws Exception
{
1.1 avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test/assembly4.xml
Index: assembly4.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
"http://jakarta.apache.org/avalon/dtds/phoenix/assembly_1.1.dtd">
<assembly>
<block class="org.apache.avalon.phoenix.test.data.Component4"
name="c3">
<provide name="c2a"
role="org.apache.avalon.phoenix.test.data.Service2{}"/>
<provide name="c2b"
role="org.apache.avalon.phoenix.test.data.Service2{}"/>
<provide name="c2c"
alias="fred"
role="org.apache.avalon.phoenix.test.data.Service2{}"/>
</block>
<block class="org.apache.avalon.phoenix.test.data.Component2"
name="c2a"/>
<block class="org.apache.avalon.phoenix.test.data.Component2"
name="c2b"/>
<block class="org.apache.avalon.phoenix.test.data.Component2"
name="c2c"/>
</assembly>
1.1 avalon-phoenix/src/test/org/apache/avalon/phoenix/components/application/test/assembly5.xml
Index: assembly5.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
"http://jakarta.apache.org/avalon/dtds/phoenix/assembly_1.1.dtd">
<assembly>
<block class="org.apache.avalon.phoenix.test.data.Component4"
name="c3">
<provide name="c2a"
role="org.apache.avalon.phoenix.test.data.Service2{}"/>
<provide name="c2b"
role="org.apache.avalon.phoenix.test.data.Service2{}"/>
<provide name="c2c"
alias="fred"
role="org.apache.avalon.phoenix.test.data.Service2{}"/>
</block>
<block class="org.apache.avalon.phoenix.test.data.Component2"
name="c2a"/>
<block class="org.apache.avalon.phoenix.test.data.Component2"
name="c2b"/>
<block class="org.apache.avalon.phoenix.test.data.Component2"
name="c2c"/>
</assembly>
1.5 +16 -3 avalon-phoenix/src/test/org/apache/avalon/phoenix/test/data/Component3.java
Index: Component3.java
===================================================================
RCS file: /home/cvs/avalon-phoenix/src/test/org/apache/avalon/phoenix/test/data/Component3.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Component3.java 2 Oct 2002 11:25:56 -0000 1.4
+++ Component3.java 18 Mar 2003 12:53:40 -0000 1.5
@@ -25,14 +25,27 @@
throws ServiceException
{
final Service2[] services =
- (Service2[]) manager.lookup( Service2[].class.getName() );
+ (Service2[])manager.lookup( Service2[].class.getName() );
System.out.println( "Passed the following services: " +
Arrays.asList( services ) );
if( 3 != services.length )
{
final String message =
"Expected to get 3 services but got " + services.length;
- throw new ServiceException( message );
+ throw new ServiceException( Service2[].class.getName(), message );
+ }
+
+ checkEntry( services, 0 );
+ checkEntry( services, 1 );
+ checkEntry( services, 2 );
+ }
+
+ private void checkEntry( final Service2[] services, final int index ) throws ServiceException
+ {
+ if( null == services[ index ] )
+ {
+ final String message = "Expected non null service entry for " + index;
+ throw new ServiceException( Service2[].class.getName(), message );
}
}
}
1.5 +8 -5 avalon-phoenix/src/test/org/apache/avalon/phoenix/test/data/Component4.java
Index: Component4.java
===================================================================
RCS file: /home/cvs/avalon-phoenix/src/test/org/apache/avalon/phoenix/test/data/Component4.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Component4.java 2 Oct 2002 11:25:56 -0000 1.4
+++ Component4.java 18 Mar 2003 12:53:40 -0000 1.5
@@ -21,11 +21,13 @@
public class Component4
implements Serviceable
{
+ private static final String KEY = Service2.ROLE + "{}";
+
public void service( final ServiceManager manager )
throws ServiceException
{
final Map services =
- (Map)manager.lookup( Service2.ROLE + "{}" );
+ (Map)manager.lookup( KEY );
System.out.println( "Passed the following services: " +
services );
@@ -34,7 +36,7 @@
{
final String message =
"Expected to get 3 services but got " + size;
- throw new ServiceException( message );
+ throw new ServiceException( KEY, message );
}
checkService( "c2a", services );
@@ -56,7 +58,8 @@
return;
}
- throw new ServiceException( "Was able to modify map " +
+ throw new ServiceException( KEY,
+ "Was able to modify map " +
"retrieved from ServiceManager" );
}
@@ -77,7 +80,7 @@
"Expected to service " + name +
" to be of type Service2 but was " +
"of type: " + service1.getClass().getName();
- throw new ServiceException( message );
+ throw new ServiceException( KEY, message );
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org