activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [2/3] activemq git commit: tidy up test code layout
Date Fri, 05 Dec 2014 14:51:27 GMT
tidy up test code layout


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/a876a341
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/a876a341
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/a876a341

Branch: refs/heads/trunk
Commit: a876a34141a487b2609d61de1d69b6e4b6b5104f
Parents: 60ad053
Author: gtully <gary.tully@gmail.com>
Authored: Fri Dec 5 14:02:27 2014 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Fri Dec 5 14:02:27 2014 +0000

----------------------------------------------------------------------
 .../MessageGroupReconnectDistributionTest.java     | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/a876a341/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java
index 4799076..660b568 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java
@@ -17,13 +17,7 @@
 package org.apache.activemq.usecases;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
@@ -57,13 +51,13 @@ import static org.junit.Assert.assertTrue;
 @RunWith(BlockJUnit4ClassRunner.class)
 public class MessageGroupReconnectDistributionTest {
     public static final Logger LOG = LoggerFactory.getLogger(MessageGroupReconnectDistributionTest.class);
+    final Random random = new Random();
     protected Connection connection;
     protected Session session;
     protected MessageProducer producer;
     protected Destination destination;
-
-    BrokerService broker;
     protected TransportConnector connector;
+    BrokerService broker;
 
     @Before
     public void setUp() throws Exception {
@@ -101,12 +95,11 @@ public class MessageGroupReconnectDistributionTest {
         broker.stop();
     }
 
-    final Random random = new Random();
     public int getBatchSize(int bound) throws Exception {
         return bound + random.nextInt(bound);
     }
 
-    @Test(timeout = 20 * 60 * 1000)
+    @Test(timeout = 5 * 60 * 1000)
     public void testReconnect() throws Exception {
 
         final int numMessages = 50000;
@@ -117,7 +110,7 @@ public class MessageGroupReconnectDistributionTest {
 
         ExecutorService executorService = Executors.newCachedThreadPool();
         final ArrayList<AtomicLong> consumedCounters = new ArrayList<AtomicLong>(numConsumers);
-        for (int i=0;i<numConsumers; i++) {
+        for (int i = 0; i < numConsumers; i++) {
             consumedCounters.add(new AtomicLong(0l));
             final int id = i;
             executorService.submit(new Runnable() {
@@ -185,7 +178,7 @@ public class MessageGroupReconnectDistributionTest {
 
     private void produceMessages(int numMessages) throws JMSException {
         for (int i = 0; i < numMessages; i++) {
-            TextMessage msga = session.createTextMessage("hello " +i);
+            TextMessage msga = session.createTextMessage("hello " + i);
             msga.setStringProperty("JMSXGroupID", msga.getText());
             producer.send(msga);
         }


Mime
View raw message