You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2013/09/05 23:12:55 UTC

svn commit: r1520427 - in /qpid/trunk/qpid/extras/dispatch: src/message.c tests/system_tests_one_router.py

Author: tross
Date: Thu Sep  5 21:12:55 2013
New Revision: 1520427

URL: http://svn.apache.org/r1520427
Log:
QPID-5068 - Added a delivery-annotation test and fixed the exposed bug.

Modified:
    qpid/trunk/qpid/extras/dispatch/src/message.c
    qpid/trunk/qpid/extras/dispatch/tests/system_tests_one_router.py

Modified: qpid/trunk/qpid/extras/dispatch/src/message.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/message.c?rev=1520427&r1=1520426&r2=1520427&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/message.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/message.c Thu Sep  5 21:12:55 2013
@@ -353,6 +353,11 @@ static dx_field_location_t *dx_message_f
         }
         break;
 
+    case DX_FIELD_DELIVERY_ANNOTATION:
+        if (content->section_delivery_annotation.parsed)
+            return &content->section_delivery_annotation;
+        break;
+
     case DX_FIELD_APPLICATION_PROPERTIES:
         if (content->section_application_properties.parsed)
             return &content->section_application_properties;

Modified: qpid/trunk/qpid/extras/dispatch/tests/system_tests_one_router.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/tests/system_tests_one_router.py?rev=1520427&r1=1520426&r2=1520427&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/tests/system_tests_one_router.py (original)
+++ qpid/trunk/qpid/extras/dispatch/tests/system_tests_one_router.py Thu Sep  5 21:12:55 2013
@@ -258,5 +258,58 @@ class RouterTest(unittest.TestCase):
 #  def test_7_link_route_receiver(self):
 #    pass 
 
+
+  def test_8_trace(self):
+    addr = "amqp://0.0.0.0:20000/trace/1"
+    M1 = Messenger()
+    M2 = Messenger()
+
+    M1.timeout = 1.0
+    M2.timeout = 1.0
+
+    M1.start()
+    M2.start()
+    self.subscribe(M2, addr)
+
+    tm = Message()
+    rm = Message()
+
+    tm.address = addr
+    tm.instructions = {'qdx.trace' : []}
+
+    for i in range(10):
+      tm.body = {'number': i}
+      M1.put(tm)
+    M1.send()
+
+    for i in range(10):
+      M2.recv(1)
+      M2.get(rm)
+      self.assertEqual(i, rm.body['number'])
+      da = rm.instructions
+      self.assertEqual(da.__class__, dict)
+      self.assertEqual(da['qdx.ingress'], 'Qpid.Dispatch.Router.A')
+      self.assertEqual(da['qdx.trace'], ['Qpid.Dispatch.Router.A'])
+
+    tm.instructions = {'qdx.trace' : ['first.hop']}
+
+    for i in range(10):
+      tm.body = {'number': i}
+      M1.put(tm)
+    M1.send()
+
+    for i in range(10):
+      M2.recv(1)
+      M2.get(rm)
+      self.assertEqual(i, rm.body['number'])
+      da = rm.instructions
+      self.assertEqual(da.__class__, dict)
+      self.assertEqual(da['qdx.ingress'], 'Qpid.Dispatch.Router.A')
+      self.assertEqual(da['qdx.trace'], ['first.hop', 'Qpid.Dispatch.Router.A'])
+
+    M1.stop()
+    M2.stop()
+
+
 if __name__ == '__main__':
   unittest.main()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org