summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-10-04 12:46:42 +0000
committerGordon Sim <gsim@apache.org>2007-10-04 12:46:42 +0000
commita2bf1ed0aefab8ef3cd1236e2ce1a89b0ce0ba1b (patch)
tree29c0560d540f2df2f7ec622bf2b8cbe9679a1591
parent432d462ba754a7452bfcc3650530e4c4cd47b13d (diff)
downloadqpid-python-a2bf1ed0aefab8ef3cd1236e2ce1a89b0ce0ba1b.tar.gz
Added test for ordering of released messages
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@581880 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/python/tests_0-10/message.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/qpid/python/tests_0-10/message.py b/qpid/python/tests_0-10/message.py
index 967c03bbea..6931f83a6b 100644
--- a/qpid/python/tests_0-10/message.py
+++ b/qpid/python/tests_0-10/message.py
@@ -589,6 +589,30 @@ class MessageTests(TestBase):
#message should not have been removed from the queue:
self.assertEquals(1, channel.queue_query(queue = "q").message_count)
+ def test_release_ordering(self):
+ """
+ Test order of released messages is as expected
+ """
+ channel = self.channel
+ channel.queue_declare(queue = "q", exclusive=True)
+ for i in range (1, 11):
+ channel.message_transfer(content=Content(properties={'routing_key' : "q"}, body = "released message %s" % (i)))
+
+ channel.message_subscribe(queue = "q", destination = "a", confirm_mode = 1)
+ channel.message_flow(unit = 0, value = 10, destination = "a")
+ channel.message_flow(unit = 1, value = 0xFFFFFFFF, destination = "a")
+ queue = self.client.queue("a")
+ first = queue.get(timeout = 1)
+ for i in range (2, 10):
+ self.assertEquals("released message %s" % (i), queue.get(timeout = 1).content.body)
+ last = queue.get(timeout = 1)
+ self.assertEmpty(queue)
+ channel.message_release([first.command_id, last.command_id])
+ last.complete()#will re-allocate credit, as in window mode
+ for i in range (1, 11):
+ self.assertEquals("released message %s" % (i), queue.get(timeout = 1).content.body)
+
+
def assertDataEquals(self, channel, msg, expected):
self.assertEquals(expected, msg.content.body)