diff options
| author | Nuno Santos <nsantos@apache.org> | 2008-05-13 15:30:13 +0000 |
|---|---|---|
| committer | Nuno Santos <nsantos@apache.org> | 2008-05-13 15:30:13 +0000 |
| commit | 8c9f5cf7454080b4056de1aa3d9e900813128d85 (patch) | |
| tree | 2e719323ada3f10bf1b31ca289633e08be7f15f5 /qpid/python | |
| parent | d4a89b159b361317d54d75dd4a2429bbd74f64d1 (diff) | |
| download | qpid-python-8c9f5cf7454080b4056de1aa3d9e900813128d85.tar.gz | |
QPID-1052: Management: session.name matches session id provided by API, handling of lost connections -- applied patch supplied by Ted Ross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@655915 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/management.py | 12 | ||||
| -rw-r--r-- | qpid/python/tests_0-10/management.py | 15 |
2 files changed, 24 insertions, 3 deletions
diff --git a/qpid/python/qpid/management.py b/qpid/python/qpid/management.py index 0e7233fad2..fe980b4a02 100644 --- a/qpid/python/qpid/management.py +++ b/qpid/python/qpid/management.py @@ -96,6 +96,7 @@ class managementChannel: self.ecb = exceptionCb self.context = cbContext self.reqsOutstanding = 0 + self.brokerInfo = None ssn.queue_declare (queue=self.topicName, exclusive=True, auto_delete=True) ssn.queue_declare (queue=self.replyName, exclusive=True, auto_delete=True) @@ -116,6 +117,9 @@ class managementChannel: ssn.message_flow (destination="rdest", unit=0, value=0xFFFFFFFF) ssn.message_flow (destination="rdest", unit=1, value=0xFFFFFFFF) + def setBrokerInfo (self, data): + self.brokerInfo = data + def shutdown (self): self.enabled = False self.ssn.message_cancel (destination="tdest") @@ -229,7 +233,7 @@ class managementClient: self.cv.acquire () if channel.reqsOutstanding == 0: self.cv.release () - return + return channel.brokerInfo self.syncInFlight = True starttime = time () @@ -239,6 +243,7 @@ class managementClient: self.cv.release () raise RuntimeError ("Timed out waiting for response on channel") self.cv.release () + return channel.brokerInfo def syncCallMethod (self, channel, objId, className, methodName, args=None): """ Synchronous (blocking) method call """ @@ -492,9 +497,10 @@ class managementClient: self.ctrlCb (ch.context, self.CTRL_USER, data) def handleBrokerResponse (self, ch, codec): + uuid = codec.read_uuid () + data = (uuid, ch.sessionId) + ch.setBrokerInfo (data) if self.ctrlCb != None: - uuid = codec.read_uuid () - data = (uuid, ch.sessionId) self.ctrlCb (ch.context, self.CTRL_BROKER_INFO, data) # Send a package request diff --git a/qpid/python/tests_0-10/management.py b/qpid/python/tests_0-10/management.py index b2ab617244..3ca7284d2a 100644 --- a/qpid/python/tests_0-10/management.py +++ b/qpid/python/tests_0-10/management.py @@ -63,6 +63,21 @@ class ManagementTest (TestBase010): self.assertEqual (len (systems), 1) mc.removeChannel (mch) + def test_self_session_id (self): + session = self.session + + mc = managementClient (session.spec) + mch = mc.addChannel (session) + + info = mc.syncWaitForStable (mch) + brokerSessions = mc.syncGetObjects (mch, "session") + found = False + for bs in brokerSessions: + if bs.name == info[1]: + found = True + self.assertEqual (found, True) + mc.removeChannel (mch) + def test_standard_exchanges (self): session = self.session |
