diff options
author | Aidan Skinner <aidan@apache.org> | 2009-01-22 12:19:47 +0000 |
---|---|---|
committer | Aidan Skinner <aidan@apache.org> | 2009-01-22 12:19:47 +0000 |
commit | 66c69897b600bd53e09329c43b5b6363b2a764fc (patch) | |
tree | 0d7aa2cf30c6326c35f383d4382ec39926b719b5 | |
parent | 449c9b05e3fdec9c6114472b4243206c5817514e (diff) | |
download | qpid-python-66c69897b600bd53e09329c43b5b6363b2a764fc.tar.gz |
QPID-1418: Destroy and recreate consumer once all messages are
sent so that they have enough time to expire.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@736618 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java index 02db795534..834222fcc2 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/queue/TimeToLiveTest.java @@ -55,8 +55,13 @@ public class TimeToLiveTest extends QpidTestCase Session clientSession = clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = clientSession.createQueue(QUEUE); - + + // Create then close the consumer so the queue is actually created + // Closing it then reopening it ensures that the consumer shouldn't get messages + // which should have expired and allows a shorter sleep period. See QPID-1418 + MessageConsumer consumer = clientSession.createConsumer(queue); + consumer.close(); //Create Producer Connection producerConnection = getConnection(); @@ -82,10 +87,11 @@ public class TimeToLiveTest extends QpidTestCase producer.setTimeToLive(0L); producer.send(nextMessage(String.valueOf(msg), false, producerSession, producer)); - try + consumer = clientSession.createConsumer(queue); + try { // Sleep to ensure TTL reached - Thread.sleep(2000); + Thread.sleep(TIME_TO_LIVE); } catch (InterruptedException e) { |