[jboss-cvs] JBoss Messaging SVN: r2420 - trunk/tests/src/org/jboss/test/messaging/jms/clustering.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Feb 24 17:49:17 EST 2007
Author: clebert.suconic at jboss.com
Date: 2007-02-24 17:49:17 -0500 (Sat, 24 Feb 2007)
New Revision: 2420
Modified:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java
Log:
Fixing testcase
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java 2007-02-24 18:10:28 UTC (rev 2419)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java 2007-02-24 22:49:17 UTC (rev 2420)
@@ -195,13 +195,7 @@
}
- // This testcase is invalid!
- // You can't close the valve until all the threads are completed...
- // or all threads are trying to close the valve.
- //
- // You can call close whenever you want.. .but you can't complete that execution
- // if there is a thread holding a readLock.
- /*public void testConcurrentClose() throws Exception
+ public void testConcurrentClose() throws Exception
{
int THREAD_COUNT = 10;
final FailoverValve valve = new FailoverValve(10000);
@@ -226,16 +220,18 @@
try
{
log.info("attempting to close");
-
valve.close();
+ log.info("First thread could close the valve");
slot[ii].put("CLOSED");
+ valve.open();
+ log.info("Firs thread opened the Valve");
}
catch(InterruptedException e)
{
log.error(e);
}
}
- }, "Closer" + i).start();
+ }, "Closer(" + i + ")").start();
}
@@ -268,6 +264,7 @@
{
log.info("attempting to close");
valve.close();
+ log.info("Second thread could close the valve");
loneSlot.put("CLOSED");
}
catch(InterruptedException e)
@@ -278,6 +275,7 @@
}, "LoneCloser").start();
+ Thread.sleep(5000);
log.info("valve should be closed by now ...");
Object o = loneSlot.poll(3000);
assertNotNull(o);
@@ -286,10 +284,10 @@
for(int i = 0; i < THREAD_COUNT; i++)
{
o = slot[i].poll(3000);
- assertNull(o);
+ assertNotNull(o);
assertEquals("CLOSED", o);
}
- } TODO: Delete this TestCase... I'm keeping it for now! */
+ }
// Package protected ----------------------------------------------------------------------------
More information about the jboss-cvs-commits
mailing list