diff options
author | Rafael H. Schloming <rhs@apache.org> | 2010-07-13 17:58:44 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2010-07-13 17:58:44 +0000 |
commit | e26d7c17afc51e5afccbe4114f62e5d5cd030256 (patch) | |
tree | 2bbe1162a27504dd35524483b21ada49e609a578 | |
parent | b34fe9f8bf9bf60a471506df49b73ff8190355aa (diff) | |
download | qpid-python-e26d7c17afc51e5afccbe4114f62e5d5cd030256.tar.gz |
fixed missign import and added test case for reconnect_urls
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@963803 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | python/qpid/messaging/driver.py | 1 | ||||
-rw-r--r-- | python/qpid/tests/messaging/endpoints.py | 7 | ||||
-rw-r--r-- | python/qpid/util.py | 21 |
3 files changed, 22 insertions, 7 deletions
diff --git a/python/qpid/messaging/driver.py b/python/qpid/messaging/driver.py index a3c565f205..15eaf1f9bd 100644 --- a/python/qpid/messaging/driver.py +++ b/python/qpid/messaging/driver.py @@ -31,6 +31,7 @@ from qpid.messaging.exceptions import * from qpid.messaging.message import get_codec, Disposition, Message from qpid.ops import * from qpid.selector import Selector +from qpid.util import URL from qpid.validator import And, Context, List, Map, Types, Values from threading import Condition, Thread diff --git a/python/qpid/tests/messaging/endpoints.py b/python/qpid/tests/messaging/endpoints.py index 52ca9f32be..bc1706806c 100644 --- a/python/qpid/tests/messaging/endpoints.py +++ b/python/qpid/tests/messaging/endpoints.py @@ -39,6 +39,13 @@ class SetupTests(Base): self.conn.open() self.ping(self.conn.session()) + def testOpenReconnectURLs(self): + options = self.connection_options() + options["reconnect_urls"] = [self.broker, self.broker] + self.conn = Connection(self.broker, **options) + self.conn.open() + self.ping(self.conn.session()) + def testConnectError(self): try: # Specifying port 0 yields a bad address on Windows; port 4 is unassigned diff --git a/python/qpid/util.py b/python/qpid/util.py index 3409d777f9..e62bebdf24 100644 --- a/python/qpid/util.py +++ b/python/qpid/util.py @@ -109,14 +109,21 @@ class URL: AMQP = "amqp" def __init__(self, s): - match = URL.RE.match(s) - if match is None: - raise ValueError(s) - self.scheme, self.user, self.password, self.host, port = match.groups() - if port is None: - self.port = None + if isinstance(s, URL): + self.scheme = s.scheme + self.user = s.user + self.password = s.password + self.host = s.host + self.port = s.port else: - self.port = int(port) + match = URL.RE.match(s) + if match is None: + raise ValueError(s) + self.scheme, self.user, self.password, self.host, port = match.groups() + if port is None: + self.port = None + else: + self.port = int(port) def __repr__(self): return "URL(%r)" % str(self) |