You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2002/08/26 01:20:23 UTC

cvs commit: jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket CustomStreamJNDITestCase.java CustomStreamSocketClientJNDITest.java

hammant     2002/08/25 16:20:23

  Added:       altrmi/src/test/org/apache/excalibur/altrmi/test/socket
                        CustomStreamJNDITestCase.java
  Removed:     altrmi/src/test/org/apache/excalibur/altrmi/test/socket
                        CustomStreamSocketClientJNDITest.java
  Log:
  JNDI test now a TestCase
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamJNDITestCase.java
  
  Index: CustomStreamJNDITestCase.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.socket;
  
  import org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
  import org.apache.excalibur.altrmi.test.TestInterface;
  import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
  import org.apache.excalibur.altrmi.test.SimpleHelloTestServerImpl;
  
  import javax.naming.Context;
  import javax.naming.InitialContext;
  import java.util.Hashtable;
  
  
  /**
   * Test Custom Stream over sockets.
   * @author Paul Hammant
   */
  public class CustomStreamJNDITestCase extends AbstractHelloTestCase
  {
  
      public CustomStreamJNDITestCase(String name)
      {
          super(name);
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
  
          // server side setup.
          server = new CompleteSocketCustomStreamServer(10006);
          testServer = new SimpleHelloTestServerImpl();
          server.publish(testServer, "Hello", TestInterface.class);
          server.start();
  
          // Client side setup
          // JNDI lookup.  Note there are no imports of Altrmi classes in this test.
          Hashtable env = new Hashtable();
  
          env.put(
              Context.INITIAL_CONTEXT_FACTORY,
              "org.apache.excalibur.altrmi.client.impl.naming.DefaultAltrmiInitialContextFactory" );
          env.put( Context.PROVIDER_URL, "altrmi://localhost:10006/SocketCustomStream" );
          env.put( "proxy.type", "ClientSideClasses" );
          env.put( "bean.type", "NotBeanOnly" );
  
          Context ctx = new InitialContext( env );
  
          testClient = (TestInterface)ctx.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();
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>