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 | fe3713faf7154ba21a460fd0624b1ed2a2694547 (patch) | |
| tree | 5574435ce188cca80b2395b1bd86fd15483cc17b /qpid/java | |
| parent | c42536762c07e1c05ea67eeebfa525d441f0eeef (diff) | |
| download | qpid-python-fe3713faf7154ba21a460fd0624b1ed2a2694547.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@683955 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java index 136726a640..40d4ae9be5 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/DupsOkTest.java +++ b/qpid/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(); } } |
