[jboss-cvs] JBossAS SVN: r100206 - projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1116/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 1 07:12:57 EST 2010


Author: wolfc
Date: 2010-02-01 07:12:57 -0500 (Mon, 01 Feb 2010)
New Revision: 100206

Modified:
   projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1116/unit/ContainerShutdownTestCase.java
Log:
EJBTHREE-1982: add timeouts to test (not a fix)

Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1116/unit/ContainerShutdownTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1116/unit/ContainerShutdownTestCase.java	2010-02-01 10:24:21 UTC (rev 100205)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1116/unit/ContainerShutdownTestCase.java	2010-02-01 12:12:57 UTC (rev 100206)
@@ -21,21 +21,21 @@
  */
 package org.jboss.ejb3.test.ejbthree1116.unit;
 
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
 import junit.framework.Test;
-
 import org.jboss.aop.DispatcherConnectException;
 import org.jboss.aop.NotFoundInDispatcherException;
 import org.jboss.ejb3.test.ejbthree1116.MyStateful;
 import org.jboss.remoting.CannotConnectException;
 import org.jboss.test.JBossTestCase;
 
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
 /**
  * Test verifying fix of EJBTHREE-1116 & EJBTHREE-1894.
  * @author Paul Ferraro
@@ -75,6 +75,8 @@
       try
       {
          bean.increment();
+
+         fail("Can't happen, MyStatefulBean is no longer deployed");
       }
       catch (RuntimeException e)
       {
@@ -104,12 +106,15 @@
          
          try
          {
-            latch.await();
+            latch.await(10, SECONDS);
             
             while (!Thread.currentThread().isInterrupted())
             {
                bean.increment();
             }
+
+            // we might get interrupted (by whom?), but lets disregard that
+            fail("Can't happen, MyStatefulBean is no longer deployed");
          }
          catch (InterruptedException e)
          {
@@ -125,7 +130,7 @@
          {
             try
             {
-               thread.join();
+               thread.join(SECONDS.toMillis(10));
             }
             catch (InterruptedException e)
             {
@@ -146,6 +151,8 @@
       try
       {
          bean.remove();
+
+         fail("Can't happen, MyStatefulBean is no longer deployed");
       }
       catch (RuntimeException e)
       {
@@ -179,12 +186,14 @@
             }
             
             latch.countDown();
-            latch.await();
+            latch.await(10, SECONDS);
             
             for (int j = 0; j < ITERATIONS; ++j)
             {
                beans[j].remove();
             }
+
+            fail("Can't happen, MyStatefulBean is no longer deployed");
          }
          catch (InterruptedException e)
          {
@@ -200,7 +209,7 @@
          {
             try
             {
-               thread.join();
+               thread.join(SECONDS.toMillis(10));
             }
             catch (InterruptedException e)
             {
@@ -218,7 +227,9 @@
       
       try
       {
-         new InitialContext().lookup("MyStatefulBean/remote");         
+         new InitialContext().lookup("MyStatefulBean/remote");
+
+         fail("Can't happen, MyStatefulBean is no longer deployed");
       }
       catch (NamingException e)
       {
@@ -244,12 +255,15 @@
          
          try
          {
-            latch.await();
+            latch.await(10, SECONDS);
             
             while (!Thread.currentThread().isInterrupted())
             {
                new InitialContext().lookup("MyStatefulBean/remote");
             }
+
+            // we might get interrupted (by whom?), but lets disregard that
+            fail("Can't happen, MyStatefulBean is no longer deployed");            
          }
          catch (InterruptedException e)
          {
@@ -269,7 +283,7 @@
          {
             try
             {
-               thread.join();
+               thread.join(SECONDS.toMillis(10));
             }
             catch (InterruptedException e)
             {
@@ -296,8 +310,8 @@
          
          try
          {
-            latch.await();
-            
+            latch.await(10, SECONDS);
+
             ContainerShutdownTestCase.this.undeploy(JAR);
          }
          catch (InterruptedException e)




More information about the jboss-cvs-commits mailing list