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 $
*/
public abstract class EmbeddedBrokerTestSupport extends TestCase {
public abstract class EmbeddedBrokerTestSupport extends CombinationTestSupport {
protected BrokerService broker;
// protected String bindAddress = "tcp://localhost:61616";

View File

@ -16,13 +16,29 @@
*/
package org.apache.activemq.transport.failover;
import junit.framework.Test;
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";
public void initCombosForTestUriOptionsWork() {
addCombinationValues("prefix", new Object[] {"failover:("});
addCombinationValues("postfix", new Object[] {")?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.JMSException;
import junit.framework.Test;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.activemq.broker.BrokerService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @version $Revision$
*/
public class TransportUriTest extends EmbeddedBrokerTestSupport {
protected String prefix = "";
protected String postfix = "?tcpNoDelay=true&keepAlive=true";
private static final Log LOG = LogFactory.getLog(TransportUriTest.class);
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 {
String uri = prefix + bindAddress + postfix;
// System.out.println("Connecting via: " + uri);
LOG.info("Connecting via: " + uri);
connection = new ActiveMQConnectionFactory(uri).createConnection();
connection.start();
}
public void initCombosForTestBadVersionNumberDoesNotWork() {
addCombinationValues("prefix", new Object[] {""});
addCombinationValues("postfix", new Object[] {"?tcpNoDelay=true&keepAlive=true"});
}
public void testBadVersionNumberDoesNotWork() throws Exception {
String uri = prefix + bindAddress + postfix + "&minmumWireFormatVersion=65535";
// System.out.println("Connecting via: " + uri);
LOG.info("Connecting via: " + uri);
try {
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 {
String uri = prefix + bindAddress + postfix + "&cheese=abc";
// System.out.println("Connecting via: " + uri);
LOG.info("Connecting via: " + uri);
try {
connection = new ActiveMQConnectionFactory(uri).createConnection();
@ -87,4 +109,8 @@ public class TransportUriTest extends EmbeddedBrokerTestSupport {
answer.addConnector(bindAddress);
return answer;
}
public static Test suite() {
return suite(TransportUriTest.class);
}
}