summaryrefslogtreecommitdiff
path: root/qpid/python
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2011-03-17 13:03:08 +0000
committerRafael H. Schloming <rhs@apache.org>2011-03-17 13:03:08 +0000
commit870e17065214e27452ae38a6f3ae74cfe5df8f8a (patch)
tree63fe08f32e2e1bd567a7422698851cf4372602fd /qpid/python
parente03f8a193453c44aef4b54c092d6788977c953c6 (diff)
downloadqpid-python-870e17065214e27452ae38a6f3ae74cfe5df8f8a.tar.gz
added support for address assertion
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1082478 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/qpid/messaging/driver.py8
-rw-r--r--qpid/python/qpid/tests/messaging/endpoints.py7
2 files changed, 14 insertions, 1 deletions
diff --git a/qpid/python/qpid/messaging/driver.py b/qpid/python/qpid/messaging/driver.py
index 1323e4185c..67b0ff909d 100644
--- a/qpid/python/qpid/messaging/driver.py
+++ b/qpid/python/qpid/messaging/driver.py
@@ -930,6 +930,7 @@ class Engine:
def resolve_declare(self, sst, lnk, dir, action):
declare = lnk.options.get("create") in ("always", dir)
+ assrt = lnk.options.get("assert") in ("always", dir)
def do_resolved(type, subtype):
err = None
if type is None:
@@ -938,7 +939,12 @@ class Engine:
else:
err = NotFound(text="no such queue: %s" % lnk.name)
else:
- action(type, subtype)
+ if assrt:
+ expected = lnk.options.get("node", {}).get("type")
+ if type != expected:
+ err = AssertionFailed(text="expected %s, got %s" % (expected, type))
+ if err is None:
+ action(type, subtype)
if err:
tgt = lnk.target
diff --git a/qpid/python/qpid/tests/messaging/endpoints.py b/qpid/python/qpid/tests/messaging/endpoints.py
index 419d0cb395..1929a47a6b 100644
--- a/qpid/python/qpid/tests/messaging/endpoints.py
+++ b/qpid/python/qpid/tests/messaging/endpoints.py
@@ -1186,6 +1186,13 @@ test-link-bindings-queue; {
snd.send(m)
self.drain(qrcv, expected=msgs)
+ def testAssert(self):
+ try:
+ snd = self.ssn.sender("amq.topic; {assert: always, node: {type: queue}}")
+ assert 0, "assertion failed to trigger"
+ except AssertionFailed, e:
+ pass
+
NOSUCH_Q = "this-queue-should-not-exist"
UNPARSEABLE_ADDR = "name/subject; {bad options"
UNLEXABLE_ADDR = "\0x0\0x1\0x2\0x3"