summaryrefslogtreecommitdiff
path: root/qpid/python
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
commita5f95fd26f628f6ae45bd276505aaeb5177a1949 (patch)
treebf0a7ccd30cabcca717ee14f6086a02bafc136e5 /qpid/python
parent576b4c0c1cfc411fd6ebe62b79d799477dc1910d (diff)
downloadqpid-python-a5f95fd26f628f6ae45bd276505aaeb5177a1949.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@551197 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/tests_0-9/query.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/qpid/python/tests_0-9/query.py b/qpid/python/tests_0-9/query.py
index 69111f03fa..c2e08c003c 100644
--- a/qpid/python/tests_0-9/query.py
+++ b/qpid/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)