diff options
author | Martin Ritchie <ritchiem@apache.org> | 2007-04-30 14:39:18 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2007-04-30 14:39:18 +0000 |
commit | 80b492223507dbb4a64a3e1c5e6e3f65ac53afa1 (patch) | |
tree | 105c9aafdc3d052150369f74b53935faaeb96083 | |
parent | 1b9c3bf37aca0e0d5114c2863b4f2b8070e42569 (diff) | |
download | qpid-python-80b492223507dbb4a64a3e1c5e6e3f65ac53afa1.tar.gz |
QPID-461 Update to CommitRollbackTest. Ensuring messages received have the correct redelivered value, regardless of order.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@533765 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java index 685fe20048..8aaa760537 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java @@ -390,7 +390,6 @@ public class CommitRollbackTest extends TestCase assertEquals("1", ((TextMessage) result).getText()); assertTrue("Messasge is marked as redelivered" + result, !result.getJMSRedelivered()); - _logger.info("Closing Consumer"); _consumer.close(); @@ -398,31 +397,32 @@ public class CommitRollbackTest extends TestCase _consumer = _session.createConsumer(_jmsQueue); _logger.info("receiving result"); + + // NOTE: Both msg 1 & 2 will be marked as redelivered as they have both will have been rejected. + // Only the occasion where it is not rejected will it mean it hasn't arrived at the client yet. result = _consumer.receive(1000); assertNotNull("test message was consumed and rolled back, but is gone", result); + + // The first message back will be either 1 or 2 being redelivered if (result.getJMSRedelivered()) { - assertEquals("1", ((TextMessage) result).getText()); - - result = _consumer.receive(1000); - assertNotNull("test message was consumed and rolled back, but is gone", result); - assertEquals("2", ((TextMessage) result).getText()); assertTrue("Messasge is not marked as redelivered" + result, result.getJMSRedelivered()); } - else + else // or it will be msg 2 arriving the first time due to latency. { - assertEquals("2", ((TextMessage) result).getText()); - assertTrue("Messasge is marked as redelivered" + result, !result.getJMSRedelivered()); + _logger.info("Message 2 wasn't prefetched so wasn't rejected"); + assertEquals("2", ((TextMessage) result).getText()); + } - result = _consumer.receive(1000); - assertNotNull("test message was consumed and rolled back, but is gone", result); - assertEquals("1", ((TextMessage) result).getText()); - assertTrue("Messasge is not marked as redelivered" + result, result.getJMSRedelivered()); + result = _consumer.receive(1000); + assertNotNull("test message was consumed and rolled back, but is gone", result); + assertTrue("Messasge is not marked as redelivered" + result, result.getJMSRedelivered()); - } result = _consumer.receive(1000); assertNull("test message should be null:" + result, result); + _session.commit(); + } |