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
Date Mon, 26 Aug 2002 21:53:49 GMT
hammant     2002/08/26 14:53:49

  Modified:    altrmi   base.xml build.xml
               altrmi/src/test/org/apache/excalibur/altrmi/test
                        TestInterface.java TestInterfaceImpl.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/proxies
                        CodedProxyTestCase.java
                        CodedProxyTestInterfaceProxy.java
                        DynamicProxyTestCase.java NonProxyTestCase.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/socket
                        CallbackEnabledCustomStreamTestCase.java
  Added:       altrmi/src/test/org/apache/excalibur/altrmi/test
                        AbstractHelloCallBackTestCase.java
                        TestCallBackListener.java
  Log:
  Start of integration of Callbacks into unit tests
  
  Revision  Changes    Path
  1.5       +9 -0      jakarta-avalon-excalibur/altrmi/base.xml
  
  Index: base.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/base.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- base.xml	18 Aug 2002 12:04:49 -0000	1.4
  +++ base.xml	26 Aug 2002 21:53:48 -0000	1.5
  @@ -53,6 +53,15 @@
           <pathelement location="${build.home}/testclasses"/>            
         </classpath>
       </altrmiproxies> 
  +    
  +    <altrmiproxies genname="CallBackTestListenerImpl" srcgendir="${build.home}/genjava"

  +        classgendir="${build.home}/genclasses" verbose="true" 
  +        interfaces="org.apache.excalibur.altrmi.test.TestCallBackListener">
  +      <classpath>
  +        <pathelement location="${build.home}/classes"/>
  +        <pathelement location="${build.home}/testclasses"/>            
  +      </classpath>
  +    </altrmiproxies>     
        
     </target>
   
  
  
  
  1.37      +7 -6      jakarta-avalon-excalibur/altrmi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- build.xml	25 Aug 2002 23:44:48 -0000	1.36
  +++ build.xml	26 Aug 2002 21:53:48 -0000	1.37
  @@ -2,13 +2,14 @@
   
   <project name="Excalibur AltRMI" default="main" basedir=".">
   
  -    <property file="${user.home}/build.properties"/>
  -    <property file="${basedir}/../ant.properties"/>
  -    <property file="${basedir}/ant.properties"/>
  -    <property file="${user.home}/.ant.properties"/>
  +    <property file="ant.properties"/>
  +    <property file="${basedir}/../ant.properties"/>    
  +    <property file="${basedir}/ant.properties"/>   
       <property file="${basedir}/../default.properties"/>
  -    <property file="${basedir}/default.properties"/>
  -
  +    <property file="${basedir}/default.properties"/>    
  +    <property file="${user.home}/.ant.properties"/>
  +    <property file="default.properties"/>
  +    
       <!-- Classpath for product -->
       <path id="project.class.path">
           <pathelement location="${build.classes}"/>
  
  
  
  1.4       +10 -1     jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterface.java
  
  Index: TestInterface.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestInterface.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestInterface.java	26 Aug 2002 07:55:12 -0000	1.3
  +++ TestInterface.java	26 Aug 2002 21:53:48 -0000	1.4
  @@ -135,4 +135,13 @@
        *
        */
       void makeNewTestObjectNames();
  +
  +    /**
  +     * Method adding a client-side exposed Object
  +     */
  +    boolean addCallBackListener( TestCallBackListener testCallbackListener );
  +
  +    void ping();
  +
  +
   }
  
  
  
  1.7       +20 -2     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestInterfaceImpl.java	26 Aug 2002 10:44:08 -0000	1.6
  +++ TestInterfaceImpl.java	26 Aug 2002 21:53:48 -0000	1.7
  @@ -25,7 +25,8 @@
   
       Vector ti2Holder = new Vector();
       TestObject[] m_testObjects;
  -    private int testInterface2Counter = 0;
  +
  +    Vector listeners = new Vector();
   
       HashMap storedState = new HashMap();
   
  @@ -218,5 +219,22 @@
       {
           super.finalize();
           //System.out.println( "impl finalized" );
  +    }
  +
  +    public boolean addCallBackListener(TestCallBackListener testCallbackListener)
  +    {
  +
  +        listeners.add(testCallbackListener);
  +        return true;
  +    }
  +
  +    public void ping()
  +    {
  +        for (int i = 0; i < listeners.size(); i++)
  +        {
  +            TestCallBackListener testCallBackListener = (TestCallBackListener) listeners.elementAt(i);
  +            testCallBackListener.serverCallingClient("Ping!");
  +            testCallBackListener.serverCallingClient2(this);
  +        }
       }
   }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/AbstractHelloCallBackTestCase.java
  
  Index: AbstractHelloCallBackTestCase.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.altrmi.test;
  
  public abstract class AbstractHelloCallBackTestCase extends AbstractHelloTestCase
          implements TestCallBackListener
  {
  
      private String cbMessage;
      private TestInterface cbServer;
  
      public AbstractHelloCallBackTestCase(String name)
      {
          super(name);
      }
  
      public void notestCallBack() throws Exception
      {
          testClient.addCallBackListener(this);
          testClient.ping();
  
          assertNotNull(cbMessage);
          assertNotNull(cbServer);
          assertEquals("Hello", cbMessage);
          assertEquals(this, cbServer);
  
      }
  
      public void serverCallingClient(String message)
      {
          cbMessage = message;
      }
  
      public void serverCallingClient2(TestInterface testInterface)
      {
          cbServer = testInterface;
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/TestCallBackListener.java
  
  Index: TestCallBackListener.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.altrmi.test;
  
  /**
   * Interface CallBackTestListener
   *
   * @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
   */
  public interface TestCallBackListener
  {
      /**
       * Callback methods invoked by the server
       */
      public void serverCallingClient( String message );
  
      /**
       * Second test, that passes back a (redundant) reference to the original
       * looked up TestInterface server
       */
      public void serverCallingClient2( TestInterface testInterface );
  
  }
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/CodedProxyTestCase.java
  
  Index: CodedProxyTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/CodedProxyTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CodedProxyTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ CodedProxyTestCase.java	26 Aug 2002 21:53:49 -0000	1.3
  @@ -7,14 +7,14 @@
    */
   package org.apache.excalibur.altrmi.test.proxies;
   
  -import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.AbstractHelloCallBackTestCase;
   
   /**
    * Test Hand Coded Proxy for comparison sake
    * @author Paul Hammant
    */
  -public class CodedProxyTestCase extends AbstractHelloTestCase
  +public class CodedProxyTestCase extends AbstractHelloCallBackTestCase
   {
   
   
  
  
  
  1.4       +26 -15    jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/CodedProxyTestInterfaceProxy.java
  
  Index: CodedProxyTestInterfaceProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/CodedProxyTestInterfaceProxy.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CodedProxyTestInterfaceProxy.java	26 Aug 2002 07:55:13 -0000	1.3
  +++ CodedProxyTestInterfaceProxy.java	26 Aug 2002 21:53:49 -0000	1.4
  @@ -12,6 +12,7 @@
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.TestInterface2;
   import org.apache.excalibur.altrmi.test.TestObject;
  +import org.apache.excalibur.altrmi.test.TestCallBackListener;
   
   /**
    * Class CodedProxyTestInterfaceProxy
  @@ -23,7 +24,7 @@
   public class CodedProxyTestInterfaceProxy implements TestInterface
   {
   
  -    private TestInterface mActualImpl;
  +    private TestInterface m_actualImpl;
   
       /**
        * Constructor CodedProxyTestInterfaceProxy
  @@ -34,7 +35,7 @@
        */
       public CodedProxyTestInterfaceProxy( TestInterface actualImpl )
       {
  -        mActualImpl = actualImpl;
  +        m_actualImpl = actualImpl;
       }
   
       /**
  @@ -46,7 +47,7 @@
        */
       public void hello( String greeting )
       {
  -        mActualImpl.hello( greeting );
  +        m_actualImpl.hello( greeting );
       }
   
       /**
  @@ -58,7 +59,7 @@
        */
       public int hello2( int greeting )
       {
  -        return mActualImpl.hello2( greeting );
  +        return m_actualImpl.hello2( greeting );
       }
   
       /**
  @@ -75,7 +76,7 @@
        */
       public boolean hello3( short greeting ) throws PropertyVetoException, IOException
       {
  -        return mActualImpl.hello3( greeting );
  +        return m_actualImpl.hello3( greeting );
       }
   
       /**
  @@ -90,7 +91,7 @@
        */
       public StringBuffer hello4( float greeting1, double greeting2 )
       {
  -        return mActualImpl.hello4( greeting1, greeting2 );
  +        return m_actualImpl.hello4( greeting1, greeting2 );
       }
   
       /**
  @@ -100,7 +101,7 @@
        */
       public void testSpeed()
       {
  -        mActualImpl.testSpeed();
  +        m_actualImpl.testSpeed();
       }
   
       /**
  @@ -114,7 +115,7 @@
        */
       public TestInterface2 makeTestInterface2( String thingName )
       {
  -        return mActualImpl.makeTestInterface2( thingName );
  +        return m_actualImpl.makeTestInterface2( thingName );
       }
   
       /**
  @@ -126,7 +127,7 @@
        */
       public void morphName( TestInterface2 forThisImpl )
       {
  -        mActualImpl.morphName( forThisImpl );
  +        m_actualImpl.morphName( forThisImpl );
       }
   
       /**
  @@ -140,7 +141,7 @@
        */
       public TestInterface2 findTestInterface2ByName( String nameToFind )
       {
  -        return mActualImpl.findTestInterface2ByName( nameToFind );
  +        return m_actualImpl.findTestInterface2ByName( nameToFind );
       }
   
       /**
  @@ -152,7 +153,7 @@
        */
       public TestInterface2[] getTestInterface2s()
       {
  -        return mActualImpl.getTestInterface2s();
  +        return m_actualImpl.getTestInterface2s();
       }
   
       /**
  @@ -164,7 +165,7 @@
        */
       public TestObject[] getTestObjects()
       {
  -        return mActualImpl.getTestObjects();
  +        return m_actualImpl.getTestObjects();
       }
   
       /**
  @@ -175,7 +176,7 @@
        */
       public void changeTestObjectNames()
       {
  -        mActualImpl.changeTestObjectNames();
  +        m_actualImpl.changeTestObjectNames();
       }
   
       /**
  @@ -185,6 +186,16 @@
        */
       public void makeNewTestObjectNames()
       {
  -        mActualImpl.makeNewTestObjectNames();
  +        m_actualImpl.makeNewTestObjectNames();
  +    }
  +
  +    public boolean addCallBackListener(TestCallBackListener testCallbackListener)
  +    {
  +        return m_actualImpl.addCallBackListener(testCallbackListener);
  +    }
  +
  +    public void ping()
  +    {
  +        m_actualImpl.ping();
       }
   }
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/DynamicProxyTestCase.java
  
  Index: DynamicProxyTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/DynamicProxyTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DynamicProxyTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ DynamicProxyTestCase.java	26 Aug 2002 21:53:49 -0000	1.3
  @@ -7,15 +7,15 @@
    */
   package org.apache.excalibur.altrmi.test.proxies;
   
  -import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.AbstractHelloCallBackTestCase;
   
   /**
    * Test Dynamic Proxy (reflection) for comparison sake
    * @author Paul Hammant
    */
  -public class DynamicProxyTestCase extends AbstractHelloTestCase
  +public class DynamicProxyTestCase extends AbstractHelloCallBackTestCase
   {
   
       public DynamicProxyTestCase(String name)
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/NonProxyTestCase.java
  
  Index: NonProxyTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/proxies/NonProxyTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NonProxyTestCase.java	26 Aug 2002 07:55:13 -0000	1.2
  +++ NonProxyTestCase.java	26 Aug 2002 21:53:49 -0000	1.3
  @@ -7,14 +7,14 @@
    */
   package org.apache.excalibur.altrmi.test.proxies;
   
  -import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  +import org.apache.excalibur.altrmi.test.AbstractHelloCallBackTestCase;
   
   /**
    * Test Non Proxy for comparison sake
    * @author Paul Hammant
    */
  -public class NonProxyTestCase extends AbstractHelloTestCase
  +public class NonProxyTestCase extends AbstractHelloCallBackTestCase
   {
   
       public NonProxyTestCase(String name)
  
  
  
  1.4       +2 -3      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CallbackEnabledCustomStreamTestCase.java	26 Aug 2002 10:44:08 -0000	1.3
  +++ CallbackEnabledCustomStreamTestCase.java	26 Aug 2002 21:53:49 -0000	1.4
  @@ -9,13 +9,12 @@
   
   import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
   import org.apache.excalibur.altrmi.client.impl.callback.socket.CallbackEnabledSocketCustomStreamHostContext;
  -import org.apache.excalibur.altrmi.client.AltrmiFactory;
   
   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.test.AbstractHelloCallBackTestCase;
   import org.apache.excalibur.altrmi.server.impl.callback.socket.CallbackEnabledSocketCustomStreamServer;
   import org.apache.excalibur.altrmi.server.PublicationDescription;
   
  @@ -24,7 +23,7 @@
    * Test Custom Stream over sockets.
    * @author Paul Hammant
    */
  -public class CallbackEnabledCustomStreamTestCase extends AbstractHelloTestCase
  +public class CallbackEnabledCustomStreamTestCase extends AbstractHelloCallBackTestCase
   {
   
   
  
  
  

--
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