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 2016/12/07 14:09:24 UTC

qpid-dispatch git commit: DISPATCH-566 - From Ganesh Murthy. Propagate message-annotations over link routes. This closes #113.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master d918b7a2c -> 4ae3c161d


DISPATCH-566 - From Ganesh Murthy.  Propagate message-annotations over link routes.  This closes #113.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/4ae3c161
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/4ae3c161
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/4ae3c161

Branch: refs/heads/master
Commit: 4ae3c161d2d4a903c170554251ede3d915493a5a
Parents: d918b7a
Author: Ted Ross <tr...@redhat.com>
Authored: Wed Dec 7 09:08:27 2016 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Wed Dec 7 09:08:27 2016 -0500

----------------------------------------------------------------------
 src/message.c                     |  2 ++
 tests/system_tests_link_routes.py | 36 +++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4ae3c161/src/message.c
----------------------------------------------------------------------
diff --git a/src/message.c b/src/message.c
index 5ae8f2e..1e92c52 100644
--- a/src/message.c
+++ b/src/message.c
@@ -619,6 +619,8 @@ qd_message_t *qd_message_copy(qd_message_t *in_msg)
 
     copy->content = content;
 
+    qd_message_message_annotations((qd_message_t*) copy);
+
     sys_atomic_inc(&content->ref_count);
 
     return (qd_message_t*) copy;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4ae3c161/tests/system_tests_link_routes.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_link_routes.py b/tests/system_tests_link_routes.py
index 3508457..ada1795 100644
--- a/tests/system_tests_link_routes.py
+++ b/tests/system_tests_link_routes.py
@@ -349,6 +349,41 @@ class LinkRouteTest(TestCase):
 
         blocking_connection.close()
 
+    def test_custom_annotations_match(self):
+        """
+        The linkRoute on Routers C and B is set to org.apache.
+        Creates a receiver listening on the address 'org.apache' and a sender that sends to address 'org.apache'.
+        Sends a message with custom annotations to org.apache via router QDR.C and makes sure that the message was successfully
+        routed (using full address matching) and received using pre-created links that were created as a
+        result of specifying addresses in the linkRoute attribute('org.apache.'). Make sure custom annotations arrived as well.
+        """
+        hello_world_3 = "Hello World_3!"
+        # Connects to listener #2 on QDR.C
+        addr = self.routers[2].addresses[0]
+
+        blocking_connection = BlockingConnection(addr)
+
+        # Receive on org.apache
+        blocking_receiver = blocking_connection.create_receiver(address="org.apache")
+
+        apply_options = AtMostOnce()
+
+        # Sender to  to org.apache
+        blocking_sender = blocking_connection.create_sender(address="org.apache", options=apply_options)
+        msg = Message(body=hello_world_3)
+        annotations = {'custom-annotation': '1/Custom_Annotation'}
+        msg.annotations = annotations
+
+        # Send a message
+        blocking_sender.send(msg)
+
+        received_message = blocking_receiver.receive()
+
+        self.assertEqual(hello_world_3, received_message.body)
+        self.assertEqual(received_message.annotations, annotations)
+
+        blocking_connection.close()
+
     def test_full_link_route_match_1(self):
         """
         This test is pretty much the same as the previous test (test_full_link_route_match) but the connection is
@@ -527,7 +562,6 @@ class Timeout(object):
     def on_timer_task(self, event):
         self.parent.timeout()
 
-
 class DeliveryTagsTest(MessagingHandler):
     def __init__(self, sender_address, listening_address, qdstat_address):
         super(DeliveryTagsTest, self).__init__()


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