refactored failover uri test to support testing multiple values

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@744112 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2009-02-13 13:48:51 +00:00
parent 479acad417
commit 049b43cd17
3 changed files with 53 additions and 11 deletions

View File

@ -32,7 +32,7 @@ import org.springframework.jms.core.JmsTemplate;
* *
* @version $Revision: 1.1 $ * @version $Revision: 1.1 $
*/ */
public abstract class EmbeddedBrokerTestSupport extends TestCase { public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
protected BrokerService broker; protected BrokerService broker;
// protected String bindAddress = "tcp://localhost:61616"; // protected String bindAddress = "tcp://localhost:61616";

View File

@ -16,13 +16,29 @@
*/ */
package org.apache.activemq.transport.failover; package org.apache.activemq.transport.failover;
import junit.framework.Test;
import org.apache.activemq.transport.tcp.TransportUriTest; import org.apache.activemq.transport.tcp.TransportUriTest;
public class FailoverUriTest extends TransportUriTest { public class FailoverUriTest extends TransportUriTest {
protected void setUp() throws Exception { public void initCombosForTestUriOptionsWork() {
super.setUp(); addCombinationValues("prefix", new Object[] {"failover:("});
prefix = "failover:("; addCombinationValues("postfix", new Object[] {")?initialReconnectDelay=1000&maxReconnectDelay=1000"});
postfix = ")?initialReconnectDelay=1000&maxReconnectDelay=1000"; //, "?jms.useAsyncSend=true&jms.copyMessageOnSend=false &wireFormat.tightEncodingEnabled=false"});
}
public void initCombosForTestBadVersionNumberDoesNotWork() {
addCombinationValues("prefix", new Object[] {"failover:("});
addCombinationValues("postfix", new Object[] {")?initialReconnectDelay=1000&maxReconnectDelay=1000"});
}
public void initCombosForTestBadPropertyNameFails() {
addCombinationValues("prefix", new Object[] {"failover:("});
addCombinationValues("postfix", new Object[] {")?initialReconnectDelay=1000&maxReconnectDelay=1000"});
}
public static Test suite() {
return suite(FailoverUriTest.class);
} }
} }

View File

@ -19,30 +19,47 @@ package org.apache.activemq.transport.tcp;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.JMSException; import javax.jms.JMSException;
import junit.framework.Test;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* @version $Revision$ * @version $Revision$
*/ */
public class TransportUriTest extends EmbeddedBrokerTestSupport { public class TransportUriTest extends EmbeddedBrokerTestSupport {
protected String prefix = ""; private static final Log LOG = LogFactory.getLog(TransportUriTest.class);
protected String postfix = "?tcpNoDelay=true&keepAlive=true";
protected Connection connection; protected Connection connection;
public String prefix;
public String postfix;
public void initCombosForTestUriOptionsWork() {
addCombinationValues("prefix", new Object[] {""});
addCombinationValues("postfix", new Object[] {"?tcpNoDelay=true&keepAlive=true"});
}
public void testUriOptionsWork() throws Exception { public void testUriOptionsWork() throws Exception {
String uri = prefix + bindAddress + postfix; String uri = prefix + bindAddress + postfix;
// System.out.println("Connecting via: " + uri); LOG.info("Connecting via: " + uri);
connection = new ActiveMQConnectionFactory(uri).createConnection(); connection = new ActiveMQConnectionFactory(uri).createConnection();
connection.start(); connection.start();
} }
public void initCombosForTestBadVersionNumberDoesNotWork() {
addCombinationValues("prefix", new Object[] {""});
addCombinationValues("postfix", new Object[] {"?tcpNoDelay=true&keepAlive=true"});
}
public void testBadVersionNumberDoesNotWork() throws Exception { public void testBadVersionNumberDoesNotWork() throws Exception {
String uri = prefix + bindAddress + postfix + "&minmumWireFormatVersion=65535"; String uri = prefix + bindAddress + postfix + "&minmumWireFormatVersion=65535";
// System.out.println("Connecting via: " + uri); LOG.info("Connecting via: " + uri);
try { try {
connection = new ActiveMQConnectionFactory(uri).createConnection(); connection = new ActiveMQConnectionFactory(uri).createConnection();
@ -52,9 +69,14 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport {
} }
} }
public void initCombosForTestBadPropertyNameFails() {
addCombinationValues("prefix", new Object[] {""});
addCombinationValues("postfix", new Object[] {"?tcpNoDelay=true&keepAlive=true"});
}
public void testBadPropertyNameFails() throws Exception { public void testBadPropertyNameFails() throws Exception {
String uri = prefix + bindAddress + postfix + "&cheese=abc"; String uri = prefix + bindAddress + postfix + "&cheese=abc";
// System.out.println("Connecting via: " + uri); LOG.info("Connecting via: " + uri);
try { try {
connection = new ActiveMQConnectionFactory(uri).createConnection(); connection = new ActiveMQConnectionFactory(uri).createConnection();
@ -87,4 +109,8 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport {
answer.addConnector(bindAddress); answer.addConnector(bindAddress);
return answer; return answer;
} }
public static Test suite() {
return suite(TransportUriTest.class);
}
} }