adc 2004/03/13 08:49:47
Modified:
modules/security/src/test/org/apache/geronimo/security/network/protocol
SubjectCarryingProtocolTest.java
Log:
Fixed test locking so that the test starts after the server as completed
starting up.
Revision Changes Path
1.3 +17 -13
incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java
Index: SubjectCarryingProtocolTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/security/src/test/org/apache/geronimo/security/network/protocol/SubjectCarryingProtocolTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SubjectCarryingProtocolTest.java 10 Mar 2004 09:59:27 -0000 1.2
+++ SubjectCarryingProtocolTest.java 13 Mar 2004 16:49:47 -0000 1.3
@@ -32,7 +32,7 @@
import java.util.ArrayList;
import java.util.HashMap;
-import EDU.oswego.cs.dl.util.concurrent.Mutex;
+import EDU.oswego.cs.dl.util.concurrent.Latch;
import com.sun.security.auth.login.ConfigFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -68,8 +68,9 @@
private Subject clientSubject;
private Subject serverSubject;
- 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 {
@@ -77,15 +78,14 @@
public void test() throws Exception {
- 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 {
@@ -136,7 +136,7 @@
clientStack.doStop();
- shutdownMutex.release();
+ shutdownLatch.release();
sm.doStop();
@@ -144,6 +144,8 @@
tp.doStop();
+ stopLatch.release();
+
return null;
}
}
@@ -238,9 +240,9 @@
ssa.setAcceptorListener(pf);
ssa.doStart();
- startMutex.release();
+ startLatch.release();
- shutdownMutex.acquire();
+ shutdownLatch.acquire();
ssa.doStop();
@@ -252,14 +254,16 @@
tp.doStop();
- shutdownMutex.release();
-
return null;
}
}
public void setUp() throws Exception {
Configuration.setConfiguration(new GeronimoLoginConfiguration());
+
+ startLatch = new Latch();
+ shutdownLatch = new Latch();
+ stopLatch = new Latch();
super.setUp();