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/07/03 17:18:04 UTC
svn commit: r552872 - in /incubator/qpid/trunk/qpid/python/tests_0-9:
basic.py message.py queue.py
Author: gsim
Date: Tue Jul 3 08:18:03 2007
New Revision: 552872
URL: http://svn.apache.org/viewvc?view=rev&rev=552872
Log:
Changes to python tests for QPID-533 and QPID-407.
Modified:
incubator/qpid/trunk/qpid/python/tests_0-9/basic.py
incubator/qpid/trunk/qpid/python/tests_0-9/message.py
incubator/qpid/trunk/qpid/python/tests_0-9/queue.py
Modified: incubator/qpid/trunk/qpid/python/tests_0-9/basic.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-9/basic.py?view=diff&rev=552872&r1=552871&r2=552872
==============================================================================
--- incubator/qpid/trunk/qpid/python/tests_0-9/basic.py (original)
+++ incubator/qpid/trunk/qpid/python/tests_0-9/basic.py Tue Jul 3 08:18:03 2007
@@ -218,10 +218,11 @@
channel.basic_ack(delivery_tag=msg4.delivery_tag, multiple=False) #Four
channel.basic_cancel(consumer_tag=subscription.consumer_tag)
- subscription2 = channel.basic_consume(queue="test-requeue")
- queue2 = self.client.queue(subscription2.consumer_tag)
channel.basic_recover(requeue=True)
+
+ subscription2 = channel.basic_consume(queue="test-requeue")
+ queue2 = self.client.queue(subscription2.consumer_tag)
msg3b = queue2.get(timeout=1)
msg5b = queue2.get(timeout=1)
Modified: incubator/qpid/trunk/qpid/python/tests_0-9/message.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-9/message.py?view=diff&rev=552872&r1=552871&r2=552872
==============================================================================
--- incubator/qpid/trunk/qpid/python/tests_0-9/message.py (original)
+++ incubator/qpid/trunk/qpid/python/tests_0-9/message.py Tue Jul 3 08:18:03 2007
@@ -219,10 +219,14 @@
msg4.ok() #Four
channel.message_cancel(destination="consumer_tag")
- channel.message_consume(queue="test-requeue", destination="consumer_tag")
- queue2 = self.client.queue("consumer_tag")
+ #publish a new message
+ channel.message_transfer(routing_key="test-requeue", body="Six")
+ #requeue unacked messages (Three and Five)
channel.message_recover(requeue=True)
+
+ channel.message_consume(queue="test-requeue", destination="consumer_tag")
+ queue2 = self.client.queue("consumer_tag")
msg3b = queue2.get(timeout=1)
msg5b = queue2.get(timeout=1)
@@ -232,6 +236,8 @@
self.assertEqual(True, msg3b.redelivered)
self.assertEqual(True, msg5b.redelivered)
+
+ self.assertEqual("Six", queue2.get(timeout=1).body)
try:
extra = queue2.get(timeout=1)
Modified: incubator/qpid/trunk/qpid/python/tests_0-9/queue.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-9/queue.py?view=diff&rev=552872&r1=552871&r2=552872
==============================================================================
--- incubator/qpid/trunk/qpid/python/tests_0-9/queue.py (original)
+++ incubator/qpid/trunk/qpid/python/tests_0-9/queue.py Tue Jul 3 08:18:03 2007
@@ -304,3 +304,37 @@
self.assertChannelException(404, e.args[0])
+ def test_autodelete_shared(self):
+ """
+ Test auto-deletion (of non-exclusive queues)
+ """
+ channel = self.channel
+ other = self.connect()
+ channel2 = other.channel(1)
+ channel2.channel_open()
+
+ channel.queue_declare(queue="auto-delete-me", auto_delete=True)
+
+ #consume from both channels
+ reply = channel.basic_consume(queue="auto-delete-me", no_ack=True)
+ channel2.basic_consume(queue="auto-delete-me", no_ack=True)
+
+ #implicit cancel
+ channel2.channel_close()
+
+ #check it is still there
+ channel.queue_declare(queue="auto-delete-me", passive=True)
+
+ #explicit cancel => queue is now unused again:
+ channel.basic_cancel(consumer_tag=reply.consumer_tag)
+
+ #NOTE: this assumes there is no timeout in use
+
+ #check that it has gone be declaring passively
+ try:
+ channel.queue_declare(queue="auto-delete-me", passive=True)
+ self.fail("Expected queue to have been deleted")
+ except Closed, e:
+ self.assertChannelException(404, e.args[0])
+
+