activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1304559 - in /activemq/trunk/activemq-core/src/test: java/org/apache/activemq/network/ resources/org/apache/activemq/network/ resources/org/apache/activemq/network/multicast/
Date Fri, 23 Mar 2012 18:53:19 GMT
Author: gtully
Date: Fri Mar 23 18:53:18 2012
New Revision: 1304559

URL: http://svn.apache.org/viewvc?rev=1304559&view=rev
Log:
resolve persistent hudson failure of org.apache.activemq.network.SimpleNetworkTest.testConduitBridge
- individual cases were interfering with each other. A secondary failure, org.apache.activemq.network.SimpleNetworkTest#testDurableStoreAndForwardReconnect
shows a problem with consuming an existing sub across a network, it won't work. It is not
trivial to fix either, so virtual topics are a better bet in a network environment atm

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkFailoverTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/SimpleNetworkTest.java
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexLocalBroker.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/localBroker.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/localBroker.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/remoteBroker.xml
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/remoteBroker.xml

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkTest.java
Fri Mar 23 18:53:18 2012
@@ -19,6 +19,10 @@ package org.apache.activemq.network;
 import javax.jms.MessageProducer;
 import javax.jms.TemporaryQueue;
 import org.apache.activemq.broker.BrokerService;
+import org.junit.Test;
+
+
+import static junit.framework.Assert.assertEquals;
 
 public class DuplexNetworkTest extends SimpleNetworkTest {
 
@@ -34,7 +38,8 @@ public class DuplexNetworkTest extends S
         broker.addConnector("tcp://localhost:61617");
         return broker;
     }
-    
+
+    @Test
     public void testTempQueues() throws Exception {
         TemporaryQueue temp = localSession.createTemporaryQueue();
         MessageProducer producer = localSession.createProducer(temp);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkFailoverTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkFailoverTest.java?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkFailoverTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkFailoverTest.java
Fri Mar 23 18:53:18 2012
@@ -95,8 +95,8 @@ public class NetworkFailoverTest extends
             ((FailoverTransport) ((TransportFilter) ((TransportFilter) 
                     ((ActiveMQConnection) localConnection)
                     .getTransport()).getNext()).getNext())
-                    .handleTransportFailure(new IOException());
-            TextMessage result = (TextMessage)requestConsumer.receive();
+                    .handleTransportFailure(new IOException("Forcing failover from test"));
+            TextMessage result = (TextMessage)requestConsumer.receive(10000);
             assertNotNull(result);
             
             LOG.info(result.getText());
@@ -107,12 +107,10 @@ public class NetworkFailoverTest extends
 
     protected void setUp() throws Exception {
         super.setUp();
-        doSetUp();
+        doSetUp(true);
     }
 
     protected void tearDown() throws Exception {
-        localBroker.deleteAllMessages();
-        remoteBroker.deleteAllMessages();
         doTearDown();
         super.tearDown();
     }
@@ -124,20 +122,22 @@ public class NetworkFailoverTest extends
         remoteBroker.stop();
     }
 
-    protected void doSetUp() throws Exception {
+    protected void doSetUp(boolean deleteAllMessages) throws Exception {
         
         remoteBroker = createRemoteBroker();
+        remoteBroker.setDeleteAllMessagesOnStartup(deleteAllMessages);
         remoteBroker.start();
         localBroker = createLocalBroker();
+        localBroker.setDeleteAllMessagesOnStartup(deleteAllMessages);
         localBroker.start();
         String localURI = "tcp://localhost:61616";
         String remoteURI = "tcp://localhost:61617";
-        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("failover:("+localURI+","+remoteURI+"?trackMessages=true)?randomize=false&backup=true");
+        ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("failover:("+localURI+","+remoteURI+")?randomize=false&backup=true&trackMessages=true");
         //ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory(localURI);
         localConnection = fac.createConnection();
         localConnection.setClientID("local");
         localConnection.start();
-        fac = new ActiveMQConnectionFactory("failover:("+remoteURI + ","+localURI+")?randomize=false&backup=true");
+        fac = new ActiveMQConnectionFactory("failover:("+remoteURI + ","+localURI+")?randomize=false&backup=true&trackMessages=true");
         fac.setWatchTopicAdvisories(false);
         remoteConnection = fac.createConnection();
         remoteConnection.setClientID("remote");

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=1304559&r1=1304558&r2=1304559&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
Fri Mar 23 18:53:18 2012
@@ -23,6 +23,11 @@ import org.apache.activemq.command.Activ
 import org.apache.activemq.command.ConsumerId;
 import org.apache.activemq.util.Wait;
 import org.apache.activemq.xbean.BrokerFactoryBean;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.support.AbstractApplicationContext;
@@ -34,7 +39,12 @@ import java.net.URI;
 import java.util.Arrays;
 import java.util.concurrent.ConcurrentHashMap;
 
-public class SimpleNetworkTest extends org.apache.activemq.TestSupport {
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+public class SimpleNetworkTest {
 
     protected static final int MESSAGE_COUNT = 10;
     private static final Logger LOG = LoggerFactory.getLogger(SimpleNetworkTest.class);
@@ -50,6 +60,7 @@ public class SimpleNetworkTest extends o
     protected ActiveMQTopic excluded;
     protected String consumerName = "durableSubs";
 
+    @Test
     public void testRequestReply() throws Exception {
         final MessageProducer remoteProducer = remoteSession.createProducer(null);
         MessageConsumer remoteConsumer = remoteSession.createConsumer(included);
@@ -80,6 +91,7 @@ public class SimpleNetworkTest extends o
         }
     }
 
+    @Test
     public void testFiltering() throws Exception {
         MessageConsumer includedConsumer = remoteSession.createConsumer(included);
         MessageConsumer excludedConsumer = remoteSession.createConsumer(excluded);
@@ -94,6 +106,7 @@ public class SimpleNetworkTest extends o
         assertNotNull(includedConsumer.receive(1000));
     }
 
+    @Test
     public void testConduitBridge() throws Exception {
         MessageConsumer consumer1 = remoteSession.createConsumer(included);
         MessageConsumer consumer2 = remoteSession.createConsumer(included);
@@ -137,13 +150,14 @@ public class SimpleNetworkTest extends o
         }));
     }
 
