incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: incubator-altrmi/client/impl/src/test/org/apache/altrmi/client/impl/piped PipedCustomStreamHostContextTestCase.java
Date Mon, 07 Jun 2004 01:08:52 GMT
hammant     2004/06/06 18:08:52

  Modified:    client/impl/src/java/org/apache/altrmi/client/impl/stream
                        ClientCustomStreamReadWriter.java
  Added:       client/impl/src/test/org/apache/altrmi/client/impl/piped
                        PipedCustomStreamHostContextTestCase.java
  Log:
  attempt to get Piped client side tested
  
  Revision  Changes    Path
  1.3       +3 -2      incubator-altrmi/client/impl/src/java/org/apache/altrmi/client/impl/stream/ClientCustomStreamReadWriter.java
  
  Index: ClientCustomStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/client/impl/src/java/org/apache/altrmi/client/impl/stream/ClientCustomStreamReadWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClientCustomStreamReadWriter.java	8 Feb 2004 06:06:43 -0000	1.2
  +++ ClientCustomStreamReadWriter.java	7 Jun 2004 01:08:52 -0000	1.3
  @@ -100,7 +100,8 @@
               pos += read;
               cnt++;
           }
  -        return (Reply)SerializationHelper.getInstanceFromBytes( byteArray,
  +        Object reply = SerializationHelper.getInstanceFromBytes( byteArray,
                                                                         m_interfacesClassLoader
);
  +        return (Reply) reply;
       }
   }
  
  
  
  1.1                  incubator-altrmi/client/impl/src/test/org/apache/altrmi/client/impl/piped/PipedCustomStreamHostContextTestCase.java
  
  Index: PipedCustomStreamHostContextTestCase.java
  ===================================================================
  package org.apache.altrmi.client.impl.piped;
  
  import junit.framework.TestCase;
  
  import java.io.PipedInputStream;
  import java.io.PipedOutputStream;
  import java.io.IOException;
  import java.io.ObjectOutputStream;
  import java.io.ObjectInputStream;
  import java.util.Vector;
  
  import org.apache.altrmi.client.ClientInvocationHandler;
  import org.apache.altrmi.common.GarbageCollectionRequest;
  import org.apache.altrmi.common.GarbageCollectionReply;
  
  public class PipedCustomStreamHostContextTestCase extends TestCase {
  
      public void testNothing() {
      }
  
      public void doNot_testBasicPassingOfRequests() throws IOException, InterruptedException
{
  
          // Not working!
          // TODO - get working!
  
          final Vector vec = new Vector();
          PipedInputStream cis = new PipedInputStream();
          PipedOutputStream cos = new PipedOutputStream();
          PipedInputStream sis = new PipedInputStream();
          PipedOutputStream sos = new PipedOutputStream();
          sis.connect(cos);
          sos.connect(cis);
          final ObjectOutputStream oos = new ObjectOutputStream(sos);
          final ObjectInputStream ois = new ObjectInputStream(sis);
  
          new Thread(new Runnable() {
              public void run() {
                  try {
                      vec.add(ois.readObject());
                      System.out.println("in");
                      oos.writeObject(new GarbageCollectionReply());
                      System.out.println("out");
                  } catch (IOException e) {
                      vec.add(e);
                      System.out.println("e1");
                  } catch (ClassNotFoundException e) {
                      vec.add(e);
                      System.out.println("e2");
                  }
              }
          }).start();
          Thread.sleep(2000);
          PipedCustomStreamHostContext pcshc = new PipedCustomStreamHostContext.WithSimpleDefaults(cis,cos);
          pcshc.initialize();
          ClientInvocationHandler cih = pcshc.getInvocationHandler();
          assertTrue(cih.handleInvocation(new GarbageCollectionRequest()) instanceof GarbageCollectionReply);
          //assertTrue(vec.get(0) instanceof GarbageCollectionRequest);
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message