diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java index c95de778ae..24b13b75f4 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java @@ -58,7 +58,11 @@ public class FailoverTransportFactory extends TransportFactory { * @throws IOException */ public Transport createTransport(CompositeData compositData) throws IOException { - FailoverTransport transport = createTransport(compositData.getParameters()); + Map options = compositData.getParameters(); + FailoverTransport transport = createTransport(options); + if (!options.isEmpty()) { + throw new IllegalArgumentException("Invalid connect parameters: " + options); + } transport.add(compositData.getComponents()); return transport; } diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUriTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUriTest.java new file mode 100644 index 0000000000..0d4342f227 --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverUriTest.java @@ -0,0 +1,29 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.transport.failover; + +import org.apache.activemq.transport.tcp.TransportUriTest; + +public class FailoverUriTest extends TransportUriTest { + + protected void setUp() throws Exception { + super.setUp(); + prefix = "failover:("; + postfix = ")?initialReconnectDelay=1000&maxReconnectDelay=1000"; + } +} diff --git a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java index 2e797358da..2beffe75e5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TransportUriTest.java @@ -28,11 +28,12 @@ import javax.jms.JMSException; */ public class TransportUriTest extends EmbeddedBrokerTestSupport { - private String postfix = "?tcpNoDelay=true&keepAlive=true"; - private Connection connection; + protected String prefix = ""; + protected String postfix = "?tcpNoDelay=true&keepAlive=true"; + protected Connection connection; public void testUriOptionsWork() throws Exception { - String uri = bindAddress + postfix; + String uri = prefix + bindAddress + postfix; // System.out.println("Connecting via: " + uri); connection = new ActiveMQConnectionFactory(uri).createConnection(); @@ -40,7 +41,7 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport { } public void testBadVersionNumberDoesNotWork() throws Exception { - String uri = bindAddress + postfix + "&minmumWireFormatVersion=65535"; + String uri = prefix + bindAddress + postfix + "&minmumWireFormatVersion=65535"; // System.out.println("Connecting via: " + uri); try { @@ -54,7 +55,7 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport { public void testBadPropertyNameFails() throws Exception { - String uri = bindAddress + postfix + "&cheese=abc"; + String uri = prefix + bindAddress + postfix + "&cheese=abc"; // System.out.println("Connecting via: " + uri); try { @@ -63,12 +64,13 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport { fail("Should have thrown an exception!"); } catch (Exception expected) { + expected.printStackTrace(); } } protected void setUp() throws Exception { - bindAddress = "tcp://localhost:6161"; + bindAddress = "tcp://localhost:61616"; super.setUp(); }