summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-06-02 16:42:39 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-06-02 16:42:39 +0000
commit04b73758036cf8b6aac92174f192ce98fd2f3c92 (patch)
treed5c6232a68c6eb05f7045acdc24b1240b150b64d /java
parente0557a71239b4431c3c6133d5cb21a19f485560d (diff)
downloadqpid-python-04b73758036cf8b6aac92174f192ce98fd2f3c92.tar.gz
QPID-2632 : A couple of tests in Systests are actually InVM only tests but are not marked as so.
They only work InVM but require a client. These should be either updated to be broker tests and not need the client or updated to not relay on the InVM transport. Also updated the code in old_test to be in line with these changes. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@950640 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java31
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java29
-rw-r--r--java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java4
-rw-r--r--java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java17
4 files changed, 39 insertions, 42 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
index de4468dcc7..ec222ff03d 100644
--- a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
@@ -29,6 +29,7 @@ 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.url.URLSyntaxException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,22 +38,23 @@ import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import java.util.concurrent.CountDownLatch;
-public class FailoverMethodTest extends TestCase implements ExceptionListener
+public class FailoverMethodTest extends InternalBrokerBaseCase implements ExceptionListener
{
- private CountDownLatch _failoverComplete;
+ private CountDownLatch _failoverComplete = new CountDownLatch(1);
protected static final Logger _logger = LoggerFactory.getLogger(FailoverMethodTest.class);
- public void setUp() throws AMQVMBrokerCreationException
+ @Override
+ public void createBroker() throws Exception
{
- ApplicationRegistry.getInstance();
+ super.createBroker();
TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- _failoverComplete = new CountDownLatch(1);
}
- public void tearDown()
+ @Override
+ public void stopBroker()
{
TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ super.stopBroker();
}
/**
@@ -81,8 +83,7 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener
connection.setExceptionListener(this);
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
_failoverComplete.await();
@@ -125,8 +126,7 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener
connection.setExceptionListener(this);
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
_failoverComplete.await();
@@ -186,8 +186,7 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener
try
{
//Kill initial broker
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
//Create a thread to start the broker asynchronously
Thread brokerStart = new Thread(new Runnable()
@@ -199,8 +198,7 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener
//Wait before starting broker
// The wait should allow atleast 1 retries to fail before broker is ready
Thread.sleep(750);
- ApplicationRegistry.getInstance();
- TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ createBroker();
}
catch (Exception e)
{
@@ -234,8 +232,7 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener
start = System.currentTimeMillis();
//Kill connection
- TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
- ApplicationRegistry.remove();
+ stopBroker();
_failoverComplete.await();
diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
index 395ced436b..6211dd8e70 100644
--- a/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
@@ -31,6 +31,7 @@ import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.transport.TransportConnection;
import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.util.InternalBrokerBaseCase;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -51,12 +52,14 @@ import java.util.Hashtable;
* - The message is returned.
* - The broker doesn't leak memory.
* - The broker's state is correct after test.
+ *
+ * Why is this hardcoded to InVM testing, should be converted to QTC.
*/
-public class QueueDepthWithSelectorTest extends TestCase
+public class QueueDepthWithSelectorTest extends InternalBrokerBaseCase
{
protected static final Logger _logger = Logger.getLogger(QueueDepthWithSelectorTest.class);
- protected final String BROKER = "vm://:1";
+ protected final String BROKER = "vm://:"+ApplicationRegistry.DEFAULT_INSTANCE;
protected final String VHOST = "test";
protected final String QUEUE = this.getClass().getName();
@@ -75,8 +78,11 @@ public class QueueDepthWithSelectorTest extends TestCase
protected Queue _queue;
- protected void setUp() throws Exception
+ @Override
+ public void setUp() throws Exception
{
+ super.setUp();
+ TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
System.err.println("amqj.logging.level:" + System.getProperty("amqj.logging.level"));
System.err.println("_logger.level:" + _logger.getLevel());
@@ -88,11 +94,6 @@ public class QueueDepthWithSelectorTest extends TestCase
System.err.println(Logger.getRootLogger().getLoggerRepository());
- if (BROKER.startsWith("vm://"))
- {
- ApplicationRegistry.getInstance(1);
- TransportConnection.createVMBroker(1);
- }
InitialContextFactory factory = new PropertiesFileInitialContextFactory();
Hashtable<String, String> env = new Hashtable<String, String>();
@@ -107,10 +108,9 @@ public class QueueDepthWithSelectorTest extends TestCase
init();
}
- protected void tearDown() throws Exception
+ @Override
+ public void tearDown() throws Exception
{
- super.tearDown();
-
if (_producerConnection != null)
{
_producerConnection.close();
@@ -121,11 +121,8 @@ public class QueueDepthWithSelectorTest extends TestCase
_clientConnection.close();
}
- if (BROKER.startsWith("vm://"))
- {
- TransportConnection.killVMBroker(1);
- ApplicationRegistry.remove(1);
- }
+ TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ super.tearDown();
}
public void test() throws Exception
diff --git a/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java b/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java
index 2c5712fd35..9784b2f671 100644
--- a/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java
+++ b/java/systests/src/old_test/java/org/apache/qpid/server/queue/SendPerfTest.java
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.queue;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.qpid.AMQException;
import org.apache.qpid.codec.AMQCodecFactory;
import org.apache.qpid.framing.BasicPublishBody;
@@ -28,6 +29,7 @@ import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.AMQChannel;
import org.apache.qpid.server.RequiredDeliveryException;
+import org.apache.qpid.server.configuration.ServerConfiguration;
import org.apache.qpid.server.txn.TransactionalContext;
import org.apache.qpid.server.txn.NonTransactionalContext;
import org.apache.qpid.server.exchange.AbstractExchange;
@@ -84,7 +86,7 @@ public class SendPerfTest extends TimedRun
public static void main(String[] argv) throws Exception
{
- ApplicationRegistry.initialise(new TestApplicationRegistry());
+ ApplicationRegistry.initialise(new TestApplicationRegistry(new ServerConfiguration(new PropertiesConfiguration())));
int clients = Integer.parseInt(argv[0]);
int messages = Integer.parseInt(argv[1]);
int iterations = Integer.parseInt(argv[2]);
diff --git a/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java b/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java
index 3e35e3c85b..04b6bceb4f 100644
--- a/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java
+++ b/java/systests/src/old_test/java/org/apache/qpid/test/unit/ack/DisconnectAndRedeliverTest.java
@@ -33,7 +33,7 @@ import org.apache.qpid.server.util.TestApplicationRegistry;
import javax.jms.*;
-public class DisconnectAndRedeliverTest extends TestCase
+public class DisconnectAndRedeliverTest extends InternalBrokerBaseCase
{
private static final Logger _logger = Logger.getLogger(DisconnectAndRedeliverTest.class);
@@ -49,17 +49,18 @@ public class DisconnectAndRedeliverTest extends TestCase
DOMConfigurator.configure("../broker/etc/log4j.xml");
}
- protected void setUp() throws Exception
+ @Override
+ public void createBroker() throws Exception
{
- super.setUp();
- TransportConnection.createVMBroker(1);
- ApplicationRegistry.initialise(new TestApplicationRegistry(), 1);
+ super.createBroker();
+ TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
}
- protected void tearDown() throws Exception
+ @Override
+ public void stopBroker()
{
- super.tearDown();
- TransportConnection.killAllVMBrokers();
+ TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE);
+ super.stopBroker();
}
/**