git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@548260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2007-06-18 08:47:21 +00:00
parent 0ef421d14a
commit fae5c5fd29
3 changed files with 42 additions and 7 deletions

View File

@ -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;
}

View File

@ -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";
}
}

View File

@ -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();
}