You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ad...@apache.org on 2004/03/13 17:50:18 UTC

cvs commit: incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol GSSAPIProtocolTest.java

adc         2004/03/13 08:50:18

  Modified:    modules/network/src/test/org/apache/geronimo/network/protocol
                        GSSAPIProtocolTest.java
  Log:
  Fixed test locking so that the test starts after the server as completed
  starting up.
  
  Revision  Changes    Path
  1.3       +16 -13    incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/GSSAPIProtocolTest.java
  
  Index: GSSAPIProtocolTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/GSSAPIProtocolTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GSSAPIProtocolTest.java	10 Mar 2004 09:59:15 -0000	1.2
  +++ GSSAPIProtocolTest.java	13 Mar 2004 16:50:18 -0000	1.3
  @@ -31,7 +31,7 @@
   import java.util.ArrayList;
   import java.util.Properties;
   
  -import EDU.oswego.cs.dl.util.concurrent.Mutex;
  +import EDU.oswego.cs.dl.util.concurrent.Latch;
   import junit.framework.TestCase;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -58,8 +58,9 @@
       private Subject clientSubject;
       private Subject serverSubject;
       private boolean hasKerberos = false;
  -    private Mutex startMutex = new Mutex();
  -    private Mutex shutdownMutex = new Mutex();
  +    private Latch startLatch;
  +    private Latch shutdownLatch;
  +    private Latch stopLatch;
       private ThreadGroup threadGroup;
   
       public void testDummy() throws Exception {
  @@ -68,15 +69,14 @@
       public void test() throws Exception {
           if (!hasKerberos) return;
   
  -        shutdownMutex.acquire();
  -
           new Thread(threadGroup, new ServerThread(serverSubject), "Geronimo server").start();
   
  -        startMutex.acquire();
  -        startMutex.release();
  +        startLatch.acquire();
   
           PrivilegedExceptionAction clientAction = new ClientAction();
           Subject.doAs(clientSubject, clientAction);
  +
  +        stopLatch.acquire();
       }
   
       class ClientAction implements PrivilegedExceptionAction {
  @@ -128,7 +128,7 @@
   
               clientStack.doStop();
   
  -            shutdownMutex.release();
  +            shutdownLatch.release();
   
               sm.doStop();
   
  @@ -136,6 +136,8 @@
   
               tp.doStop();
   
  +            stopLatch.release();
  +
               return null;
           }
       }
  @@ -235,9 +237,9 @@
               ssa.setAcceptorListener(pf);
               ssa.doStart();
   
  -            startMutex.release();
  +            startLatch.release();
   
  -            shutdownMutex.acquire();
  +            shutdownLatch.acquire();
   
               ssa.doStop();
   
  @@ -249,13 +251,14 @@
   
               tp.doStop();
   
  -            shutdownMutex.release();
  -
               return null;
           }
       }
   
       public void setUp() throws Exception {
  +        startLatch = new Latch();
  +        shutdownLatch = new Latch();
  +        stopLatch = new Latch();
           try {
               properties = new Properties();
               try {