activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1324779 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ClientRebalanceTest.java
Date Wed, 11 Apr 2012 14:23:27 GMT
Author: tabish
Date: Wed Apr 11 14:23:27 2012
New Revision: 1324779

URL: http://svn.apache.org/viewvc?rev=1324779&view=rev
Log:
prevent hanging test stalling the build.

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ClientRebalanceTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ClientRebalanceTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ClientRebalanceTest.java?rev=1324779&r1=1324778&r2=1324779&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ClientRebalanceTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ClientRebalanceTest.java
Wed Apr 11 14:23:27 2012
@@ -16,11 +16,6 @@
  */
 package org.apache.activemq.usecases;
 
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.JmsMultipleBrokersTestSupport;
-import org.apache.log4j.Logger;
-import org.springframework.core.io.ClassPathResource;
-
 import javax.jms.Connection;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
@@ -28,10 +23,20 @@ import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.Session;
 
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.JmsMultipleBrokersTestSupport;
+import org.apache.log4j.Logger;
+import org.springframework.core.io.ClassPathResource;
+
 public class ClientRebalanceTest extends JmsMultipleBrokersTestSupport {
     private static final Logger LOG = Logger.getLogger(ClientRebalanceTest.class);
     private static final String QUEUE_NAME = "Test.ClientRebalanceTest";
-    
+
+    protected void setUp() throws Exception {
+        setAutoFail(true);
+        super.setUp();
+    }
+
     public void testRebalance() throws Exception {
         createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker1.xml"));
         createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker2.xml"));
@@ -40,9 +45,8 @@ public class ClientRebalanceTest extends
 
         brokers.get("b1").broker.waitUntilStarted();
 
-
         LOG.info("Starting connection");
-        
+
         ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("failover:(tcp://localhost:61616,tcp://localhost:61617)?randomize=false");
         Connection conn = factory.createConnection();
         conn.start();
@@ -55,20 +59,17 @@ public class ClientRebalanceTest extends
         Message msg = consumer.receive(2000);
         assertNotNull(msg);
 
-
         // introduce third broker
         createBroker(new ClassPathResource("org/apache/activemq/usecases/rebalance-broker3.xml"));
         brokers.get("b3").broker.waitUntilStarted();
-        
-        Thread.sleep(1000);
 
+        Thread.sleep(1000);
 
         LOG.info("Stopping broker 1");
 
-
         brokers.get("b1").broker.stop();
         brokers.get("b1").broker.waitUntilStopped();
-        
+
         Thread.sleep(1000);
         // should reconnect to some of the remaining brokers
         producer.send(message);
@@ -85,5 +86,4 @@ public class ClientRebalanceTest extends
         msg = consumer.receive(2000);
         assertNotNull(msg);
     }
-    
 }



Mime
View raw message