diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-08-06 09:41:33 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-08-06 09:41:33 +0000 |
| commit | fff1166174f6b2aeb7ebfe14eee9007093423869 (patch) | |
| tree | 373b1c971fae6c08501ddcac3d74d2611864cc52 /qpid/java | |
| parent | 5790989fd05cc3694fab20804f719f38093dfd55 (diff) | |
| download | qpid-python-fff1166174f6b2aeb7ebfe14eee9007093423869.tar.gz | |
QPID-1223 : Non QTC and some QTC tests are still not correctly cleaning up the VM state after their test run. Updated all tests to use the default AR,getInstance() before creation of a TransportConnection (which now uses AR.DEFAULT_INSTANCE rather than '1'). On shutdown updated to ensure AR.remove() is called and not just AR.close()
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@801574 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
9 files changed, 49 insertions, 61 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java index 422c70d76b..f261858fcd 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java @@ -87,7 +87,6 @@ public class AMQQueueDeferredOrderingTest extends QpidTestCase protected void setUp() throws Exception { super.setUp(); - TransportConnection.createVMBroker(1); _logger.info("Create Connection"); con = getConnection(); @@ -135,7 +134,6 @@ public class AMQQueueDeferredOrderingTest extends QpidTestCase _logger.info("Closing connection"); con.close(); - TransportConnection.killAllVMBrokers(); super.tearDown(); } 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 cb9ba44e27..1683c5e3d6 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 @@ -23,6 +23,7 @@ package org.apache.qpid.server.failover; import junit.framework.TestCase; import org.apache.qpid.AMQDisconnectedException; import org.apache.qpid.AMQException; +import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.client.transport.TransportConnection; @@ -39,12 +40,14 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener public void setUp() throws AMQVMBrokerCreationException { - TransportConnection.createVMBroker(1); + ApplicationRegistry.getInstance(); + TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); } - public void tearDown() throws AMQVMBrokerCreationException + public void tearDown() { - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); + ApplicationRegistry.remove(); } /** @@ -61,7 +64,8 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener //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://:1;tcp://localhost:5670?connectdelay='2000',retries='3''"; + "'vm://:" + ApplicationRegistry.DEFAULT_INSTANCE + + ";tcp://localhost:5670?connectdelay='2000',retries='3''"; AMQConnectionURL url = new AMQConnectionURL(connectionString); @@ -72,7 +76,8 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener connection.setExceptionListener(this); - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); + ApplicationRegistry.remove(); _failoverComplete.await(); @@ -115,7 +120,8 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener connection.setExceptionListener(this); - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); + ApplicationRegistry.remove(); _failoverComplete.await(); @@ -160,7 +166,8 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener try { //Kill initial broker - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); + ApplicationRegistry.remove(); //Create a thread to start the broker asynchronously Thread brokerStart = new Thread(new Runnable() @@ -172,7 +179,8 @@ 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); - TransportConnection.createVMBroker(1); + ApplicationRegistry.getInstance(); + TransportConnection.createVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); } catch (Exception e) { @@ -206,7 +214,8 @@ public class FailoverMethodTest extends TestCase implements ExceptionListener start = System.currentTimeMillis(); //Kill connection - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); + ApplicationRegistry.remove(); _failoverComplete.await(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java index eb09bbeb16..ded2e0913b 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java @@ -25,6 +25,7 @@ import junit.framework.TestCase; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.qpid.AMQException; +import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.transport.TransportConnection; @@ -88,6 +89,7 @@ public class QueueDepthWithSelectorTest extends TestCase if (BROKER.startsWith("vm://")) { + ApplicationRegistry.getInstance(1); TransportConnection.createVMBroker(1); } InitialContextFactory factory = new PropertiesFileInitialContextFactory(); @@ -120,7 +122,8 @@ public class QueueDepthWithSelectorTest extends TestCase if (BROKER.startsWith("vm://")) { - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(1); + ApplicationRegistry.remove(1); } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java index 3d310331db..b5c0a87b0f 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java @@ -67,7 +67,7 @@ public class SimpleACLTest extends QpidTestCase implements ConnectionListener public void tearDown() { - TransportConnection.killAllVMBrokers(); + TransportConnection.killVMBroker(ApplicationRegistry.DEFAULT_INSTANCE); ApplicationRegistry.remove(ApplicationRegistry.DEFAULT_INSTANCE); } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/qpid/InVMBrokerDecorator.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/qpid/InVMBrokerDecorator.java index e0fddb10b7..b92a72a654 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/qpid/InVMBrokerDecorator.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/framework/qpid/InVMBrokerDecorator.java @@ -88,6 +88,7 @@ public class InVMBrokerDecorator extends WrappedSuiteTestDecorator // Ensure that the in-vm broker is created. try { + ApplicationRegistry.getInstance(1); TransportConnection.createVMBroker(1); } catch (AMQVMBrokerCreationException e) diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java index 4e85c28e9b..4596878935 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java @@ -148,18 +148,6 @@ public class MultipleConnectionTest extends QpidTestCase } } - protected void setUp() throws Exception - { - super.setUp(); - TransportConnection.createVMBroker(1); - } - - protected void tearDown() throws Exception - { - super.tearDown(); - TransportConnection.killAllVMBrokers(); - } - private static void waitForCompletion(int expected, long wait, Receiver[] receivers) throws InterruptedException { for (int i = 0; i < receivers.length; i++) diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java index b843f7c9c0..2710e7a08d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java @@ -67,13 +67,11 @@ public class ChannelCloseOkTest extends QpidTestCase private final List<Message> _received2 = new ArrayList<Message>(); private static final Logger _log = LoggerFactory.getLogger(ChannelCloseOkTest.class); - public String _connectionString = "vm://:1"; protected void setUp() throws Exception { super.setUp(); - TransportConnection.createVMBroker(1); _connection = (AMQConnection) getConnection("guest", "guest"); _destination1 = new AMQQueue(_connection, "q1", true); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java index d210f5e1a1..5a4d905b35 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java @@ -54,18 +54,6 @@ public class ChannelCloseTest extends QpidTestCase implements ExceptionListener, private static final long SYNC_TIMEOUT = 500; private int TEST = 0; - protected void setUp() throws Exception - { - super.setUp(); - TransportConnection.createVMBroker(1); - } - - protected void tearDown() throws Exception - { - super.tearDown(); - TransportConnection.killAllVMBrokers(); - } - /* close channel, use chanel with same id ensure error. */ diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java index bb9c22f31a..f627d94419 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java @@ -24,8 +24,6 @@ import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQConnectionURL; import org.apache.qpid.client.AMQSession; -import org.apache.qpid.client.transport.TransportConnection; -import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException; import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.url.URLSyntaxException; @@ -44,37 +42,42 @@ public class CloseAfterConnectionFailureTest extends QpidTestCase implements Exc private CountDownLatch _latch = new CountDownLatch(1); private JMSException _fail; - public void testNoFailover() throws URLSyntaxException, AMQVMBrokerCreationException, + public void testNoFailover() throws URLSyntaxException, Exception, InterruptedException, JMSException { - String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='500',retries='3'',failover='nofailover'"; + //This test uses hard coded connection string so only runs on InVM case + if (!isExternalBroker()) + { + String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='500',retries='3'',failover='nofailover'"; - AMQConnectionURL url = new AMQConnectionURL(connectionString); + AMQConnectionURL url = new AMQConnectionURL(connectionString); - try - { - //Start the connection so it will use the retries - connection = new AMQConnection(url, null); + try + { + //Start the connection so it will use the retries + connection = new AMQConnection(url, null); - connection.setExceptionListener(this); + connection.setExceptionListener(this); - session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - consumer = session.createConsumer(session.createQueue(this.getName())); + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + consumer = session.createConsumer(session.createQueue(this.getName())); - //Kill connection - TransportConnection.killAllVMBrokers(); - _latch.await(); + //Kill connection + stopBroker(); - if (_fail != null) + _latch.await(); + + if (_fail != null) + { + _fail.printStackTrace(System.out); + fail("Exception thrown:" + _fail.getMessage()); + } + } + catch (AMQException e) { - _fail.printStackTrace(System.out); - fail("Exception thrown:" + _fail.getMessage()); + fail(e.getMessage()); } } - catch (AMQException e) - { - fail(e.getMessage()); - } } public void onException(JMSException e) |
