diff options
author | Martin Ritchie <ritchiem@apache.org> | 2007-05-01 12:28:03 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2007-05-01 12:28:03 +0000 |
commit | e446e7b10876a5e5bae6ff04c0e96b103e53023d (patch) | |
tree | aefbb8f22ee3165ae528e0340f5a13943a626b72 | |
parent | bd233dc56381e9e4354ecec4eeb95c2445b6d7d3 (diff) | |
download | qpid-python-e446e7b10876a5e5bae6ff04c0e96b103e53023d.tar.gz |
QPID-461 Update to CommitRollbackTest. Ensuring messages received have the correct redelivered value, regardless of order. Different test case also was problematic.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@534036 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java | 34 |
1 files changed, 27 insertions, 7 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 8aaa760537..0e718da19b 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 @@ -359,17 +359,37 @@ public class CommitRollbackTest extends TestCase _logger.info("receiving result"); Message 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.getJMSRedelivered()); - 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.getJMSRedelivered()); + + + if (((TextMessage) result).getText().equals("2")) + { + assertTrue("Messasge is marked as redelivered", !result.getJMSRedelivered()); + + result = _consumer.receive(1000); + assertEquals("1", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + } + else + { + assertEquals("1", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + 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.getJMSRedelivered()); + } result = _consumer.receive(1000); + if (result != null) + { + assertEquals("2", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + result = _consumer.receive(1000); + } + assertNull("test message should be null", result); } @@ -411,7 +431,7 @@ public class CommitRollbackTest extends TestCase else // or it will be msg 2 arriving the first time due to latency. { _logger.info("Message 2 wasn't prefetched so wasn't rejected"); - assertEquals("2", ((TextMessage) result).getText()); + assertEquals("2", ((TextMessage) result).getText()); } result = _consumer.receive(1000); |