activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r417734 - /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
Date Wed, 28 Jun 2006 11:40:04 GMT
Author: rajdavies
Date: Wed Jun 28 04:40:04 2006
New Revision: 417734

URL: http://svn.apache.org/viewvc?rev=417734&view=rev
Log:
support networkTTL as an option

Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java?rev=417734&r1=417733&r2=417734&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java
Wed Jun 28 04:40:04 2006
@@ -18,6 +18,8 @@
 
 import javax.jms.*;
 
+import org.apache.activemq.network.DiscoveryNetworkConnector;
+import org.apache.activemq.network.NetworkConnector;
 import org.apache.activemq.util.MessageIdList;
 import org.apache.activemq.util.IdGenerator;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -60,20 +62,37 @@
     protected boolean verbose = false;
 
     protected void bridgeBrokers(String localBrokerName, String remoteBrokerName) throws
Exception {
+       bridgeBrokers(localBrokerName,remoteBrokerName,false,1);
+    }
+    
+    
+    protected void bridgeBrokers(String localBrokerName, String remoteBrokerName,boolean
dynamicOnly) throws Exception {
+        BrokerService localBroker  = ((BrokerItem)brokers.get(localBrokerName)).broker;
+        BrokerService remoteBroker = ((BrokerItem)brokers.get(remoteBrokerName)).broker;
+
+        bridgeBrokers(localBroker, remoteBroker,dynamicOnly,1);
+    }
+    
+    protected void bridgeBrokers(String localBrokerName, String remoteBrokerName,boolean
dynamicOnly, int networkTTL) throws Exception {
         BrokerService localBroker  = ((BrokerItem)brokers.get(localBrokerName)).broker;
         BrokerService remoteBroker = ((BrokerItem)brokers.get(remoteBrokerName)).broker;
 
-        bridgeBrokers(localBroker, remoteBroker);
+        bridgeBrokers(localBroker, remoteBroker,dynamicOnly,networkTTL);
     }
+    
+   
 
     // Overwrite this method to specify how you want to bridge the two brokers
     // By default, bridge them using add network connector of the local broker and the first
connector of the remote broker
-    protected void bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker) throws
Exception {
+    protected void bridgeBrokers(BrokerService localBroker, BrokerService remoteBroker,boolean
dynamicOnly, int networkTTL) throws Exception {
         List transportConnectors = remoteBroker.getTransportConnectors();
         URI remoteURI;
         if (!transportConnectors.isEmpty()) {
             remoteURI = ((TransportConnector)transportConnectors.get(0)).getConnectUri();
-            localBroker.addNetworkConnector("static:" + remoteURI);
+            NetworkConnector connector=new DiscoveryNetworkConnector(new URI("static:" +
remoteURI));
+            connector.setDynamicOnly(dynamicOnly);
+            connector.setNetworkTTL(networkTTL);
+            localBroker.addNetworkConnector(connector);
         } else {
             throw new Exception("Remote broker has no registered connectors.");
         }
@@ -270,7 +289,7 @@
 
 
     // Class to group broker components together
-    protected class BrokerItem {
+    public class BrokerItem {
         public BrokerService broker;
         public ActiveMQConnectionFactory factory;
         public List connections;



Mime
View raw message