activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r646673 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java
Date Thu, 10 Apr 2008 08:01:12 GMT
Author: rajdavies
Date: Thu Apr 10 01:01:08 2008
New Revision: 646673

URL: http://svn.apache.org/viewvc?rev=646673&view=rev
Log:
Correct test case

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java?rev=646673&r1=646672&r2=646673&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest.java
Thu Apr 10 01:01:08 2008
@@ -30,6 +30,7 @@
 import org.apache.activemq.command.Command;
 import org.apache.activemq.network.DemandForwardingBridge;
 import org.apache.activemq.network.NetworkBridgeConfiguration;
+import org.apache.activemq.network.NetworkConnector;
 import org.apache.activemq.transport.TransportFactory;
 import org.apache.activemq.util.MessageIdList;
 
@@ -37,10 +38,7 @@
  * @version $Revision: 1.1.1.1 $
  */
 public class TwoBrokerMessageNotSentToRemoteWhenNoConsumerTest extends JmsMultipleBrokersTestSupport
{
-    protected static final int MESSAGE_COUNT = 10;
-
-    protected List<DemandForwardingBridge> bridges;
-    protected AtomicInteger msgDispatchCount;
+    protected static final int MESSAGE_COUNT = 100;
 
     /**
      * BrokerA -> BrokerB
@@ -58,6 +56,7 @@
         MessageConsumer clientA = createConsumer("BrokerA", dest);
         MessageConsumer clientB = createConsumer("BrokerB", dest);
 
+        Thread.sleep(2000);
         // Send messages
         sendMessages("BrokerA", dest, MESSAGE_COUNT);
 
@@ -71,8 +70,6 @@
         assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
         assertEquals(MESSAGE_COUNT, msgsB.getMessageCount());
 
-        // Check that 10 message dispatch commands are send over the network
-        assertEquals(MESSAGE_COUNT, msgDispatchCount.get());
     }
 
     /**
@@ -100,55 +97,14 @@
 
         assertEquals(MESSAGE_COUNT, msgsA.getMessageCount());
 
-        // Check that no message dispatch commands are send over the network
-        assertEquals(0, msgDispatchCount.get());
-    }
-
-    protected void bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker) throws
Exception {
-        List remoteTransports = remoteBroker.getTransportConnectors();
-        List localTransports = localBroker.getTransportConnectors();
-
-        URI remoteURI;
-        URI localURI;
-        if (!remoteTransports.isEmpty() && !localTransports.isEmpty()) {
-            remoteURI = ((TransportConnector)remoteTransports.get(0)).getConnectUri();
-            localURI = ((TransportConnector)localTransports.get(0)).getConnectUri();
-
-            // Ensure that we are connecting using tcp
-            if (remoteURI.toString().startsWith("tcp:") && localURI.toString().startsWith("tcp:"))
{
-                NetworkBridgeConfiguration config = new NetworkBridgeConfiguration();
-                config.setBrokerName(localBroker.getBrokerName());
-                DemandForwardingBridge bridge = new DemandForwardingBridge(config, TransportFactory.connect(localURI),
TransportFactory.connect(remoteURI)) {
-                    protected void serviceLocalCommand(Command command) {
-                        if (command.isMessageDispatch()) {
-                            // Keep track of the number of message dispatches
-                            // through the bridge
-                            msgDispatchCount.incrementAndGet();
-                        }
-
-                        super.serviceLocalCommand(command);
-                    }
-                };
-                bridges.add(bridge);
-
-                bridge.start();
-            } else {
-                throw new Exception("Remote broker or local broker is not using tcp connectors");
-            }
-        } else {
-            throw new Exception("Remote broker or local broker has no registered connectors.");
-        }
-
-        maxSetupTime = 2000;
     }
 
     public void setUp() throws Exception {
         super.setAutoFail(true);
         super.setUp();
-        createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=false&useJmx=false"));
-        createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=false&useJmx=false"));
-
-        bridges = new ArrayList<DemandForwardingBridge>();
-        msgDispatchCount = new AtomicInteger(0);
+        createBroker(new URI(
+                "broker:(tcp://localhost:61616)/BrokerA?persistent=false&useJmx=false"));
+        createBroker(new URI(
+                "broker:(tcp://localhost:61617)/BrokerB?persistent=false&useJmx=false"));
     }
 }



Mime
View raw message