From 74bc9ffe9db4cc43fc761bf0ca1a50a5c409476c Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Wed, 20 Aug 2008 16:29:31 +0000 Subject: QPID-1217: make temporary queue creation actually create the temporary queue. AMQSession*: consolidate createTemporaryQueue into AMQSession. ConnectionTest: declare custom exchanges before testing them TemporaryQueueTest: add test for QPID-1217 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@687383 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/client/AMQSession.java | 24 +++++++++++- .../org/apache/qpid/client/AMQSession_0_10.java | 22 ----------- .../org/apache/qpid/client/AMQSession_0_8.java | 7 ---- .../unit/client/connection/ConnectionTest.java | 21 ++++++++++- .../client/temporaryqueue/TemporaryQueueTest.java | 44 ++++++++++++++++++++-- 5 files changed, 84 insertions(+), 34 deletions(-) (limited to 'java') diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index 5203a27f42..39f2ad5048 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -1194,7 +1194,29 @@ public abstract class AMQSession _exceptions = new ArrayList(); + protected void setUp() throws Exception { super.setUp(); @@ -53,7 +58,7 @@ public class TemporaryQueueTest extends QpidTestCase return getConnection("guest", "guest"); } - public void testTempoaryQueue() throws Exception + public void testTemporaryQueue() throws Exception { Connection conn = createConnection(); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -212,9 +217,42 @@ public class TemporaryQueueTest extends QpidTestCase } } - + public void testQPID1217() throws Exception + { + Connection conA = getConnection(); + conA.setExceptionListener(this); + Session sessA = conA.createSession(false, Session.AUTO_ACKNOWLEDGE); + TemporaryQueue temp = sessA.createTemporaryQueue(); + + MessageProducer prod = sessA.createProducer(temp); + prod.send(sessA.createTextMessage("hi")); + + Thread.sleep(500); + assertTrue("Exception received", _exceptions.isEmpty()); + + Connection conB = getConnection(); + Session sessB = conB.createSession(false, Session.AUTO_ACKNOWLEDGE); + + JMSException ex = null; + try + { + MessageConsumer consB = sessB.createConsumer(temp); + } + catch (JMSException e) + { + ex = e; + } + assertNotNull(ex); + } + public static junit.framework.Test suite() { return new junit.framework.TestSuite(TemporaryQueueTest.class); } + + public void onException(JMSException arg0) + { + _exceptions.add(arg0); + } + } -- cgit v1.2.1