summaryrefslogtreecommitdiff
path: root/python/tests_0-9
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-06-27 15:29:17 +0000
committerGordon Sim <gsim@apache.org>2007-06-27 15:29:17 +0000
commitd7c68d138a1151db2b0d133c94f8b1843850e867 (patch)
tree1171bf86137f08f2ece9e0516407a3735ecc3fca /python/tests_0-9
parentd3f472ec2033df0cc35f020819477e4f59077046 (diff)
downloadqpid-python-d7c68d138a1151db2b0d133c94f8b1843850e867.tar.gz
Fixes and tests:
* ExchangeRegistry::get() caused a pair to be inserted with a 'null' pointer if the xchange didn't exist * HeadersExchange::isBound() didn't check queue param git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551197 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests_0-9')
-rw-r--r--python/tests_0-9/query.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/python/tests_0-9/query.py b/python/tests_0-9/query.py
index 69111f03fa..c2e08c003c 100644
--- a/python/tests_0-9/query.py
+++ b/python/tests_0-9/query.py
@@ -136,8 +136,23 @@ class QueryTests(TestBase):
channel.queue_declare(queue="unused-queue", exclusive=True)
channel.queue_bind(exchange="amq.fanout", queue="used-queue")
+ # test detection of any binding to specific queue
response = channel.binding_query(exchange="amq.fanout", queue="used-queue")
self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(False, response.queue_not_matched)
+
+ # test unmatched queue, unspecified binding
+ response = channel.binding_query(exchange="amq.fanout", queue="unused-queue")
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(True, response.queue_not_matched)
+
+ #test exchange not found
+ self.assertEqual(True, channel.binding_query(exchange="unknown-exchange").exchange_not_found)
+
+ #test queue not found
+ self.assertEqual(True, channel.binding_query(exchange="amq.fanout", queue="unknown-queue").queue_not_found)
def test_binding_query_header(self):
"""
@@ -149,7 +164,61 @@ class QueryTests(TestBase):
channel.queue_declare(queue="unused-queue", exclusive=True)
channel.queue_bind(exchange="amq.match", queue="used-queue", arguments={"x-match":"all", "a":"A"} )
+ # test detection of any binding to specific queue
response = channel.binding_query(exchange="amq.match", queue="used-queue")
self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(False, response.queue_not_matched)
+ # test detection of specific binding to any queue
+ response = channel.binding_query(exchange="amq.match", arguments={"x-match":"all", "a":"A"})
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(False, response.args_not_matched)
+
+ # test detection of specific binding to specific queue
+ response = channel.binding_query(exchange="amq.match", queue="used-queue", arguments={"x-match":"all", "a":"A"})
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(False, response.queue_not_matched)
+ self.assertEqual(False, response.args_not_matched)
+
+ # test unmatched queue, unspecified binding
+ response = channel.binding_query(exchange="amq.match", queue="unused-queue")
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(True, response.queue_not_matched)
+
+ # test unspecified queue, unmatched binding
+ response = channel.binding_query(exchange="amq.match", arguments={"x-match":"all", "b":"B"})
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(True, response.args_not_matched)
+
+ # test matched queue, unmatched binding
+ response = channel.binding_query(exchange="amq.match", queue="used-queue", arguments={"x-match":"all", "b":"B"})
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(False, response.queue_not_matched)
+ self.assertEqual(True, response.args_not_matched)
+
+ # test unmatched queue, matched binding
+ response = channel.binding_query(exchange="amq.match", queue="unused-queue", arguments={"x-match":"all", "a":"A"})
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(True, response.queue_not_matched)
+ self.assertEqual(False, response.args_not_matched)
+
+ # test unmatched queue, unmatched binding
+ response = channel.binding_query(exchange="amq.match", queue="unused-queue", arguments={"x-match":"all", "b":"B"})
+ self.assertEqual(False, response.exchange_not_found)
+ self.assertEqual(False, response.queue_not_found)
+ self.assertEqual(True, response.queue_not_matched)
+ self.assertEqual(True, response.args_not_matched)
+
+ #test exchange not found
+ self.assertEqual(True, channel.binding_query(exchange="unknown-exchange").exchange_not_found)
+
+ #test queue not found
+ self.assertEqual(True, channel.binding_query(exchange="amq.match", queue="unknown-queue").queue_not_found)