summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-02-21 16:49:27 +0000
committerGordon Sim <gsim@apache.org>2007-02-21 16:49:27 +0000
commit2c4fdf9d81d32dd5c319714a86d3ab9ab5a6664e (patch)
tree05cff3455d2c3dd97eafaa76ce92bc1d5c908411 /python
parentbe9a95607d8e831e8f7c5802828afe677c798b93 (diff)
downloadqpid-python-2c4fdf9d81d32dd5c319714a86d3ab9ab5a6664e.tar.gz
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 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@510096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/client.py2
-rw-r--r--python/qpid/reference.py2
-rw-r--r--python/tests/message.py11
3 files changed, 9 insertions, 6 deletions
diff --git a/python/qpid/client.py b/python/qpid/client.py
index e14166c885..f6a540c7ec 100644
--- a/python/qpid/client.py
+++ b/python/qpid/client.py
@@ -111,6 +111,8 @@ class ClientDelegate(Delegate):
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):
diff --git a/python/qpid/reference.py b/python/qpid/reference.py
index d357560390..48ecb67656 100644
--- a/python/qpid/reference.py
+++ b/python/qpid/reference.py
@@ -111,7 +111,7 @@ class References:
self.get(id).close()
self.lock.acquire()
try:
- del map[id]
+ self.map.pop(id)
finally:
self.lock.release()
diff --git a/python/tests/message.py b/python/tests/message.py
index bab596974a..8da9978792 100644
--- a/python/tests/message.py
+++ b/python/tests/message.py
@@ -455,7 +455,8 @@ class MessageTests(TestBase):
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 @@ class MessageTests(TestBase):
#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 @@ class MessageTests(TestBase):
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)