You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2007/02/21 17:49:28 UTC

svn commit: r510096 - in /incubator/qpid/branches/qpid.0-9/python: qpid/client.py qpid/reference.py tests/message.py

Author: gsim
Date: Wed Feb 21 08:49:27 2007
New Revision: 510096

URL: http://svn.apache.org/viewvc?view=rev&rev=510096
Log:
Fixed bug in references where map wasn't qualified in close
Attach reference to transfer, as it will be deleted on close
Altered tests to get reference from the message on the queue rather than looking them up from channel as they are already gone there


Modified:
    incubator/qpid/branches/qpid.0-9/python/qpid/client.py
    incubator/qpid/branches/qpid.0-9/python/qpid/reference.py
    incubator/qpid/branches/qpid.0-9/python/tests/message.py

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/client.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/client.py?view=diff&rev=510096&r1=510095&r2=510096
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/client.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/client.py Wed Feb 21 08:49:27 2007
@@ -111,6 +111,8 @@
     self.client.started.set()
 
   def message_transfer(self, ch, msg):
+    if isinstance(msg.body, ReferenceId):
+      msg.reference = ch.references.get(msg.body.id)
     self.client.queue(msg.destination).put(msg)
 
   def message_open(self, ch, msg):

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/reference.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/reference.py?view=diff&rev=510096&r1=510095&r2=510096
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/reference.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/reference.py Wed Feb 21 08:49:27 2007
@@ -111,7 +111,7 @@
         self.get(id).close()
         self.lock.acquire()
         try:
-            del map[id]
+            self.map.pop(id)
         finally:
             self.lock.release()
         

Modified: incubator/qpid/branches/qpid.0-9/python/tests/message.py
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/tests/message.py?view=diff&rev=510096&r1=510095&r2=510096
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/tests/message.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/tests/message.py Wed Feb 21 08:49:27 2007
@@ -455,7 +455,8 @@
         
         msg = queue.get(timeout=1)
         self.assertTrue(isinstance(msg.body, ReferenceId))
-        self.assertEquals(data, ch2.references.get(msg.body.id).get_complete())
+        self.assertTrue(msg.reference)
+        self.assertEquals(data, msg.reference.get_complete())
 
     def test_reference_completion(self):
         """
@@ -539,15 +540,15 @@
         #inline or by reference in any combination
         
         if isinstance(msg1.body, ReferenceId):            
-            self.assertEquals("second message", channel.references.get(msg1.body.id).get_complete())
+            self.assertEquals("second message", msg1.reference.get_complete())
             if isinstance(msg2.body, ReferenceId):
                 if msg1.body != msg2.body:
-                    self.assertEquals("second message", channel.references.get(msg2.body.id).get_complete())
+                    self.assertEquals("second message", msg2.reference.get_complete())
                 #else ok, as same ref as msg1    
         else:
             self.assertEquals("second message", msg1.body)
             if isinstance(msg2.body, ReferenceId):
-                self.assertEquals("second message", channel.references.get(msg2.body.id).get_complete())
+                self.assertEquals("second message", msg2.reference.get_complete())
             else:
                 self.assertEquals("second message", msg2.body)                
 
@@ -644,7 +645,7 @@
         
     def assertDataEquals(self, channel, msg, expected):
         if isinstance(msg.body, ReferenceId):
-            data = channel.references.get(msg.body.id).get_complete()
+            data = msg.reference.get_complete()
         else:
             data = msg.body
         self.assertEquals(expected, data)