diff options
author | Keith Wall <kwall@apache.org> | 2014-07-24 17:39:15 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2014-07-24 17:39:15 +0000 |
commit | 9651210770b5c2ff04877739403687f06e72ba3c (patch) | |
tree | 3e1f772cfca42acf0b8cb7f8d80255cf49556fed /qpid/java/systests | |
parent | f87df8d18a1fa100fc862ad2160cadd3d9de9a9f (diff) | |
download | qpid-python-9651210770b5c2ff04877739403687f06e72ba3c.tar.gz |
QPID-5915: [Java Broker] Ensure that closing a Connection model object also cause the underlying connection to close too
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1613197 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/systests')
-rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java index b7874ee85e..58f1bfe372 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java @@ -20,10 +20,10 @@ */ package org.apache.qpid.test.unit.client.channelclose; -import org.apache.qpid.client.AMQConnection; -import org.apache.qpid.client.AMQTopic; import org.apache.qpid.test.utils.QpidBrokerTestCase; +import javax.jms.Connection; +import javax.jms.Destination; import javax.jms.MessageConsumer; import javax.jms.Session; @@ -34,22 +34,12 @@ public class CloseWithBlockingReceiveTest extends QpidBrokerTestCase { - protected void setUp() throws Exception - { - super.setUp(); - } - - protected void tearDown() throws Exception - { - super.tearDown(); - } - - public void testReceiveReturnsNull() throws Exception { - final AMQConnection connection = (AMQConnection) getConnection("guest", "guest"); + final Connection connection = getConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer consumer = session.createConsumer(new AMQTopic(connection, "banana")); + Destination destination = session.createQueue(getTestQueueName()); + MessageConsumer consumer = session.createConsumer(destination); connection.start(); Runnable r = new Runnable() @@ -68,14 +58,16 @@ public class CloseWithBlockingReceiveTest extends QpidBrokerTestCase } }; long startTime = System.currentTimeMillis(); - new Thread(r).start(); - consumer.receive(10000); - assertTrue(System.currentTimeMillis() - startTime < 10000); - } - - public static junit.framework.Test suite() - { - return new junit.framework.TestSuite(CloseWithBlockingReceiveTest.class); + Thread thread = new Thread(r); + thread.start(); + try + { + consumer.receive(10000); + assertTrue(System.currentTimeMillis() - startTime < 10000); + } + finally + { + thread.join(); + } } - } |