diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2008-08-08 12:51:31 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2008-08-08 12:51:31 +0000 |
| commit | a69592248f9cff983bc6e53d83063de19ac30bd4 (patch) | |
| tree | 1d91cd97f834bd293a13f526ad703f9e6c1e1f5c /java | |
| parent | cc3240f1986ec2dc4886b75358f0c70a90a8e26c (diff) | |
| download | qpid-python-a69592248f9cff983bc6e53d83063de19ac30bd4.tar.gz | |
QPID-1226 : DupsOk test never creates the client so create one for the messages. Also improved the testing to ensure we check for failure scenarions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@683955 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java index 136726a640..40d4ae9be5 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java @@ -52,6 +52,10 @@ public class DupsOkTest extends QpidTestCase _queue = (Queue) getInitialContext().lookup("queue"); + //Declare the queue + Connection consumerConnection = getConnection(); + consumerConnection.createSession(false,Session.AUTO_ACKNOWLEDGE).createConsumer(_queue).close(); + //Create Producer put some messages on the queue Connection producerConnection = getConnection(); @@ -83,12 +87,14 @@ public class DupsOkTest extends QpidTestCase //Create Client Connection clientConnection = getConnection(); - clientConnection.start(); - final Session clientSession = clientConnection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE); MessageConsumer consumer = clientSession.createConsumer(_queue); + assertEquals("The queue should have msgs at start", MSG_COUNT, ((AMQSession) clientSession).getQueueDepth((AMQDestination) _queue)); + + clientConnection.start(); + consumer.setMessageListener(new MessageListener() { int _msgCount = 0; @@ -146,11 +152,13 @@ public class DupsOkTest extends QpidTestCase throw e; } - - // wait for the ack to get back - Thread.sleep(1000); + //Close consumer to give broker time to process in bound Acks. As The main thread will be released while + // before the dispatcher has sent the ack back to the broker. + consumer.close(); assertEquals("The queue should have 0 msgs left", 0, ((AMQSession) clientSession).getQueueDepth((AMQDestination) _queue)); + + clientConnection.close(); } } |
