You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2007/02/12 19:19:41 UTC
svn commit: r506565 -
/incubator/qpid/branches/qpid.0-9/python/tests/message.py
Author: gsim
Date: Mon Feb 12 10:19:40 2007
New Revision: 506565
URL: http://svn.apache.org/viewvc?view=rev&rev=506565
Log:
Added test for checkpointing
Modified:
incubator/qpid/branches/qpid.0-9/python/tests/message.py
Modified: incubator/qpid/branches/qpid.0-9/python/tests/message.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/tests/message.py?view=diff&rev=506565&r1=506564&r2=506565
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/tests/message.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/tests/message.py Mon Feb 12 10:19:40 2007
@@ -628,14 +628,38 @@
channel.message_consume(queue = "q", destination = "consumer")
channel.message_transfer(routing_key = "q", body="blah, blah")
- msg = self.client.queue("consumer").get(timeout = 5)
+ msg = self.client.queue("consumer").get(timeout = 1)
self.assertEquals(msg.body, "blah, blah")
channel.message_cancel(destination = "consumer")
msg.reject()
channel.message_consume(queue = "q", destination = "checker")
- msg = self.client.queue("checker").get(timeout = 5)
+ msg = self.client.queue("checker").get(timeout = 1)
self.assertEquals(msg.body, "blah, blah")
+
+ def test_checkpoint(self):
+ channel = self.channel
+ channel.queue_declare(queue = "q", exclusive=True)
+
+ channel.message_open(reference="my-ref")
+ channel.message_append(reference="my-ref", bytes="abcdefgh")
+ channel.message_append(reference="my-ref", bytes="ijklmnop")
+ channel.message_checkpoint(reference="my-ref", identifier="my-checkpoint")
+ channel.channel_close()
+
+ channel = self.client.channel(2)
+ channel.channel_open()
+ channel.message_consume(queue = "q", destination = "consumer")
+ offset = channel.channel_resume(reference="my-ref", identifier="my-checkpoint").value
+ self.assertEquals(offset, 16)
+ channel.message_append(reference="my-ref", bytes="qrstuvwx")
+ channel.synchronous = False
+ channel.message_transfer(routing_key="q-one", message_id="abcd", body=ReferenceId("my-ref"))
+ channel.synchronous = True
+ channel.message_close(reference="my-ref")
+
+ self.assertDataEquals(channel, self.client.queue("consumer").get(timeout = 1))
+ self.assertEmpty(self.client.queue("consumer"))
def assertDataEquals(self, channel, msg, expected):