activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1076192 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/discovery/ main/java/org/apache/activemq/transport/fanout/ test/java/org/apache/activemq/transport/discovery/
Date Wed, 02 Mar 2011 12:32:27 GMT
Author: dejanb
Date: Wed Mar  2 12:32:26 2011
New Revision: 1076192

URL: http://svn.apache.org/viewvc?rev=1076192&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-2981 - Connecting to broker using discovery protocol
fails

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java?rev=1076192&r1=1076191&r2=1076192&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java
Wed Mar  2 12:32:26 2011
@@ -37,7 +37,7 @@ public class DiscoveryTransportFactory e
     public Transport createTransport(CompositeData compositeData) throws IOException {
         Map<String, String> parameters = new HashMap<String, String>(compositeData.getParameters());
         FailoverTransport failoverTransport = createTransport(parameters);
-        return createTransport(failoverTransport, compositeData);
+        return createTransport(failoverTransport, compositeData, parameters);
     }
     
     /**
@@ -48,10 +48,9 @@ public class DiscoveryTransportFactory e
      * @return a transport that reports discovered brokers to a specific composite transport.
      * @throws IOException
      */
-    public static DiscoveryTransport createTransport(CompositeTransport compositeTransport,
CompositeData compositeData) throws IOException {                
+    public static DiscoveryTransport createTransport(CompositeTransport compositeTransport,
CompositeData compositeData, Map<String, String> parameters) throws IOException {
         DiscoveryTransport transport = new DiscoveryTransport(compositeTransport);
-        
-        Map<String, String> parameters = new HashMap<String, String>(compositeData.getParameters());
+
         IntrospectionSupport.setProperties(transport, parameters);
         transport.setParameters(parameters);
         

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java?rev=1076192&r1=1076191&r2=1076192&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java
Wed Mar  2 12:32:26 2011
@@ -64,7 +64,7 @@ public class FanoutTransportFactory exte
         CompositeData compositeData = URISupport.parseComposite(location);
         Map<String, String> parameters = compositeData.getParameters();
         FanoutTransport fanoutTransport = createTransport(parameters);        
-        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(fanoutTransport,
compositeData);        
+        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(fanoutTransport,
compositeData, parameters);
         return discoveryTransport;
     }
 

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java?rev=1076192&r1=1076191&r2=1076192&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java
Wed Mar  2 12:32:26 2011
@@ -125,7 +125,7 @@ public class DiscoveryTransportNoBrokerT
         CompositeData compositeData = URISupport.parseComposite(uri);
         
         StubCompositeTransport compositeTransport = new StubCompositeTransport();      
-        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport,
compositeData);
+        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport,
compositeData, compositeData.getParameters());
         
         discoveryTransport.onServiceAdd(new DiscoveryEvent("tcp://localhost:61616"));   
    
         assertEquals("expected added URI after discovery event", compositeTransport.getTransportURIs().length,
1);
@@ -141,7 +141,7 @@ public class DiscoveryTransportNoBrokerT
         CompositeData compositeData = URISupport.parseComposite(uri);
         
         StubCompositeTransport compositeTransport = new StubCompositeTransport();      
-        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport,
compositeData);
+        DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport,
compositeData, compositeData.getParameters());
         
         final String serviceName = "tcp://localhost:61616";
         discoveryTransport.onServiceAdd(new DiscoveryEvent(serviceName));        

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java?rev=1076192&r1=1076191&r2=1076192&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/discovery/DiscoveryUriTest.java
Wed Mar  2 12:32:26 2011
@@ -40,7 +40,7 @@ public class DiscoveryUriTest extends Em
     }
 
     public void testConnect() throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("discovery:(multicast://default?group=test&reconnectDelay=1000&maxReconnectAttempts=30&useExponentialBackOff=false)");
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("discovery:(multicast://default?group=test)?reconnectDelay=1000&maxReconnectAttempts=30&useExponentialBackOff=false");
         Connection conn = factory.createConnection();
         conn.start();
 
@@ -51,4 +51,15 @@ public class DiscoveryUriTest extends Em
         Message msg = consumer.receive(1000);
         assertNotNull(msg);
     }
+
+    public void testFailedConnect() throws Exception {
+        try {
+            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("discovery:(multicast://default?group=test1)?reconnectDelay=1000&maxReconnectAttempts=3&useExponentialBackOff=false");
+            Connection conn = factory.createConnection();
+            conn.start();
+        } catch (Exception e) {
+            return;
+        }
+        fail("Expected connection failure");
+    }
 }



Mime
View raw message