You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2015/03/05 00:17:03 UTC

activemq git commit: https://issues.apache.org/jira/browse/PROTON-833

Repository: activemq
Updated Branches:
  refs/heads/master 5313ad8a9 -> 6380bf376


https://issues.apache.org/jira/browse/PROTON-833

Clean up a couple more tests.

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

Branch: refs/heads/master
Commit: 6380bf37627bc6792ac62e11a9880ec2444b387b
Parents: 5313ad8
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Mar 4 18:16:41 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Mar 4 18:16:59 2015 -0500

----------------------------------------------------------------------
 .../org/apache/activemq/bugs/AMQ4213Test.java   | 14 +++----
 .../org/apache/activemq/bugs/AMQ4671Test.java   | 11 +++---
 .../org/apache/activemq/bugs/AMQ4899Test.java   | 40 ++++++++++----------
 3 files changed, 30 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/6380bf37/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4213Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4213Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4213Test.java
index fddb6b1..e55ab08 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4213Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4213Test.java
@@ -36,27 +36,23 @@ import org.junit.Test;
 public class AMQ4213Test {
 
     private static BrokerService brokerService;
-    private static String BROKER_ADDRESS = "tcp://localhost:0";
     private static String TEST_QUEUE = "testQueue";
     private static ActiveMQQueue queue = new ActiveMQQueue(TEST_QUEUE);
 
-    private String connectionUri;
-
     @SuppressWarnings("unchecked")
     @Before
     public void setUp() throws Exception {
         brokerService = new BrokerService();
         brokerService.setPersistent(false);
-        brokerService.setUseJmx(true);
-        brokerService.setDeleteAllMessagesOnStartup(true);
-        connectionUri = brokerService.addConnector(BROKER_ADDRESS).getPublishableConnectString();
+        brokerService.setUseJmx(false);
+        brokerService.setAdvisorySupport(false);
 
         brokerService.setPlugins(new BrokerPlugin[]{
             new BrokerPluginSupport() {
 
                 @Override
                 public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
-                    throw new javax.jms.JMSSecurityException(connectionUri);
+                    throw new javax.jms.JMSSecurityException(brokerService.getVmConnectorURI().toString());
                 }
             }
         });
@@ -71,9 +67,9 @@ public class AMQ4213Test {
         brokerService.waitUntilStopped();
     }
 
-    @Test
+    @Test(timeout = 30000)
     public void testExceptionOnProducerCreateThrows() throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(connectionUri);
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerService.getVmConnectorURI());
         ActiveMQConnection connection = (ActiveMQConnection) factory.createConnection();
 
         Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);

http://git-wip-us.apache.org/repos/asf/activemq/blob/6380bf37/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
index b69ab47..e8b9675 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4671Test.java
@@ -33,7 +33,6 @@ public class AMQ4671Test {
 
     private static final transient Logger LOG = LoggerFactory.getLogger(AMQ4671Test.class);
     private static BrokerService brokerService;
-    private static String BROKER_ADDRESS = "tcp://localhost:0";
 
     private String connectionUri;
 
@@ -41,12 +40,12 @@ public class AMQ4671Test {
     public void setUp() throws Exception {
         brokerService = new BrokerService();
         brokerService.setPersistent(false);
-        brokerService.setUseJmx(true);
-        brokerService.setDeleteAllMessagesOnStartup(true);
-        connectionUri = brokerService.addConnector(BROKER_ADDRESS).getPublishableConnectString();
-        connectionUri = connectionUri + "?trace=true";
+        brokerService.setUseJmx(false);
+        brokerService.setAdvisorySupport(false);
         brokerService.start();
         brokerService.waitUntilStarted();
+
+        connectionUri = brokerService.getVmConnectorURI().toString();
     }
 
     @After
@@ -55,7 +54,7 @@ public class AMQ4671Test {
         brokerService.waitUntilStopped();
     }
 
-    @Test
+    @Test(timeout = 30000)
     public void testNonDurableSubscriberInvalidUnsubscribe() throws Exception {
         ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(connectionUri);
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/6380bf37/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4899Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4899Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4899Test.java
index 81140ce..019d905 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4899Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4899Test.java
@@ -16,6 +16,22 @@
  */
 package org.apache.activemq.bugs;
 
+import static org.junit.Assert.assertEquals;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerPlugin;
@@ -31,21 +47,6 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import static org.junit.Assert.assertEquals;
-
 public class AMQ4899Test {
     protected static final Logger LOG = LoggerFactory.getLogger(AMQ4899Test.class);
     private static final String QUEUE_NAME="AMQ4899TestQueue";
@@ -55,9 +56,9 @@ public class AMQ4899Test {
     private static final Integer MESSAGE_LIMIT = 20;
     public static final String CONSUMER_A_SELECTOR = "Order < " + 10;
     public static  String CONSUMER_B_SELECTOR = "Order >= " + 10;
-    private CountDownLatch consumersStarted = new CountDownLatch(2);
-    private CountDownLatch consumerAtoConsumeCount= new CountDownLatch(10);
-    private CountDownLatch consumerBtoConsumeCount = new CountDownLatch(10);
+    private final CountDownLatch consumersStarted = new CountDownLatch(2);
+    private final CountDownLatch consumerAtoConsumeCount= new CountDownLatch(10);
+    private final CountDownLatch consumerBtoConsumeCount = new CountDownLatch(10);
 
     private BrokerService broker;
 
@@ -112,9 +113,7 @@ public class AMQ4899Test {
             message.setIntProperty("Order", i);
             LOG.debug("Sending message [{}]", messageText);
             producer.send(message);
-            Thread.sleep(100);
         }
-        Thread.sleep(1 * 1000);
 
         // restart consumerA
         LOG.debug("Restarting consumerA");
@@ -156,6 +155,7 @@ public class AMQ4899Test {
             BrokerPlugin[] updatedPlugins = {subQueueSelectorCacheBrokerPlugin};
             broker.setPlugins(updatedPlugins);
 
+            broker.setUseJmx(false);
             broker.start();
             broker.waitUntilStarted();
         } catch (Exception e) {