You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ns...@apache.org on 2008/05/13 17:30:13 UTC

svn commit: r655915 - in /incubator/qpid/trunk/qpid/python: qpid/management.py tests_0-10/management.py

Author: nsantos
Date: Tue May 13 08:30:13 2008
New Revision: 655915

URL: http://svn.apache.org/viewvc?rev=655915&view=rev
Log:
QPID-1052: Management: session.name matches session id provided by API, handling of lost connections -- applied patch supplied by Ted Ross

Modified:
    incubator/qpid/trunk/qpid/python/qpid/management.py
    incubator/qpid/trunk/qpid/python/tests_0-10/management.py

Modified: incubator/qpid/trunk/qpid/python/qpid/management.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/management.py?rev=655915&r1=655914&r2=655915&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/management.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/management.py Tue May 13 08:30:13 2008
@@ -96,6 +96,7 @@
     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 @@
     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 @@
     self.cv.acquire ()
     if channel.reqsOutstanding == 0:
       self.cv.release ()
-      return
+      return channel.brokerInfo
 
     self.syncInFlight = True
     starttime = time ()
@@ -239,6 +243,7 @@
         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 @@
       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

Modified: incubator/qpid/trunk/qpid/python/tests_0-10/management.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/tests_0-10/management.py?rev=655915&r1=655914&r2=655915&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/tests_0-10/management.py (original)
+++ incubator/qpid/trunk/qpid/python/tests_0-10/management.py Tue May 13 08:30:13 2008
@@ -63,6 +63,21 @@
         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