geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol PacketStreamTest.java
Date Sat, 20 Mar 2004 23:03:06 GMT
adc         2004/03/20 15:03:06

  Modified:    modules/network/src/test/org/apache/geronimo/network/protocol
                        PacketStreamTest.java
  Log:
  Make sure the stack is properly constructed before sending info.
  
  Revision  Changes    Path
  1.2       +13 -3     incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/PacketStreamTest.java
  
  Index: PacketStreamTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/PacketStreamTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PacketStreamTest.java	18 Mar 2004 04:05:51 -0000	1.1
  +++ PacketStreamTest.java	20 Mar 2004 23:03:06 -0000	1.2
  @@ -20,6 +20,7 @@
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   
  +import EDU.oswego.cs.dl.util.concurrent.Latch;
   import junit.framework.TestCase;
   
   
  @@ -28,7 +29,8 @@
    */
   public class PacketStreamTest extends TestCase {
   
  -    EchoUpProtocol eup = new EchoUpProtocol();
  +    EchoUpProtocol eup;
  +    Latch startLatch;
       boolean failed;
   
       public void testStream() throws Exception {
  @@ -36,6 +38,8 @@
   
           PacketInputStream in = new PacketInputStream(eup);
           ObjectInputStream objIn = new ObjectInputStream(in);
  +
  +        startLatch.release();
           String msg = (String) objIn.readObject();
   
           assertEquals(msg, "Hello World!");
  @@ -47,6 +51,8 @@
   
           PacketInputStream in = new PacketInputStream(eup);
           ObjectInputStream objIn = new ObjectInputStream(in);
  +
  +        startLatch.release();
           String msg = (String) objIn.readObject();
   
           assertEquals(msg, "Hello World!");
  @@ -63,19 +69,23 @@
   
           public void run() {
               try {
  +                startLatch.acquire();
  +
                   PacketOutputStream out = new PacketOutputStream(eup, packetSize);
                   ObjectOutputStream objOut = new ObjectOutputStream(out);
                   objOut.writeObject(new String("Hello World!"));
                   objOut.flush();
               } catch (IOException e) {
                   failed = true;
  +            } catch (InterruptedException e) {
  +                failed = true;
               }
           }
       }
   
  -
       public void setUp() throws Exception {
           eup = new EchoUpProtocol();
  +        startLatch = new Latch();
           failed = false;
       }
   
  
  
  

Mime
View raw message