You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2010/02/17 21:21:10 UTC
svn commit: r911166 - in /qpid/trunk/qpid/python/qpid: driver.py
tests/messaging.py
Author: rhs
Date: Wed Feb 17 20:21:10 2010
New Revision: 911166
URL: http://svn.apache.org/viewvc?rev=911166&view=rev
Log:
fixed subject defaulting and added test
Modified:
qpid/trunk/qpid/python/qpid/driver.py
qpid/trunk/qpid/python/qpid/tests/messaging.py
Modified: qpid/trunk/qpid/python/qpid/driver.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/driver.py?rev=911166&r1=911165&r2=911166&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/driver.py (original)
+++ qpid/trunk/qpid/python/qpid/driver.py Wed Feb 17 20:21:10 2010
@@ -950,6 +950,12 @@
rk = _snd._routing_key
else:
rk = msg.subject
+
+ if msg.subject is None:
+ subject = _snd.subject
+ else:
+ subject = msg.subject
+
# XXX: do we need to query to figure out how to create the reply-to interoperably?
if msg.reply_to:
rt = addr2reply_to(msg.reply_to)
@@ -962,10 +968,10 @@
correlation_id=msg.correlation_id,
content_type=msg.content_type,
application_headers=msg.properties)
- if msg.subject is not None:
+ if subject is not None:
if mp.application_headers is None:
mp.application_headers = {}
- mp.application_headers[SUBJECT] = msg.subject
+ mp.application_headers[SUBJECT] = subject
if msg.to is not None:
if mp.application_headers is None:
mp.application_headers = {}
Modified: qpid/trunk/qpid/python/qpid/tests/messaging.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/tests/messaging.py?rev=911166&r1=911165&r2=911166&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/tests/messaging.py (original)
+++ qpid/trunk/qpid/python/qpid/tests/messaging.py Wed Feb 17 20:21:10 2010
@@ -799,6 +799,19 @@
self.drain(rcv_a, expected=[m1])
self.drain(rcv_b, expected=[m2])
+ def testSubjectDefault(self):
+ m1 = self.content("testSubjectDefault", 1)
+ m2 = self.content("testSubjectDefault", 2)
+ snd = self.ssn.sender("amq.topic/a")
+ rcv = self.ssn.receiver("amq.topic")
+ snd.send(m1)
+ snd.send(Message(subject="b", content=m2))
+ e1 = rcv.fetch(timeout=0)
+ e2 = rcv.fetch(timeout=0)
+ assert e1.subject == "a", "subject: %s" % e1.subject
+ assert e2.subject == "b", "subject: %s" % e2.subject
+ self.assertEmpty(rcv)
+
NOSUCH_Q = "this-queue-should-not-exist"
UNPARSEABLE_ADDR = "name/subject; {bad options"
UNLEXABLE_ADDR = "\0x0\0x1\0x2\0x3"
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org