activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1303113 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubSelectorDelayTest.java
Date Tue, 20 Mar 2012 19:26:54 GMT
Author: tabish
Date: Tue Mar 20 19:26:54 2012
New Revision: 1303113

URL: http://svn.apache.org/viewvc?rev=1303113&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3775

Update test to not use a static port for the broker Uri.

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubSelectorDelayTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubSelectorDelayTest.java?rev=1303113&r1=1303112&r2=1303113&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubSelectorDelayTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubSelectorDelayTest.java
Tue Mar 20 19:26:54 2012
@@ -49,6 +49,7 @@ public class DurableSubSelectorDelayTest
 
     private BrokerService broker;
     private ActiveMQTopic topic;
+    private String connectionUri;
 
     @Test
     public void testProcess() throws Exception {
@@ -67,12 +68,7 @@ public class DurableSubSelectorDelayTest
         msgProducer.join();
 
         for (int j = 0; j < subscribers.length; j++) {
-
             LOG.info("Unsubscribing subscriber " + subscribers[j]);
-
-            // broker.getAdminView().destroyDurableSubscriber(clientID,
-            // Client.SUBSCRIPTION_NAME);
-
             subscribers[j].unsubscribe();
         }
 
@@ -169,9 +165,7 @@ public class DurableSubSelectorDelayTest
      */
     private final class DurableSubscriber {
 
-        String url = "tcp://localhost:61656";
-
-        final ConnectionFactory cf = new ActiveMQConnectionFactory(url);
+        final ConnectionFactory cf = new ActiveMQConnectionFactory(connectionUri);
 
         private final String subName ;
 
@@ -194,13 +188,10 @@ public class DurableSubSelectorDelayTest
             Connection con = openConnection();
 
             Session sess = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            MessageConsumer consumer = sess.createDurableSubscriber(topic, subName, selector,
false);
 
-
-            MessageConsumer consumer = sess.createDurableSubscriber(topic,
-                    subName, selector, false);
-
-            //MessageConsumer consumer = sess.createDurableSubscriber(topic,SUBSCRIPTION_NAME);
             try {
+
                 do {
                     long max = end - System.currentTimeMillis();
 
@@ -209,14 +200,16 @@ public class DurableSubSelectorDelayTest
                     }
 
                     Message message = consumer.receive(max);
-                    if (message == null)
+                    if (message == null) {
                         continue;
+                    }
 
                     LOG.info("Received Trans[id="
                             + message.getIntProperty("TRANS") + ", count="
                             + transCount + "] in " + this + ".");
 
                 } while (true);
+
             } finally {
                 sess.close();
                 con.close();
@@ -281,7 +274,7 @@ public class DurableSubSelectorDelayTest
             kahadb.setJournalMaxFileLength(  500 * 1024);
             broker.setPersistenceAdapter(kahadb);
 
-        broker.addConnector("tcp://localhost:61656");
+        connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();
 
         broker.getSystemUsage().getMemoryUsage().setLimit(256 * 1024 * 1024);
         broker.getSystemUsage().getTempUsage().setLimit(256 * 1024 * 1024);



Mime
View raw message