[jboss-cvs] JBossAS SVN: r81656 - trunk/testsuite/src/main/org/jboss/test/jbossmessaging/clustertest.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 26 14:16:04 EST 2008


Author: bstansberry at jboss.com
Date: 2008-11-26 14:16:04 -0500 (Wed, 26 Nov 2008)
New Revision: 81656

Modified:
   trunk/testsuite/src/main/org/jboss/test/jbossmessaging/clustertest/ClusteredTestCase.java
Log:
Add a safeguard to ensure jbm-cluster2 is stopped

Modified: trunk/testsuite/src/main/org/jboss/test/jbossmessaging/clustertest/ClusteredTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossmessaging/clustertest/ClusteredTestCase.java	2008-11-26 18:33:50 UTC (rev 81655)
+++ trunk/testsuite/src/main/org/jboss/test/jbossmessaging/clustertest/ClusteredTestCase.java	2008-11-26 19:16:04 UTC (rev 81656)
@@ -37,6 +37,7 @@
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
+import org.apache.log4j.Logger;
 import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
 
 import org.jboss.jms.client.FailoverEvent;
@@ -62,7 +63,8 @@
  */
 public class ClusteredTestCase extends ParallelTestContainer
 {
-
+    private static final Logger log = Logger.getLogger(ClusteredTestCase.class);
+    
     CountDownLatch latchCluster = new CountDownLatch(1);
     CountDownLatch latchFailover = new CountDownLatch(getTests().length);
     CountDownLatch latchServerAlreadyKilled = new CountDownLatch(1);
@@ -95,7 +97,7 @@
         
         latchCluster.await();
         
-        System.out.println("Clustered tests have finished");
+        log.info("Clustered tests have finished");
         
         latchFailover.await(10, java.util.concurrent.TimeUnit.SECONDS);
 
@@ -104,13 +106,13 @@
         	throw new IllegalStateException ("Test didn't finish properly");
         }
         
-        System.out.println("Ready to kill");
+        log.info("Ready to kill");
 
         rmi.invoke(name, "kill", new Integer[]{1000}, new String[]{"int"});
         
         Thread.sleep(1000);
         
-        System.out.println("Server already killed");
+        log.info("Server already killed");
         latchServerAlreadyKilled.countDown();
         
     }
@@ -294,7 +296,7 @@
                     latch.countDown();
                     latchAlreadyKilled.await();
                     
-                    System.out.println("After kill on (kill on receive)");
+                    log.info("After kill on (kill on receive)");
                 }
                 
                 TextMessage msg = (TextMessage)consumer.receive(50000);
@@ -306,7 +308,7 @@
                     latchCalled = true;
                     latch.countDown();
                     latchAlreadyKilled.await();
-                    System.out.println("After kill on (kill on commit)");
+                    log.info("After kill on (kill on commit)");
                 }
                 
                 session0.commit();
@@ -467,7 +469,7 @@
                // close the producer
                prod.close();
 
-               System.out.println("producer closed");
+               log.info("producer closed");
 
                // create a consumer on the same local queue (creating a consumer AFTER failover will end
                // up getting messages from a local queue, not a failed over queue; at least until
@@ -656,6 +658,18 @@
                     this.getLog().debug("undeployed package: " + jarName);
                  }            
               }
+              
+              JBossTestClusteredServices testServices = (JBossTestClusteredServices) delegate;
+              try
+              {
+                 testServices.getAdaptor(1).invoke(new ObjectName("jboss.system:type=Server"), "shutdown", new Object[]{}, new String[]{});
+                 log.info("Shut down jbm-cluster2");
+              }
+              catch (Exception ignored)
+              {
+                 // expected if the test worked and shut down a server
+                 log.info("Could not shut down jbm-cluster2; probably already killed -- " + ignored.getMessage());
+              }
            }
         };
         return wrapper;




More information about the jboss-cvs-commits mailing list