summaryrefslogtreecommitdiff
path: root/python/qpid/tests/messaging/endpoints.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-03-23 14:57:28 +0000
committerRafael H. Schloming <rhs@apache.org>2010-03-23 14:57:28 +0000
commitfe99d24c4084b2cb2479b820a5b44378d1812ffc (patch)
tree82dd1a8c229d9d86e266870769b6460fad7dd2e0 /python/qpid/tests/messaging/endpoints.py
parent166b7426164e35992d43d88b5c9e61c0482a41bd (diff)
downloadqpid-python-fe99d24c4084b2cb2479b820a5b44378d1812ffc.tar.gz
Several updates to address options including:
- renamed node-properties to node - added link to permit durable links (with names) - split x-properties into x-declare, x-subscribe, and x-bindings - removed automatic passthrough of unrecognized options (as this was confusing) git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@926604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/tests/messaging/endpoints.py')
-rw-r--r--python/qpid/tests/messaging/endpoints.py157
1 files changed, 104 insertions, 53 deletions
diff --git a/python/qpid/tests/messaging/endpoints.py b/python/qpid/tests/messaging/endpoints.py
index 3f2c823914..5d4fc1646b 100644
--- a/python/qpid/tests/messaging/endpoints.py
+++ b/python/qpid/tests/messaging/endpoints.py
@@ -247,9 +247,9 @@ class SessionTests(Base):
test-reject-queue; {
create: always,
delete: always,
- node-properties: {
- x-properties: {
- alternate_exchange: 'amq.topic'
+ node: {
+ x-declare: {
+ alternate-exchange: 'amq.topic'
}
}
}
@@ -515,7 +515,7 @@ class ReceiverTests(Base):
snd = self.ssn.sender("""test-double-close; {
create: always,
delete: sender,
- node-properties: {
+ node: {
type: topic
}
}
@@ -571,9 +571,9 @@ class AddressTests(Base):
assert "error in options: %s" % error == str(e), e
def testIllegalKey(self):
- self.badOption("{create: always, node-properties: "
+ self.badOption("{create: always, node: "
"{this-property-does-not-exist: 3}}",
- "node-properties: this-property-does-not-exist: "
+ "node: this-property-does-not-exist: "
"illegal key")
def testWrongValue(self):
@@ -581,23 +581,17 @@ class AddressTests(Base):
"('always', 'sender', 'receiver', 'never')")
def testWrongType1(self):
- self.badOption("{node-properties: asdf}",
- "node-properties: asdf is not a map")
+ self.badOption("{node: asdf}",
+ "node: asdf is not a map")
def testWrongType2(self):
- self.badOption("{node-properties: {durable: []}}",
- "node-properties: durable: [] is not a bool")
-
- def testNonQueueBindings(self):
- self.badOption("{node-properties: {type: topic, x-properties: "
- "{bindings: []}}}",
- "node-properties: x-properties: bindings: "
- "bindings are only permitted on nodes of type queue")
+ self.badOption("{node: {durable: []}}",
+ "node: durable: [] is not a bool")
def testCreateQueue(self):
snd = self.ssn.sender("test-create-queue; {create: always, delete: always, "
- "node-properties: {type: queue, durable: False, "
- "x-properties: {auto_delete: true}}}")
+ "node: {type: queue, durable: False, "
+ "x-declare: {auto_delete: true}}}")
content = self.content("testCreateQueue")
snd.send(content)
rcv = self.ssn.receiver("test-create-queue")
@@ -607,10 +601,10 @@ class AddressTests(Base):
addr = """test-create-exchange; {
create: always,
delete: always,
- node-properties: {
+ node: {
type: topic,
durable: False,
- x-properties: {auto_delete: true, %s}
+ x-declare: {auto_delete: true, %s}
}
}""" % props
snd = self.ssn.sender(addr)
@@ -677,15 +671,15 @@ class AddressTests(Base):
# XXX: need to figure out close after error
self.conn._remove_session(self.ssn)
- def testBindings(self):
+ def testNodeBindingsQueue(self):
snd = self.ssn.sender("""
-test-bindings-queue; {
+test-node-bindings-queue; {
create: always,
delete: always,
- node-properties: {
- x-properties: {
- bindings: ["amq.topic/a.#", "amq.direct/b", "amq.topic/c.*"]
- }
+ node: {
+ x-bindings: [{exchange: "amq.topic", key: "a.#"},
+ {exchange: "amq.direct", key: "b"},
+ {exchange: "amq.topic", key: "c.*"}]
}
}
""")
@@ -696,49 +690,80 @@ test-bindings-queue; {
snd_a.send("two")
snd_b.send("three")
snd_c.send("four")
- rcv = self.ssn.receiver("test-bindings-queue")
+ rcv = self.ssn.receiver("test-node-bindings-queue")
self.drain(rcv, expected=["one", "two", "three", "four"])
- def testBindingsAdditive(self):
- m1 = self.content("testBindingsAdditive", 1)
- m2 = self.content("testBindingsAdditive", 2)
- m3 = self.content("testBindingsAdditive", 3)
- m4 = self.content("testBindingsAdditive", 4)
-
+ def testNodeBindingsTopic(self):
+ rcv = self.ssn.receiver("test-node-bindings-topic-queue; {create: always, delete: always}")
+ rcv_a = self.ssn.receiver("test-node-bindings-topic-queue-a; {create: always, delete: always}")
+ rcv_b = self.ssn.receiver("test-node-bindings-topic-queue-b; {create: always, delete: always}")
+ rcv_c = self.ssn.receiver("test-node-bindings-topic-queue-c; {create: always, delete: always}")
snd = self.ssn.sender("""
-test-bindings-additive-queue; {
+test-node-bindings-topic; {
create: always,
delete: always,
- node-properties: {
- x-properties: {
- bindings: ["amq.topic/a"]
- }
+ node: {
+ type: topic,
+ x-bindings: [{queue: test-node-bindings-topic-queue, key: "#"},
+ {queue: test-node-bindings-topic-queue-a, key: "a.#"},
+ {queue: test-node-bindings-topic-queue-b, key: "b"},
+ {queue: test-node-bindings-topic-queue-c, key: "c.*"}]
}
}
""")
+ m1 = Message("one")
+ m2 = Message(subject="a.foo", content="two")
+ m3 = Message(subject="b", content="three")
+ m4 = Message(subject="c.bar", content="four")
+ snd.send(m1)
+ snd.send(m2)
+ snd.send(m3)
+ snd.send(m4)
+ self.drain(rcv, expected=[m1, m2, m3, m4])
+ self.drain(rcv_a, expected=[m2])
+ self.drain(rcv_b, expected=[m3])
+ self.drain(rcv_c, expected=[m4])
+
+ def testLinkBindings(self):
+ m_a = self.message("testLinkBindings", 1, subject="a")
+ m_b = self.message("testLinkBindings", 2, subject="b")
+
+ self.ssn.sender("test-link-bindings-queue; {create: always, delete: always}")
+ snd = self.ssn.sender("amq.topic")
+
+ snd.send(m_a)
+ snd.send(m_b)
+ snd.close()
- snd_a = self.ssn.sender("amq.topic/a")
- snd_b = self.ssn.sender("amq.topic/b")
+ rcv = self.ssn.receiver("test-link-bindings-queue")
+ self.assertEmpty(rcv)
+
+ snd = self.ssn.sender("""
+amq.topic; {
+ link: {
+ x-bindings: [{queue: test-link-bindings-queue, key: a}]
+ }
+}
+""")
- snd_a.send(m1)
- snd_b.send(m2)
+ snd.send(m_a)
+ snd.send(m_b)
- rcv = self.ssn.receiver("test-bindings-additive-queue")
- self.drain(rcv, expected=[m1])
+ self.drain(rcv, expected=[m_a])
+ rcv.close()
- new_snd = self.ssn.sender("""
-test-bindings-additive-queue; {
- node-properties: {
- x-properties: {
- bindings: ["amq.topic/b"]
- }
+ rcv = self.ssn.receiver("""
+test-link-bindings-queue; {
+ link: {
+ x-bindings: [{exchange: "amq.topic", key: b}]
}
}
""")
- new_snd.send(m3)
- snd_b.send(m4)
- self.drain(rcv, expected=[m3, m4])
+ snd.send(m_a)
+ snd.send(m_b)
+
+ self.drain(rcv, expected=[m_a, m_b])
def testSubjectOverride(self):
snd = self.ssn.sender("amq.topic/a")
@@ -764,6 +789,32 @@ test-bindings-additive-queue; {
assert e2.subject == "b", "subject: %s" % e2.subject
self.assertEmpty(rcv)
+ def doReliabilityTest(self, reliability, messages, expected):
+ snd = self.ssn.sender("amq.topic")
+ rcv = self.ssn.receiver("amq.topic; {link: {reliability: %s}}" % reliability)
+ for m in messages:
+ snd.send(m)
+ self.conn.disconnect()
+ self.conn.connect()
+ self.drain(rcv, expected=expected)
+
+ def testReliabilityUnreliable(self):
+ msgs = [self.message("testReliabilityUnreliable", i) for i in range(3)]
+ self.doReliabilityTest("unreliable", msgs, [])
+
+ def testReliabilityAtLeastOnce(self):
+ msgs = [self.message("testReliabilityAtLeastOnce", i) for i in range(3)]
+ self.doReliabilityTest("at-least-once", msgs, msgs)
+
+ def testLinkName(self):
+ msgs = [self.message("testLinkName", i) for i in range(3)]
+ snd = self.ssn.sender("amq.topic")
+ trcv = self.ssn.receiver("amq.topic; {link: {name: test-link-name}}")
+ qrcv = self.ssn.receiver("test-link-name")
+ for m in msgs:
+ snd.send(m)
+ self.drain(qrcv, expected=msgs)
+
NOSUCH_Q = "this-queue-should-not-exist"
UNPARSEABLE_ADDR = "name/subject; {bad options"
UNLEXABLE_ADDR = "\0x0\0x1\0x2\0x3"