activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r945594 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
Date Tue, 18 May 2010 11:32:22 GMT
Author: dejanb
Date: Tue May 18 11:32:22 2010
New Revision: 945594

URL: http://svn.apache.org/viewvc?rev=945594&view=rev
Log:
assert that reconnecting durable sub on a remote broker works

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java?rev=945594&r1=945593&r2=945594&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
Tue May 18 11:32:22 2010
@@ -144,6 +144,36 @@ public class SimpleNetworkTest extends T
         }
     }
 
+    public void testDurableStoreAndForwardReconnect() throws Exception {
+        // create a local durable consumer
+        MessageConsumer localConsumer = localSession.createDurableSubscriber(included, consumerName);
+        Thread.sleep(1000);
+        // now close everything down and restart
+        doTearDown();
+        doSetUp();
+        // send messages
+        MessageProducer producer = localSession.createProducer(included);
+        for (int i = 0; i < MESSAGE_COUNT; i++) {
+            Message test = localSession.createTextMessage("test-" + i);
+            producer.send(test);
+        }
+        Thread.sleep(1000);
+        // consume some messages locally
+        localConsumer = localSession.createDurableSubscriber(included, consumerName);
+        for (int i = 0; i < MESSAGE_COUNT / 2; i++) {
+            assertNotNull("message count: " + i, localConsumer.receive(2500));
+        }
+        Thread.sleep(1000);
+        // close everything down and restart
+        doTearDown();
+        doSetUp();
+        // consume the rest remotely
+        MessageConsumer remoteConsumer = remoteSession.createDurableSubscriber(included,
consumerName);
+        for (int i = 0; i < MESSAGE_COUNT / 2; i++) {
+            assertNotNull("message count: " + i, remoteConsumer.receive(2500));
+        }
+    }    
+    
     protected void setUp() throws Exception {
         super.setUp();
         doSetUp();



Mime
View raw message