activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1075821 - in /activemq/trunk/activemq-core/src/test/java/org/apache/activemq: broker/BrokerTestSupport.java broker/StubConnection.java network/NetworkTestSupport.java transport/failover/FailoverTransportBrokerTest.java
Date Tue, 01 Mar 2011 13:44:31 GMT
Author: dejanb
Date: Tue Mar  1 13:44:31 2011
New Revision: 1075821

URL: http://svn.apache.org/viewvc?rev=1075821&view=rev
Log:
fix for FailoverTransportBrokerTest failure

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java?rev=1075821&r1=1075820&r2=1075821&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java
Tue Mar  1 13:44:31 2011
@@ -99,6 +99,7 @@ public class BrokerTestSupport extends C
 
     protected void tearDown() throws Exception {
         broker.stop();
+        broker.waitUntilStopped();
         broker = null;
         regionBroker = null;
         persistenceAdapter = null;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java?rev=1075821&r1=1075820&r2=1075821&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
Tue Mar  1 13:44:31 2011
@@ -52,6 +52,11 @@ public class StubConnection implements S
     }
 
     public StubConnection(Transport transport) throws Exception {
+        this(transport, null);
+    }
+
+    public StubConnection(Transport transport, TransportListener transportListener) throws
Exception {
+        listener = transportListener;
         this.transport = transport;
         transport.setTransportListener(new DefaultTransportListener() {
             public void onCommand(Object command) {

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java?rev=1075821&r1=1075820&r2=1075821&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java
Tue Mar  1 13:44:31 2011
@@ -167,6 +167,7 @@ public class NetworkTestSupport extends 
         connector.stop();
 
         remoteBroker.stop();
+        remoteBroker.waitUntilStopped();
         remotePersistenceAdapter.stop();
         super.tearDown();
     }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java?rev=1075821&r1=1075820&r2=1075821&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
Tue Mar  1 13:44:31 2011
@@ -75,7 +75,7 @@ public class FailoverTransportBrokerTest
 
         // Start a failover publisher.
         LOG.info("Starting the failover connection.");
-        StubConnection connection3 = createFailoverConnection();
+        StubConnection connection3 = createFailoverConnection(null);
         ConnectionInfo connectionInfo3 = createConnectionInfo();
         SessionInfo sessionInfo3 = createSessionInfo(connectionInfo3);
         ProducerInfo producerInfo3 = createProducerInfo(sessionInfo3);
@@ -119,8 +119,7 @@ public class FailoverTransportBrokerTest
 
     public void testNoBrokersInBrokerInfo() throws Exception {
         final BrokerInfo info[] = new BrokerInfo[1];
-        StubConnection c = createFailoverConnection();
-        c.setListener(new TransportListener() {
+        TransportListener listener = new TransportListener() {
             @Override
             public void onCommand(Object command) {
                 LOG.info("Got command: " + command);
@@ -143,8 +142,8 @@ public class FailoverTransportBrokerTest
             public void transportResumed() {
                 //To change body of implemented methods use File | Settings | File Templates.
             }
-        });
-        c.start();
+        };
+        StubConnection c = createFailoverConnection(listener);
         int count = 0;
         while(count++ < 20 && info[0] == null) {
             TimeUnit.SECONDS.sleep(1);
@@ -161,10 +160,10 @@ public class FailoverTransportBrokerTest
         return "tcp://localhost:0?wireFormat.tcpNoDelayEnabled=true";
     }
 
-    protected StubConnection createFailoverConnection() throws Exception {
+    protected StubConnection createFailoverConnection(TransportListener listener) throws
Exception {
         URI failoverURI = new URI("failover://" + connector.getServer().getConnectURI() +
"," + remoteConnector.getServer().getConnectURI() + "");
         Transport transport = TransportFactory.connect(failoverURI);
-        StubConnection connection = new StubConnection(transport);
+        StubConnection connection = new StubConnection(transport, listener);
         connections.add(connection);
         return connection;
     }



Mime
View raw message