avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket CallbackEnabledCustomStreamTestCase.java CustomStreamJNDITestCase.java CustomStreamTestCase.java JSXObjectStreamTestCase.java ObjectStreamTestCase.java
Date Mon, 26 Aug 2002 10:44:09 GMT
hammant     2002/08/26 03:44:09

  Modified:    altrmi/src/java/org/apache/excalibur/altrmi/client/impl
                        DefaultProxyHelper.java
               altrmi/src/test/org/apache/excalibur/altrmi/test
                        AbstractHelloTestCase.java TestClient.java
                        TestInterface2Impl.java TestInterface3Impl.java
                        TestInterfaceImpl.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/direct
                        DirectMarshalledTestCase.java DirectTestCase.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/piped
                        PipedCustomStreamTestCase.java
                        PipedObjectStreamTestCase.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/rmi
                        RmiTestCase.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/socket
                        CallbackEnabledCustomStreamTestCase.java
                        CustomStreamJNDITestCase.java
                        CustomStreamTestCase.java
                        JSXObjectStreamTestCase.java
                        ObjectStreamTestCase.java
  Log:
  More tests using additional facades
  
  Revision  Changes    Path
  1.11      +8 -6      jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java
  
  Index: DefaultProxyHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultProxyHelper.java	24 Aug 2002 11:39:05 -0000	1.10
  +++ DefaultProxyHelper.java	26 Aug 2002 10:44:08 -0000	1.11
  @@ -8,6 +8,8 @@
   package org.apache.excalibur.altrmi.client.impl;
   
   import java.lang.reflect.Array;
  +import java.io.IOException;
  +
   import org.apache.excalibur.altrmi.client.AltrmiProxy;
   import org.apache.excalibur.altrmi.client.ProxyHelper;
   import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
  @@ -466,15 +468,15 @@
   
           synchronized( mAltrmiFactory )
           {
  -            GarbageCollectionReply gcr =
  -                (GarbageCollectionReply)mClientInvocationHandler
  +            AltrmiReply reply =
  +                mClientInvocationHandler
                   .handleInvocation( new GarbageCollectionRequest( mPublishedServiceName,
                                                                    mObjectName, mSession,
                                                                    mReferenceID ) );
  -
  -            //System.out.println("BO finalizing");
  +            if (!(reply instanceof GarbageCollectionReply)) {
  +                System.err.println("----> Some problem during DGC! Make sure factory
is closed.");
  +            }
           }
  -
           super.finalize();
       }
   }
  
  
  
  1.6       +49 -0     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/AbstractHelloTestCase.java
  
  Index: AbstractHelloTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/AbstractHelloTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractHelloTestCase.java	26 Aug 2002 08:12:34 -0000	1.5
  +++ AbstractHelloTestCase.java	26 Aug 2002 10:44:08 -0000	1.6
  @@ -8,6 +8,7 @@
   package org.apache.excalibur.altrmi.test;
   
   import org.apache.excalibur.altrmi.server.impl.AbstractServer;
  +import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import java.beans.PropertyVetoException;
   import java.io.IOException;
  @@ -24,6 +25,7 @@
       protected AbstractServer server;
       protected TestInterfaceImpl testServer;
       protected TestInterface testClient;
  +    protected AltrmiFactory altrmiFactory;
   
       public AbstractHelloTestCase(String name)
       {
  @@ -133,6 +135,53 @@
           //assertEquals(sb, sb2);
       }
   
  +    public void testBasicAdditionalFacade() throws Exception
  +    {
  +        // lookup worked ?
  +        assertNotNull(testClient);
  +
  +        TestInterface2 xyz = testClient.makeTestInterface2( "XYZ" );
  +
  +        assertEquals("XYZ",xyz.getName());
  +
  +        xyz.setName( "123" );
  +
  +        assertEquals("123",xyz.getName());
  +
  +
  +
  +    }
  +
  +    public void testAdditionalFacadeFunctionality() throws Exception
  +    {
  +        // lookup worked ?
  +        assertNotNull(testClient);
  +
  +        TestInterface3 abc = (TestInterface3) testClient.makeTestInterface2( "abc" );
  +        TestInterface2 def = testClient.makeTestInterface2( "def" );
  +
  +        testClient.morphName( abc );
  +
  +        assertEquals("A_B_C_",abc.getName());
  +
  +        TestInterface2 def2 = testClient.findTestInterface2ByName( "def" );
  +
  +        assertNotNull(def2);
  +        assertEquals(def, def2);
  +
  +        TestInterface2[] ti2s = testClient.getTestInterface2s();
  +
  +        assertNotNull(ti2s);
  +
  +        assertEquals("Array of returned testInterface2s should be two", 2,ti2s.length);
  +
  +        for (int i = 0; i < ti2s.length; i++)
  +        {
  +            TestInterface2 ti2 = ti2s[i];
  +            assertNotNull(ti2);
  +        }
  +
  +    }
   
       public void testSpeed() throws Exception
       {
  
  
  
  1.7       +1 -75     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestClient.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestClient.java	26 Aug 2002 07:55:12 -0000	1.6
  +++ TestClient.java	26 Aug 2002 10:44:08 -0000	1.7
  @@ -30,80 +30,6 @@
       public TestClient( TestInterface ti )
       {
   
  -        // it is your choice whether you catch AltrmiInvocationException or not.
  -        // If you do, you could have several strategies:
  -        // 1) around each ti. invocation.
  -        // 2) around the whole contents of the constructor
  -        // 3) in the methods that instantiate TestClient
  -        ti.hello( "howdie partner" );
  -        ti.hello2( 1234 );
  -        ti.hello2( 1235 );
  -        ti.hello2( 1236 );
  -
  -        try
  -        {
  -            ti.hello3( (short)222 );
  -        }
  -        catch( PropertyVetoException e )
  -        {
  -            System.out.println( "CLT: Client PropertyVetoException Caught " + e.getMessage()
);
  -        }
  -        catch( IOException e )
  -        {
  -            System.out.println( "CLT: Client IOException Caught " + e.getMessage() );
  -        }
  -
  -        System.out.println( "CLT: " + ti.hello4( (float)1.3, 2.1 ) );
  -        System.out.println( "CLT: Other Facade tests" );
  -
  -        TestInterface2 ti2One = ti.makeTestInterface2( "One" );
  -        TestInterface2 ti2Two = ti.makeTestInterface2( "Two" );
  -
  -        if( ti2One instanceof TestInterface3 )
  -        {
  -            System.out.println( "CLT: ti2One could be cast to TestInterface3" );
  -        }
  -        if( ti2Two instanceof TestInterface3 )
  -        {
  -            System.out.println( "CLT: ti2Two could be cast to TestInterface3" );
  -        }
  -
  -        System.out.println( "CLT: One name = '" + ti2One.getName() + "'" );
  -        System.out.println( "CLT: Two name = '" + ti2Two.getName() + "'" );
  -        System.out.println( "CLT: Changing name for One to '111'" );
  -        ti2One.setName( "111" );
  -        System.out.println( "CLT: One name = '" + ti2One.getName() + "'" );
  -        System.out.println( "CLT: Two name = '" + ti2Two.getName() + "'" );
  -        System.out.println( "CLT: Morphing Two's name via TestInterface" );
  -        ti.morphName( ti2Two );
  -        System.out.println( "CLT: One name = '" + ti2One.getName() + "'" );
  -        System.out.println( "CLT: Two name = '" + ti2Two.getName() + "'" );
  -        System.out
  -            .println( "CLT: using findByName method to find the 'One' ... actually '111'
now" );
  -
  -        TestInterface2 ti2OneB = ti.findTestInterface2ByName( "111" );
  -
  -        System.out.println( "CLT: One name = '" + ti2One.getName() + "'" );
  -        System.out.println( "CLT: Two name = '" + ti2Two.getName() + "'" );
  -        System.out.println( "CLT: One (by finder) name = '" + ti2OneB.getName() + "'" );
  -        System.out.println( "CLT: new object == (instance equality) to '111' obj ? ->
"
  -                            + ( ti2One == ti2OneB ) );
  -        System.out.println( "CLT: Test array retval of 'Alternative Facades'.." );
  -
  -        TestInterface2[] ti2s = ti.getTestInterface2s();
  -
  -        for( int i = 0; i < ti2s.length; i++ )
  -        {
  -            TestInterface2 ti2 = ti2s[ i ];
  -
  -            System.out.print( "CLT: .. ti2[" + i + "] = '" + ti2s[ i ].getName() + "'"
);
  -            if( ti2 instanceof TestInterface3 )
  -            {
  -                System.out.print( " (could be cast to TestInterface3, d.o.b = " + ( (TestInterface3)ti2
).getDOB() + " ) " );
  -            }
  -            System.out.println( "" );
  -        }
  -
           System.out.println(
               "CLT: A test for bug http://developer.java.sun.com/developer/bugParade/bugs/4499841.html"
);
   
  
  
  
  1.3       +2 -8      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterface2Impl.java
  
  Index: TestInterface2Impl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterface2Impl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestInterface2Impl.java	24 Apr 2002 12:43:03 -0000	1.2
  +++ TestInterface2Impl.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -28,10 +28,7 @@
        */
       public TestInterface2Impl( String name )
       {
  -
  -        System.out.println( "SVR: Object " + this + " created with name: '" + name + "'"
);
  -
  -        mName = name;
  +         mName = name;
       }
   
       /**
  @@ -43,10 +40,7 @@
        */
       public void setName( String newThingName )
       {
  -
           mName = newThingName;
  -
  -        System.out.println( "SVR: Object " + this + " name changed to: '" + newThingName
+ "'" );
       }
   
       /**
  
  
  
  1.3       +1 -4      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterface3Impl.java
  
  Index: TestInterface3Impl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterface3Impl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestInterface3Impl.java	24 Apr 2002 12:43:03 -0000	1.2
  +++ TestInterface3Impl.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -32,8 +32,6 @@
       {
           super( name );
   
  -        System.out.println( "SVR: ... and created with dob: '" + dob + "'" );
  -
           mDob = dob;
       }
   
  @@ -49,7 +47,6 @@
   
           mDob = dob;
   
  -        System.out.println( "SVR: Object " + this + " dob changed to: '" + dob + "'" );
       }
   
       /**
  
  
  
  1.6       +30 -23    jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterfaceImpl.java
  
  Index: TestInterfaceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterfaceImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestInterfaceImpl.java	26 Aug 2002 08:12:34 -0000	1.5
  +++ TestInterfaceImpl.java	26 Aug 2002 10:44:08 -0000	1.6
  @@ -24,27 +24,32 @@
   {
   
       Vector ti2Holder = new Vector();
  -    TestObject[] mTestObjects;
  +    TestObject[] m_testObjects;
       private int testInterface2Counter = 0;
   
       HashMap storedState = new HashMap();
   
  -    public Object getStoredState(String key) {
  +    public Object getStoredState(String key)
  +    {
           return storedState.get(key);
       }
   
  -     public void hello(String greeting) {
  +    public void hello(String greeting)
  +    {
           storedState.put("void:hello(String)", greeting);
       }
   
  -    public int hello2(int greeting) {
  +    public int hello2(int greeting)
  +    {
           storedState.put("int:hello2(int)", "" + greeting);
           return greeting;
       }
   
  -    public boolean hello3(short greeting) throws PropertyVetoException, IOException {
  +    public boolean hello3(short greeting) throws PropertyVetoException, IOException
  +    {
           storedState.put("boolean:hello3(short)", "" + greeting);
  -        switch(greeting) {
  +        switch(greeting)
  +        {
               case 90:
                   throw new PropertyVetoException("Forced Exception Test", null);
               case 91:
  @@ -53,13 +58,15 @@
           return true;
       }
   
  -    public StringBuffer hello4(float greeting1, double greeting2) {
  +    public StringBuffer hello4(float greeting1, double greeting2)
  +    {
           StringBuffer sb = new StringBuffer("" + greeting1 + " " + greeting2);
           storedState.put("StringBuffer:hello4(float,double)", sb);
           return sb;
       }
   
  -    public void testSpeed() {
  +    public void testSpeed()
  +    {
           // do nothing
       }
   
  @@ -76,7 +83,7 @@
       {
   
           TestInterface2 ti2;
  -        if( ( testInterface2Counter % 2 ) * 2 == testInterface2Counter++ )
  +        if( thingName.equals("abc") )
           {
               // even calls only
               ti2 = new TestInterface3Impl( new Date(), thingName );
  @@ -170,15 +177,15 @@
       public TestObject[] getTestObjects()
       {
   
  -        if( mTestObjects == null )
  +        if( m_testObjects == null )
           {
  -            mTestObjects = new TestObject[ 3 ];
  -            mTestObjects[ 0 ] = new TestObject( "AAA" );
  -            mTestObjects[ 1 ] = new TestObject( "BBB" );
  -            mTestObjects[ 2 ] = new TestObject( "CCC" );
  +            m_testObjects = new TestObject[ 3 ];
  +            m_testObjects[ 0 ] = new TestObject( "AAA" );
  +            m_testObjects[ 1 ] = new TestObject( "BBB" );
  +            m_testObjects[ 2 ] = new TestObject( "CCC" );
           }
   
  -        return mTestObjects;
  +        return m_testObjects;
       }
   
       /**
  @@ -189,9 +196,9 @@
       public void changeTestObjectNames()
       {
   
  -        mTestObjects[ 0 ].setName( "aaa" );
  -        mTestObjects[ 1 ].setName( "bbb" );
  -        mTestObjects[ 2 ].setName( "ccc" );
  +        m_testObjects[ 0 ].setName( "aaa" );
  +        m_testObjects[ 1 ].setName( "bbb" );
  +        m_testObjects[ 2 ].setName( "ccc" );
       }
   
       /**
  @@ -202,14 +209,14 @@
       public void makeNewTestObjectNames()
       {
   
  -        mTestObjects[ 0 ] = new TestObject( "aAa" );
  -        mTestObjects[ 1 ] = new TestObject( "bBb" );
  -        mTestObjects[ 2 ] = new TestObject( "cCc" );
  +        m_testObjects[ 0 ] = new TestObject( "aAa" );
  +        m_testObjects[ 1 ] = new TestObject( "bBb" );
  +        m_testObjects[ 2 ] = new TestObject( "cCc" );
       }
   
       protected void finalize() throws Throwable
       {
           super.finalize();
  -        System.out.println( "impl finalized" );
  +        //System.out.println( "impl finalized" );
       }
   }
  
  
  
  1.3       +14 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/direct/DirectMarshalledTestCase.java
  
  Index: DirectMarshalledTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/direct/DirectMarshalledTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DirectMarshalledTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ DirectMarshalledTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.direct.DirectMarshalledServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   
   /**
  @@ -36,13 +39,15 @@
           // server side setup.
           server = new DirectMarshalledServer();
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new DirectMarshalledHostContext((DirectMarshalledServer)server));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new DirectMarshalledHostContext((DirectMarshalledServer)server));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -51,6 +56,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.3       +14 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/direct/DirectTestCase.java
  
  Index: DirectTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/direct/DirectTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DirectTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ DirectTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.direct.DirectServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   
   /**
  @@ -36,13 +39,15 @@
           // server side setup.
           server = new DirectServer();
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new DirectHostContext(server));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new DirectHostContext(server));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -51,6 +56,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.3       +14 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedCustomStreamTestCase.java
  
  Index: PipedCustomStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedCustomStreamTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PipedCustomStreamTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ PipedCustomStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.piped.PipedCustomStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
   
   import java.io.PipedInputStream;
   import java.io.PipedOutputStream;
  @@ -39,7 +42,9 @@
           // server side setup.
           server = new PipedCustomStreamServer();
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // For piped, server and client can see each other
  @@ -48,9 +53,9 @@
           ((PipedCustomStreamServer) server).makeNewConnection(in, out);
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new PipedCustomStreamHostContext(in, out));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new PipedCustomStreamHostContext(in, out));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -59,6 +64,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.3       +15 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedObjectStreamTestCase.java
  
  Index: PipedObjectStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedObjectStreamTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PipedObjectStreamTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ PipedObjectStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.piped.PipedObjectStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   import java.io.PipedInputStream;
   import java.io.PipedOutputStream;
  @@ -39,7 +42,9 @@
           // server side setup.
           server = new PipedObjectStreamServer();
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // For piped, server and client can see each other
  @@ -48,9 +53,9 @@
           ((PipedObjectStreamServer) server).makeNewConnection(in, out);
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new PipedObjectStreamHostContext(in, out));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new PipedObjectStreamHostContext(in, out));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -59,6 +64,12 @@
   
       protected void tearDown() throws Exception
       {
  +
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.4       +6 -1      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/rmi/RmiTestCase.java
  
  Index: RmiTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/rmi/RmiTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RmiTestCase.java	26 Aug 2002 07:55:13 -0000	1.3
  +++ RmiTestCase.java	26 Aug 2002 10:44:08 -0000	1.4
  @@ -13,9 +13,12 @@
   
   import org.apache.excalibur.altrmi.server.impl.rmi.RmiServer;
   import org.apache.excalibur.altrmi.server.impl.AbstractServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   import java.rmi.registry.LocateRegistry;
   
  @@ -49,7 +52,9 @@
           // server side setup.
           server = new RmiServer( "127.0.0.1", 10003 );
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  
  
  
  1.3       +16 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CallbackEnabledCustomStreamTestCase.java
  
  Index: CallbackEnabledCustomStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CallbackEnabledCustomStreamTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CallbackEnabledCustomStreamTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ CallbackEnabledCustomStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -14,7 +14,10 @@
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   import org.apache.excalibur.altrmi.server.impl.callback.socket.CallbackEnabledSocketCustomStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   
   
   /**
  @@ -24,6 +27,8 @@
   public class CallbackEnabledCustomStreamTestCase extends AbstractHelloTestCase
   {
   
  +
  +
       public CallbackEnabledCustomStreamTestCase(String name)
       {
           super(name);
  @@ -36,13 +41,15 @@
           // server side setup.
           server = new CallbackEnabledSocketCustomStreamServer(10004);
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new CallbackEnabledSocketCustomStreamHostContext("127.0.0.1",
10004));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new CallbackEnabledSocketCustomStreamHostContext("127.0.0.1",
10004));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -51,6 +58,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.4       +15 -3     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamJNDITestCase.java
  
  Index: CustomStreamJNDITestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamJNDITestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CustomStreamJNDITestCase.java	26 Aug 2002 07:55:13 -0000	1.3
  +++ CustomStreamJNDITestCase.java	26 Aug 2002 10:44:08 -0000	1.4
  @@ -8,9 +8,12 @@
   package org.apache.excalibur.altrmi.test.socket;
   
   import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   import javax.naming.Context;
   import javax.naming.InitialContext;
  @@ -24,6 +27,8 @@
   public class CustomStreamJNDITestCase extends AbstractHelloTestCase
   {
   
  +    private Context jndiContext;
  +
       public CustomStreamJNDITestCase(String name)
       {
           super(name);
  @@ -36,7 +41,9 @@
           // server side setup.
           server = new CompleteSocketCustomStreamServer(10006);
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  @@ -50,9 +57,9 @@
           env.put( "proxy.type", "ClientSideClasses" );
           env.put( "bean.type", "NotBeanOnly" );
   
  -        Context ctx = new InitialContext( env );
  +        jndiContext = new InitialContext( env );
   
  -        testClient = (TestInterface)ctx.lookup( "Hello" );
  +        testClient = (TestInterface)jndiContext.lookup( "Hello" );
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -61,6 +68,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        jndiContext.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.3       +14 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamTestCase.java
  
  Index: CustomStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CustomStreamTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ CustomStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   
   /**
  @@ -36,13 +39,15 @@
           // server side setup.
           server = new CompleteSocketCustomStreamServer(10001);
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new SocketCustomStreamHostContext("127.0.0.1", 10001));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new SocketCustomStreamHostContext("127.0.0.1", 10001));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -51,6 +56,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.3       +14 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/JSXObjectStreamTestCase.java
  
  Index: JSXObjectStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/JSXObjectStreamTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JSXObjectStreamTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ JSXObjectStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketObjectStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   
   /**
  @@ -37,13 +40,15 @@
           // server side setup.
           server = new CompleteSocketObjectStreamServer(10009, "JSX.ObjIn", "JSX.ObjOut");
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new SocketObjectStreamHostContext("127.0.0.1", 10009, "JSX.ObjIn",
"JSX.ObjOut"));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new SocketObjectStreamHostContext("127.0.0.1", 10009,
"JSX.ObjIn", "JSX.ObjOut"));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -52,6 +57,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  
  1.3       +14 -4     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/ObjectStreamTestCase.java
  
  Index: ObjectStreamTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/ObjectStreamTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ObjectStreamTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ ObjectStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  @@ -12,9 +12,12 @@
   import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketObjectStreamServer;
  +import org.apache.excalibur.altrmi.server.PublicationDescription;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.TestInterface3;
  +import org.apache.excalibur.altrmi.test.TestInterface2;
   
   
   /**
  @@ -36,13 +39,15 @@
           // server side setup.
           server = new CompleteSocketObjectStreamServer(10002);
           testServer = new TestInterfaceImpl();
  -        server.publish(testServer, "Hello", TestInterface.class);
  +        PublicationDescription pd = new PublicationDescription(TestInterface.class,
  +                new Class[] { TestInterface3.class, TestInterface2.class });
  +        server.publish(testServer, "Hello", pd);
           server.start();
   
           // Client side setup
  -        AltrmiFactory af = new ClientClassAltrmiFactory(false);
  -        af.setHostContext(new SocketObjectStreamHostContext("127.0.0.1", 10002));
  -        testClient = (TestInterface) af.lookup("Hello");
  +        altrmiFactory = new ClientClassAltrmiFactory(false);
  +        altrmiFactory.setHostContext(new SocketObjectStreamHostContext("127.0.0.1", 10002));
  +        testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing with
           // threads, AltRMI being a client/server thing
  @@ -51,6 +56,11 @@
   
       protected void tearDown() throws Exception
       {
  +        testClient = null;
  +        System.gc();
  +        Thread.yield();
  +        altrmiFactory.close();
  +        Thread.yield();
           server.stop();
           Thread.yield();
           server = null;
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message