summaryrefslogtreecommitdiff
path: root/qpid/python
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2009-10-29 13:20:07 +0000
committerKim van der Riet <kpvdr@apache.org>2009-10-29 13:20:07 +0000
commit03ad83bee4203ff63195acd6a11aa2b61f6a6031 (patch)
tree62b8995bb9a3bf9f10a7a6db068d22b9420652bd /qpid/python
parent6c99eda3cdf6a6a068baf8302e23a396f5d6153e (diff)
downloadqpid-python-03ad83bee4203ff63195acd6a11aa2b61f6a6031.tar.gz
Fix for QPID-2171 "No checks made for reserved exchange names "amq.*" and "qpid.*". This checkin adds the qpid check, r.830751 added the amq check. Python tests also inlcuded which checks for these prefixes.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@830930 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/tests_0-10/exchange.py39
1 files changed, 29 insertions, 10 deletions
diff --git a/qpid/python/tests_0-10/exchange.py b/qpid/python/tests_0-10/exchange.py
index e2c84848f7..8d9713076d 100644
--- a/qpid/python/tests_0-10/exchange.py
+++ b/qpid/python/tests_0-10/exchange.py
@@ -269,30 +269,49 @@ class DeclareMethodExchangeFieldReservedRuleTests(TestHelper):
standardised exchanges. The client MUST NOT attempt to create an exchange
starting with "amq.".
-
+ Similarly, exchanges starting with "qpid." are reserved for Qpid
+ implementation-specific system exchanges (such as the management exchange).
+ The client must not attempt to create an exchange starting with the string
+ "qpid.".
"""
- def test(self):
+ def template(self, reservedString, exchangeType):
try:
- self.session.exchange_declare(exchange="amq.", type="direct")
- self.fail("Expected not allowed error (530) for exchanges starting with \"amq.\".")
+ self.session.exchange_declare(exchange=reservedString, type=exchangeType)
+ self.fail("Expected not allowed error (530) for exchanges starting with \"" + reservedString + "\".")
except SessionException, e:
self.assertEquals(e.args[0].error_code, 530)
# connection closed, reopen it
self.tearDown()
self.setUp()
try:
- self.session.exchange_declare(exchange="amq.abc123", type="direct")
- self.fail("Expected not allowed error (530) for exchanges starting with \"amq.\".")
+ self.session.exchange_declare(exchange=reservedString + "abc123", type=exchangeType)
+ self.fail("Expected not allowed error (530) for exchanges starting with \"" + reservedString + "\".")
except SessionException, e:
self.assertEquals(e.args[0].error_code, 530)
# connection closed, reopen it
self.tearDown()
self.setUp()
# The following should be legal:
- self.session.exchange_declare(exchange="amq", type="direct")
- self.session.exchange_declare(exchange=".amq.", type="direct")
- self.session.exchange_declare(exchange="abc.amq.", type="direct")
- self.session.exchange_declare(exchange="abc.amq.def", type="direct")
+ self.session.exchange_declare(exchange=reservedString[:-1], type=exchangeType)
+ self.session.exchange_delete(exchange=reservedString[:-1])
+ self.session.exchange_declare(exchange=reservedString[1:], type=exchangeType)
+ self.session.exchange_delete(exchange=reservedString[1:])
+ self.session.exchange_declare(exchange="." + reservedString, type=exchangeType)
+ self.session.exchange_delete(exchange="." + reservedString)
+ self.session.exchange_declare(exchange="abc." + reservedString, type=exchangeType)
+ self.session.exchange_delete(exchange="abc." + reservedString)
+ self.session.exchange_declare(exchange="abc." + reservedString + "def", type=exchangeType)
+ self.session.exchange_delete(exchange="abc." + reservedString + "def")
+
+ def test_amq(self):
+ self.template("amq.", "direct")
+ self.template("amq.", "topic")
+ self.template("amq.", "fanout")
+
+ def test_qpid(self):
+ self.template("qpid.", "direct")
+ self.template("qpid.", "topic")
+ self.template("qpid.", "fanout")
class DeclareMethodTypeFieldTypedRuleTests(TestHelper):