summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2016-04-02 22:28:45 +0000
committerKeith Wall <kwall@apache.org>2016-04-02 22:28:45 +0000
commit77a319a41c90efeabbfe42b7b85d6c7ac30a68e6 (patch)
tree61d803fcaf26075115a7e02a2416c3fd24104f63
parente8e48f8c5ec975d3dc471da1b76b171117d81320 (diff)
downloadqpid-python-77a319a41c90efeabbfe42b7b85d6c7ac30a68e6.tar.gz
QPID-7180: [Python Test Suite] Adapt broker url to match expectations of the C++ client if swigged client is in-use
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1737539 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/python/qpid/tests/messaging/__init__.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/qpid/python/qpid/tests/messaging/__init__.py b/qpid/python/qpid/tests/messaging/__init__.py
index 38a5b066d6..be7000f9c9 100644
--- a/qpid/python/qpid/tests/messaging/__init__.py
+++ b/qpid/python/qpid/tests/messaging/__init__.py
@@ -22,6 +22,7 @@ from math import ceil
from qpid.harness import Skipped
from qpid.tests.messaging.implementation import *
from qpid.tests import Test
+from qpid.util import URL
class Base(Test):
@@ -39,7 +40,11 @@ class Base(Test):
def setup(self):
self.test_id = uuid4()
- self.broker = self.config.broker
+ if self.is_swigged_qpid_messaging():
+ self.broker = CompatURL(self.config.broker)
+ else:
+ self.broker = self.config.broker
+
try:
self.conn = self.setup_connection()
except ConnectError, e:
@@ -188,6 +193,9 @@ class Base(Test):
return {"reconnect": self.reconnect(),
"transport": self.transport()}
+ def is_swigged_qpid_messaging(self):
+ return Connection.__module__ == 'qpid_messaging'
+
class VersionTest (Base):
def create_connection(self, version="amqp1.0", force=False):
opts = self.connection_options()
@@ -201,4 +209,28 @@ class VersionTest (Base):
def setup_session(self):
return self.conn.session()
+class CompatURL(URL):
+ """The formation of the URL for the C++ client is different to that of the pure Python client in that
+ the C++ client expects <scheme>:<user>/<pass>.. whereas the pure Python's URL class expects
+ <scheme>://<user>:<pass>.."""
+ def __init__(self, *args, **kwargs):
+ URL.__init__(self, *args, **kwargs)
+
+ def __str__(self):
+ s = ""
+ if self.scheme:
+ s += "%s:" % self.scheme
+ if self.user:
+ s += self.user
+ if self.password:
+ s += "/%s" % self.password
+ s += "@"
+ if ':' not in self.host:
+ s += self.host
+ else:
+ s += "[%s]" % self.host
+ if self.port:
+ s += ":%s" % self.port
+ return s
+
import address, endpoints, message