From 20a5f81e8bbf8d4429d55fffb47278e7ade81c17 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 14 Feb 2007 11:39:26 +0000 Subject: Expanded the use of batched acks to a few other places in tests. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@507491 13f79535-47bb-0310-9956-ffa450edef68 --- python/tests/message.py | 32 ++++++++------------------------ python/tests/tx.py | 3 ++- 2 files changed, 10 insertions(+), 25 deletions(-) (limited to 'python') diff --git a/python/tests/message.py b/python/tests/message.py index 84219bfe25..c6cbebed26 100644 --- a/python/tests/message.py +++ b/python/tests/message.py @@ -171,8 +171,7 @@ class MessageTests(TestBase): self.assertEqual("Four", msg4.body) self.assertEqual("Five", msg5.body) - msg1.ok() - msg2.ok() + msg1.ok(batchoffset=1)#One and Two msg4.ok() channel.message_recover(requeue=False) @@ -216,9 +215,8 @@ class MessageTests(TestBase): self.assertEqual("Four", msg4.body) self.assertEqual("Five", msg5.body) - msg1.ok() #One - msg2.ok() #Two - msg4.ok() #Two + msg1.ok(batchoffset=1) #One and Two + msg4.ok() #Four channel.message_cancel(destination="consumer_tag") channel.message_consume(queue="test-requeue", destination="consumer_tag") @@ -263,11 +261,9 @@ class MessageTests(TestBase): channel.message_transfer(routing_key="test-prefetch-count", body="Message %d" % i) #only 5 messages should have been delivered: - msgs = [] for i in range(1, 6): msg = queue.get(timeout=1) self.assertEqual("Message %d" % i, msg.body) - msgs.append(msg) try: extra = queue.get(timeout=1) self.fail("Got unexpected 6th message in original queue: " + extra.body) @@ -275,18 +271,13 @@ class MessageTests(TestBase): #ack messages and check that the next set arrive ok: #todo: once batching is implmented, send a single response for all messages - for msg in msgs: - msg.ok() - msgs = [] + msg.ok(batchoffset=-4)#1-5 for i in range(6, 11): msg = queue.get(timeout=1) self.assertEqual("Message %d" % i, msg.body) - msgs.append(msg) - for msg in msgs: - msg.ok() - msgs = [] + msg.ok(batchoffset=-4)#6-10 try: extra = queue.get(timeout=1) @@ -313,11 +304,9 @@ class MessageTests(TestBase): channel.message_transfer(routing_key="test-prefetch-size", body="Message %d" % i) #only 5 messages should have been delivered (i.e. 45 bytes worth): - msgs = [] for i in range(1, 6): msg = queue.get(timeout=1) self.assertEqual("Message %d" % i, msg.body) - msgs.append(msg) try: extra = queue.get(timeout=1) @@ -325,18 +314,13 @@ class MessageTests(TestBase): except Empty: None #ack messages and check that the next set arrive ok: - for msg in msgs: - msg.ok() - msgs = [] + msg.ok(batchoffset=-4)#1-5 for i in range(6, 11): msg = queue.get(timeout=1) self.assertEqual("Message %d" % i, msg.body) - msgs.append(msg) - for msg in msgs: - msg.ok() - msgs = [] + msg.ok(batchoffset=-4)#6-10 try: extra = queue.get(timeout=1) @@ -386,7 +370,7 @@ class MessageTests(TestBase): self.assertEqual("Message %d" % i, msg.body) if (i==13): - msg.ok(batchoffset=-2) + msg.ok(batchoffset=-2)#11, 12 & 13 if(i in [15, 17, 19]): msg.ok() diff --git a/python/tests/tx.py b/python/tests/tx.py index 55a5eaeade..0f6b4f5cd1 100644 --- a/python/tests/tx.py +++ b/python/tests/tx.py @@ -163,7 +163,8 @@ class TxTests(TestBase): for i in range(1, 5): msg = queue_a.get(timeout=1) self.assertEqual("Message %d" % i, msg.body) - msg.ok() + + msg.ok(batchoffset=-3) channel.message_consume(queue=name_b, destination="sub_b", no_ack=False) queue_b = self.client.queue("sub_b") -- cgit v1.2.1