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/rmi RmiTestCase.java RmiClientTest.java RmiServerTest.java
Date Sun, 18 Aug 2002 12:59:20 GMT
hammant     2002/08/18 05:59:20

  Modified:    altrmi   build.xml
  Added:       altrmi/src/test/org/apache/excalibur/altrmi/test/rmi
                        RmiTestCase.java
  Removed:     altrmi   rmi.xml
               altrmi/src/test/org/apache/excalibur/altrmi/test/rmi
                        RmiClientTest.java RmiServerTest.java
  Log:
  RMI UnitTest.
  
  Revision  Changes    Path
  1.32      +6 -0      jakarta-avalon-excalibur/altrmi/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build.xml	18 Aug 2002 12:04:49 -0000	1.31
  +++ build.xml	18 Aug 2002 12:59:19 -0000	1.32
  @@ -85,6 +85,12 @@
               <classpath refid="project.class.path" />
               <include name="**/*.java"/>
           </javac>
  +        
  +        <rmic base="${build.classes}"
  +            classname="org.apache.excalibur.altrmi.server.impl.rmi.RmiInovcationAdapter"
  +            stubVersion="1.2">
  +            <classpath refid="project.class.path" />    
  +        </rmic>          
   
           <!-- copy resources to same location as .class files -->
           <copy todir="${build.classes}">
  
  
  
  1.1                  jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/rmi/RmiTestCase.java
  
  Index: RmiTestCase.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.rmi;
  
  import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
  import org.apache.excalibur.altrmi.client.impl.rmi.RmiHostContext;
  import org.apache.excalibur.altrmi.client.AltrmiFactory;
  
  import org.apache.excalibur.altrmi.server.impl.rmi.RmiServer;
  import org.apache.excalibur.altrmi.server.impl.AbstractServer;
  import org.apache.excalibur.altrmi.test.TestInterface;
  import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
  import org.apache.excalibur.altrmi.test.SimpleHelloTestServerImpl;
  
  import java.rmi.registry.LocateRegistry;
  
  import junit.framework.TestCase;
  
  
  /**
   * Test RMI transport
   *
   * This test only contains a single tesXXX() method because of
   * http://developer.java.sun.com/developer/bugParade/bugs/4267864.html
   *
   * @author Paul Hammant
   */
  public class RmiTestCase extends TestCase
  {
  
      private AbstractServer server;
      private SimpleHelloTestServerImpl testServer;
      private TestInterface testClient;
  
      public RmiTestCase(String name)
      {
          super(name);
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
  
          // server side setup.
          server = new RmiServer( "127.0.0.1", 10003 );
          testServer = new SimpleHelloTestServerImpl();
          server.publish(testServer, "Hello", TestInterface.class);
          server.start();
  
          // Client side setup
          AltrmiFactory af = new ClientClassAltrmiFactory(false);
          af.setHostContext(new RmiHostContext( "127.0.0.1", 10003 ));
          testClient = (TestInterface) af.lookup("Hello");
  
          // just a kludge for unit testing given we are intrinsically dealing with
          // threads, AltRMI being a client/server thing
          Thread.yield();
      }
  
      protected void tearDown() throws Exception
      {
          server.stop();
          Thread.yield();
          server = null;
          testServer = null;
          super.tearDown();
      }
  
      public void testHelloCall() throws Exception {
          // lookup worked ?
          assertNotNull (testClient);
  
          // Invoke a method over AltRMI.
          testClient.hello("Hello!?");
  
          // test the server has logged the message.
          assertEquals("Hello!?",((SimpleHelloTestServerImpl) testServer).getStoredState("void:hello(String)"));
      }
  
  }
  
  
  

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