hammant     2002/08/24 03:05:53

  Modified:    altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped
                        PipedObjectStreamServer.java
  Added:       altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped
                        PipedCustomStreamServer.java
               altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped
                        PipedCustomStreamHostContext.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/piped
                        PipedCustomStreamTestCase.java
                        PipedObjectStreamTestCase.java
  Removed:     altrmi/src/test/org/apache/excalibur/altrmi/test/piped
                        PipedTestCase.java
  Log:
  Piped CustomStream completed, with testcases
  
  Revision  Changes    Path
  1.3       +2 -2      
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedObjectStreamServer.java
  
  Index: PipedObjectStreamServer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedObjectStreamServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PipedObjectStreamServer.java      24 Apr 2002 12:43:02 -0000      1.2
  +++ PipedObjectStreamServer.java      24 Aug 2002 10:05:52 -0000      1.3
  @@ -11,7 +11,7 @@
   import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
   
   /**
  - * Class AbstractPipedServer
  + * Class PipedObjectStreamServer
    *
    *
    * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
  
  
  
  1.1                  
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedCustomStreamServer.java
  
  Index: PipedCustomStreamServer.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.server.impl.piped;
  
  import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
  import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
  
  /**
   * Class PipedCustomStreamServer
   *
   *
   * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @version $Revision: 1.1 $
   */
  public class PipedCustomStreamServer extends AbstractPipedServer
  {
  
      protected ServerStreamReadWriter createServerStreamReadWriter()
      {
          return new ServerCustomStreamReadWriter();
      }
  }
  
  
  
  1.1                  
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedCustomStreamHostContext.java
  
  Index: PipedCustomStreamHostContext.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.client.impl.piped;
  
  import java.io.IOException;
  import java.io.PipedInputStream;
  import java.io.PipedOutputStream;
  import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
  import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
  
  /**
   * Class PipedCustomStreamHostContext
   *
   *
   * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL 
PROTECTED]</a>
   * @version $Revision: 1.1 $
   */
  public class PipedCustomStreamHostContext extends AbstractHostContext
  {
  
      /**
       * Constructor PipedCustomStreamHostContext
       *
       *
       *
       * @param is
       * @param os
       *
       * @throws AltrmiConnectionException
       *
       */
      public PipedCustomStreamHostContext( PipedInputStream is, 
PipedOutputStream os )
          throws AltrmiConnectionException
      {
          super( new PipedCustomStreamInvocationHandler( is, os ) );
      }
  
      /**
       * Method initialize
       *
       *
       * @throws IOException
       *
       */
      public void initialize() throws IOException
      {
          System.out.println( "init1" );
          ( (PipedCustomStreamInvocationHandler)mAltrmiClientInvocationHandler 
).initialize();
      }
  }
  
  
  
  1.1                  
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedCustomStreamTestCase.java
  
  Index: PipedCustomStreamTestCase.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.piped;
  
  import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
  import 
org.apache.excalibur.altrmi.client.impl.piped.PipedCustomStreamHostContext;
  import org.apache.excalibur.altrmi.client.AltrmiFactory;
  
  import org.apache.excalibur.altrmi.server.impl.piped.PipedCustomStreamServer;
  import org.apache.excalibur.altrmi.test.TestInterface;
  import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
  import org.apache.excalibur.altrmi.test.SimpleHelloTestServerImpl;
  
  import java.io.PipedInputStream;
  import java.io.PipedOutputStream;
  
  /**
   * Test Piped Trasnport (Custom Stream)
   * @author Paul Hammant
   */
  public class PipedCustomStreamTestCase extends AbstractHelloTestCase
  {
  
  
      public PipedCustomStreamTestCase(String name)
      {
          super(name);
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
  
          // server side setup.
          server = new PipedCustomStreamServer();
          testServer = new SimpleHelloTestServerImpl();
          server.publish(testServer, "Hello", TestInterface.class);
          server.start();
  
          // For piped, server and client can see each other
          PipedInputStream in = new PipedInputStream();
          PipedOutputStream out = new PipedOutputStream();
          ((PipedCustomStreamServer) server).makeNewConnection(in, out);
  
          // Client side setup
          AltrmiFactory af = new ClientClassAltrmiFactory(false);
          af.setHostContext(new PipedCustomStreamHostContext(in, out));
          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();
      }
  
  
  }
  
  
  
  1.1                  
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/piped/PipedObjectStreamTestCase.java
  
  Index: PipedObjectStreamTestCase.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.piped;
  
  import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
  import 
org.apache.excalibur.altrmi.client.impl.piped.PipedObjectStreamHostContext;
  import org.apache.excalibur.altrmi.client.AltrmiFactory;
  
  import org.apache.excalibur.altrmi.server.impl.piped.PipedObjectStreamServer;
  import org.apache.excalibur.altrmi.test.TestInterface;
  import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
  import org.apache.excalibur.altrmi.test.SimpleHelloTestServerImpl;
  
  import java.io.PipedInputStream;
  import java.io.PipedOutputStream;
  
  /**
   * Test Piped Trasnport (Object Stream)
   * @author Paul Hammant
   */
  public class PipedObjectStreamTestCase extends AbstractHelloTestCase
  {
  
  
      public PipedObjectStreamTestCase(String name)
      {
          super(name);
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
  
          // server side setup.
          server = new PipedObjectStreamServer();
          testServer = new SimpleHelloTestServerImpl();
          server.publish(testServer, "Hello", TestInterface.class);
          server.start();
  
          // For piped, server and client can see each other
          PipedInputStream in = new PipedInputStream();
          PipedOutputStream out = new PipedOutputStream();
          ((PipedObjectStreamServer) server).makeNewConnection(in, out);
  
          // Client side setup
          AltrmiFactory af = new ClientClassAltrmiFactory(false);
          af.setHostContext(new PipedObjectStreamHostContext(in, out));
          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();
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to