[jboss-cvs] JBoss Messaging SVN: r4185 - trunk/tests/src/org/jboss/messaging/tests/unit/core/util.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue May 13 17:47:07 EDT 2008
Author: clebert.suconic at jboss.com
Date: 2008-05-13 17:47:07 -0400 (Tue, 13 May 2008)
New Revision: 4185
Modified:
trunk/tests/src/org/jboss/messaging/tests/unit/core/util/VariableLatchTest.java
Log:
Adding a test to validate the timeout
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/util/VariableLatchTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/util/VariableLatchTest.java 2008-05-13 16:45:25 UTC (rev 4184)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/util/VariableLatchTest.java 2008-05-13 21:47:07 UTC (rev 4185)
@@ -60,6 +60,26 @@
latch.waitCompletion();
}
+ public void testTimeout() throws Exception
+ {
+ VariableLatch latch = new VariableLatch();
+
+ latch.up();
+
+ long start = System.currentTimeMillis();
+ try
+ {
+ latch.waitCompletion(1);
+ fail ("It was suppsoed to throw an exception");
+ }
+ catch (Exception ignored)
+ {
+ }
+ long end = System.currentTimeMillis();
+
+ assertTrue ("Timeout didn't work correctly", end - start >= 1000 && end - start < 2000);
+ }
+
/**
*
* This test will open numberOfThreads threads, and add numberOfAdds on the VariableLatch
More information about the jboss-cvs-commits
mailing list