qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r958055 - in /qpid/trunk/qpid/python/qpid: messaging/driver.py tests/messaging/__init__.py tests/messaging/message.py
Date Fri, 25 Jun 2010 18:12:29 GMT
Author: rhs
Date: Fri Jun 25 18:12:28 2010
New Revision: 958055

URL: http://svn.apache.org/viewvc?rev=958055&view=rev
Log:
added support for x-amqp-0-10.{app-id,content-encoding,routing-key}

Modified:
    qpid/trunk/qpid/python/qpid/messaging/driver.py
    qpid/trunk/qpid/python/qpid/tests/messaging/__init__.py
    qpid/trunk/qpid/python/qpid/tests/messaging/message.py

Modified: qpid/trunk/qpid/python/qpid/messaging/driver.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/driver.py?rev=958055&r1=958054&r2=958055&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/messaging/driver.py (original)
+++ qpid/trunk/qpid/python/qpid/messaging/driver.py Fri Jun 25 18:12:28 2010
@@ -1159,12 +1159,15 @@ class Engine:
       rt = addr2reply_to(msg.reply_to)
     else:
       rt = None
+    content_encoding = msg.properties.get("x-amqp-0-10.content-encoding")
     dp = DeliveryProperties(routing_key=rk)
     mp = MessageProperties(message_id=msg.id,
                            user_id=msg.user_id,
                            reply_to=rt,
                            correlation_id=msg.correlation_id,
+                           app_id = msg.properties.get("x-amqp-0-10.app-id"),
                            content_type=msg.content_type,
+                           content_encoding=content_encoding,
                            application_headers=msg.properties)
     if subject is not None:
       if mp.application_headers is None:
@@ -1242,6 +1245,12 @@ class Engine:
     msg.ttl = dp.ttl
     msg.redelivered = dp.redelivered
     msg.properties = mp.application_headers
+    if mp.app_id is not None:
+      msg.properties["x-amqp-0-10.app-id"] = mp.app_id
+    if mp.content_encoding is not None:
+      msg.properties["x-amqp-0-10.content-encoding"] = mp.content_encoding
+    if dp.routing_key is not None:
+      msg.properties["x-amqp-0-10.routing-key"] = dp.routing_key
     msg.content_type = mp.content_type
     msg._transfer_id = xfr.id
     return msg

Modified: qpid/trunk/qpid/python/qpid/tests/messaging/__init__.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/tests/messaging/__init__.py?rev=958055&r1=958054&r2=958055&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/tests/messaging/__init__.py (original)
+++ qpid/trunk/qpid/python/qpid/tests/messaging/__init__.py Fri Jun 25 18:12:28 2010
@@ -88,16 +88,22 @@ class Base(Test):
       self.assertEchos(expected, messages, redelivered)
     return messages
 
-  def diff(self, m1, m2):
+  def diff(self, m1, m2, excluded_properties=()):
     result = {}
     for attr in ("id", "subject", "user_id", "reply_to",
                  "correlation_id", "durable", "priority", "ttl",
-                 "redelivered", "properties", "content_type",
-                 "content"):
+                 "redelivered", "content_type", "content"):
       a1 = getattr(m1, attr)
       a2 = getattr(m2, attr)
       if a1 != a2:
         result[attr] = (a1, a2)
+    p1 = dict(m1.properties)
+    p2 = dict(m2.properties)
+    for ep in excluded_properties:
+      p1.pop(ep, None)
+      p2.pop(ep, None)
+    if p1 != p2:
+      result["properties"] = (p1, p2)
     return result
 
   def assertEcho(self, msg, echo, redelivered=False):
@@ -108,7 +114,7 @@ class Base(Test):
         echo = echo.content
         assert msg == echo, "expected %s, got %s" % (msg, echo)
     else:
-      delta = self.diff(msg, echo)
+      delta = self.diff(msg, echo, ("x-amqp-0-10.routing-key",))
       mttl, ettl = delta.pop("ttl", (0, 0))
       if redelivered:
         assert echo.redelivered, \

Modified: qpid/trunk/qpid/python/qpid/tests/messaging/message.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/tests/messaging/message.py?rev=958055&r1=958054&r2=958055&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/tests/messaging/message.py (original)
+++ qpid/trunk/qpid/python/qpid/tests/messaging/message.py Fri Jun 25 18:12:28 2010
@@ -85,7 +85,9 @@ class MessageEchoTests(Base):
               "key6": -3.14,
               "key7": ["one", 2, 3.14],
               "key8": [],
-              "key9": {"sub-key0": 3}}
+              "key9": {"sub-key0": 3},
+              "x-amqp-0-10.app-id": "test-app-id",
+              "x-amqp-0-10.content-encoding": "test-content-encoding"}
 
   def testMapContent(self):
     self.check(Message(MessageEchoTests.TEST_MAP))



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message