summaryrefslogtreecommitdiff
path: root/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java50
1 files changed, 16 insertions, 34 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
index ec222ff03d..40890fae87 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
@@ -20,58 +20,47 @@
*/
package org.apache.qpid.server.failover;
-import junit.framework.TestCase;
+import java.util.concurrent.CountDownLatch;
+
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
import org.apache.qpid.AMQDisconnectedException;
import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQConnectionURL;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.util.InternalBrokerBaseCase;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.transport.vm.VMBrokerCreationException;
+import org.apache.qpid.transport.vm.VmBroker;
import org.apache.qpid.url.URLSyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import java.util.concurrent.CountDownLatch;
-
-public class FailoverMethodTest extends InternalBrokerBaseCase implements ExceptionListener
+public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionListener
{
private CountDownLatch _failoverComplete = new CountDownLatch(1);
protected static final Logger _logger = LoggerFactory.getLogger(FailoverMethodTest.class);
@Override
- public void createBroker() throws Exception
+ public void setUp() throws Exception
{
- super.createBroker();
- TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- }
-
- @Override
- public void stopBroker()
- {
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- super.stopBroker();
+ _broker = VM;
+ super.setUp();
}
/**
* Test that the round robin method has the correct delays.
* The first connection to vm://:1 will work but the localhost connection should fail but the duration it takes
* to report the failure is what is being tested.
- *
- * @throws URLSyntaxException
- * @throws InterruptedException
- * @throws JMSException
*/
- public void testFailoverRoundRobinDelay() throws URLSyntaxException, InterruptedException, JMSException
+ public void testFailoverRoundRobinDelay() throws Exception
{
//note: The VM broker has no connect delay and the default 1 retry
// while the tcp:localhost broker has 3 retries with a 2s connect delay
String connectionString = "amqp://guest:guest@/test?brokerlist=" +
- "'vm://:" + ApplicationRegistry.DEFAULT_INSTANCE +
+ "'vm://:1" +
";tcp://localhost:5670?connectdelay='2000',retries='3''";
AMQConnectionURL url = new AMQConnectionURL(connectionString);
@@ -112,8 +101,7 @@ public class FailoverMethodTest extends InternalBrokerBaseCase implements Except
}
}
- public void testFailoverSingleDelay() throws URLSyntaxException, AMQVMBrokerCreationException,
- InterruptedException, JMSException
+ public void testFailoverSingleDelay() throws Exception
{
String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='2000',retries='3''";
@@ -168,14 +156,8 @@ public class FailoverMethodTest extends InternalBrokerBaseCase implements Except
*
* Test validates that there is a connection delay as required on initial
* connection.
- *
- * @throws URLSyntaxException
- * @throws AMQVMBrokerCreationException
- * @throws InterruptedException
- * @throws JMSException
*/
- public void testNoFailover() throws URLSyntaxException, AMQVMBrokerCreationException,
- InterruptedException, JMSException
+ public void testNoFailover() throws Exception
{
int CONNECT_DELAY = 2000;
String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='" + CONNECT_DELAY + "'," +
@@ -198,7 +180,7 @@ public class FailoverMethodTest extends InternalBrokerBaseCase implements Except
//Wait before starting broker
// The wait should allow atleast 1 retries to fail before broker is ready
Thread.sleep(750);
- createBroker();
+ startBroker();
}
catch (Exception e)
{