+    @Test
     public void testDurableStoreAndForward() throws Exception {
         // create a remote durable consumer
         MessageConsumer remoteConsumer = remoteSession.createDurableSubscriber(included,
consumerName);
         Thread.sleep(1000);
         // now close everything down and restart
         doTearDown();
-        doSetUp();
+        doSetUp(false);
         MessageProducer producer = localSession.createProducer(included);
         for (int i = 0; i < MESSAGE_COUNT; i++) {
             Message test = localSession.createTextMessage("test-" + i);
@@ -152,56 +166,59 @@ public class SimpleNetworkTest extends o
         Thread.sleep(1000);
         // close everything down and restart
         doTearDown();
-        doSetUp();
+        doSetUp(false);
         remoteConsumer = remoteSession.createDurableSubscriber(included, consumerName);
         for (int i = 0; i < MESSAGE_COUNT; i++) {
             assertNotNull("message count: " + i, remoteConsumer.receive(2500));
         }
     }
 
+    @Ignore("This seems like a simple use case, but it is problematic to consume an existing
topic store, " +
+            "it requires a connection per durable to match that connectionId")
     public void testDurableStoreAndForwardReconnect() throws Exception {
         // create a local durable consumer
         MessageConsumer localConsumer = localSession.createDurableSubscriber(included, consumerName);
-        Thread.sleep(1000);
+        Thread.sleep(5000);
         // now close everything down and restart
         doTearDown();
-        doSetUp();
+        doSetUp(false);
         // 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);
+        Thread.sleep(5000);
         // consume some messages locally
         localConsumer = localSession.createDurableSubscriber(included, consumerName);
+        LOG.info("Consume from local consumer: " + localConsumer);
         for (int i = 0; i < MESSAGE_COUNT / 2; i++) {
             assertNotNull("message count: " + i, localConsumer.receive(2500));
         }
-        Thread.sleep(1000);
+        Thread.sleep(5000);
         // close everything down and restart
         doTearDown();
-        doSetUp();
+        doSetUp(false);
+        Thread.sleep(5000);
+
+        LOG.info("Consume from remote");
         // consume the rest remotely
         MessageConsumer remoteConsumer = remoteSession.createDurableSubscriber(included,
consumerName);
+        LOG.info("Remote consumer: " + remoteConsumer);
+        Thread.sleep(5000);
         for (int i = 0; i < MESSAGE_COUNT / 2; i++) {
-            assertNotNull("message count: " + i, remoteConsumer.receive(2500));
+            assertNotNull("message count: " + i, remoteConsumer.receive(10000));
         }
     }
 
-    @Override
-    protected void setUp() throws Exception {
-        setAutoFail(true);
-        super.setUp();
-        doSetUp();
+    @Before
+    public void setUp() throws Exception {
+        doSetUp(true);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        localBroker.deleteAllMessages();
-        remoteBroker.deleteAllMessages();
+    @After
+    public void tearDown() throws Exception {
         doTearDown();
-        super.tearDown();
     }
 
     protected void doTearDown() throws Exception {
@@ -211,11 +228,13 @@ public class SimpleNetworkTest extends o
         remoteBroker.stop();
     }
 
-    protected void doSetUp() throws Exception {
+    protected void doSetUp(boolean deleteAllMessages) throws Exception {
         remoteBroker = createRemoteBroker();
+        remoteBroker.setDeleteAllMessagesOnStartup(deleteAllMessages);
         remoteBroker.start();
         remoteBroker.waitUntilStarted();
         localBroker = createLocalBroker();
+        localBroker.setDeleteAllMessagesOnStartup(deleteAllMessages);
         localBroker.start();
         localBroker.waitUntilStarted();
         URI localURI = localBroker.getVmConnectorURI();
@@ -223,12 +242,12 @@ public class SimpleNetworkTest extends o
         fac.setAlwaysSyncSend(true);
         fac.setDispatchAsync(false);
         localConnection = fac.createConnection();
-        localConnection.setClientID("local");
+        localConnection.setClientID("clientId");
         localConnection.start();
         URI remoteURI = remoteBroker.getVmConnectorURI();
         fac = new ActiveMQConnectionFactory(remoteURI);
         remoteConnection = fac.createConnection();
-        remoteConnection.setClientID("remote");
+        remoteConnection.setClientID("clientId");
         remoteConnection.start();
         included = new ActiveMQTopic("include.test.bar");
         excluded = new ActiveMQTopic("exclude.test.bar");

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexLocalBroker.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexLocalBroker.xml?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexLocalBroker.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexLocalBroker.xml
Fri Mar 23 18:53:18 2012
@@ -24,7 +24,7 @@
 
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-<broker brokerName="localBroker" persistent="true" useShutdownHook="false" xmlns="http://activemq.apache.org/schema/core">
+<broker brokerName="localBroker" start="false" persistent="true" useShutdownHook="false"
xmlns="http://activemq.apache.org/schema/core">
     <networkConnectors>
       <networkConnector uri="static:(tcp://localhost:61617)"
          duplex="true"

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/localBroker.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/localBroker.xml?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/localBroker.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/localBroker.xml
Fri Mar 23 18:53:18 2012
@@ -23,7 +23,7 @@
   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-<broker brokerName="localBroker" persistent="true" useShutdownHook="false" monitorConnectionSplits="true"
xmlns="http://activemq.apache.org/schema/core">
+<broker brokerName="localBroker" start="false" persistent="true" useShutdownHook="false"
monitorConnectionSplits="true" xmlns="http://activemq.apache.org/schema/core">
     <networkConnectors>
       <networkConnector uri="static:(tcp://localhost:61617)"
          dynamicOnly = "false"

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/localBroker.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/localBroker.xml?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/localBroker.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/localBroker.xml
Fri Mar 23 18:53:18 2012
@@ -22,7 +22,7 @@
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
 
-  <broker brokerName="localBroker" persistent="true" useShutdownHook="false" xmlns="http://activemq.apache.org/schema/core">
+  <broker brokerName="localBroker" start="false" persistent="true" useShutdownHook="false"
xmlns="http://activemq.apache.org/schema/core">
     
     <transportConnectors><transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://224.1.2.6:6123"
/></transportConnectors>
 

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/remoteBroker.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/remoteBroker.xml?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/remoteBroker.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/multicast/remoteBroker.xml
Fri Mar 23 18:53:18 2012
@@ -22,7 +22,7 @@
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
 
-  <broker brokerName="remoteBroker" persistent="true" useShutdownHook="false" xmlns="http://activemq.apache.org/schema/core">
+  <broker brokerName="remoteBroker" start="false" persistent="true" useShutdownHook="false"
xmlns="http://activemq.apache.org/schema/core">
 
     <transportConnectors><transportConnector uri="tcp://localhost:61617" discoveryUri="multicast://224.1.2.6:6123"
/></transportConnectors>
 

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/remoteBroker.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/remoteBroker.xml?rev=1304559&r1=1304558&r2=1304559&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/remoteBroker.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/remoteBroker.xml
Fri Mar 23 18:53:18 2012
@@ -24,7 +24,7 @@
 
   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
 
-  <broker brokerName="remoteBroker" useJmx="false" persistent="true" useShutdownHook="false"
monitorConnectionSplits="true" xmlns="http://activemq.apache.org/schema/core">
+  <broker brokerName="remoteBroker" start="false" useJmx="false" persistent="true" useShutdownHook="false"
monitorConnectionSplits="false" xmlns="http://activemq.apache.org/schema/core">
     <networkConnectors>
       <networkConnector uri="static:(tcp://localhost:61616)" />
       </networkConnectors>



Mime
View raw message