You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2018/01/30 19:29:04 UTC

qpid-dispatch git commit: DISPATCH-901: add test and fix for dynamic source and anonymous send

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 0c1d568c8 -> 8370f159a


DISPATCH-901: add test and fix for dynamic source and anonymous send


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

Branch: refs/heads/master
Commit: 8370f159a5fe9f216146528cb99913217ae02d14
Parents: 0c1d568
Author: Gordon Sim <gs...@redhat.com>
Authored: Tue Jan 30 19:27:18 2018 +0000
Committer: Gordon Sim <gs...@redhat.com>
Committed: Tue Jan 30 19:27:50 2018 +0000

----------------------------------------------------------------------
 src/remote_sasl.c                          |  2 ++
 tests/system_tests_authz_service_plugin.py | 30 +++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/8370f159/src/remote_sasl.c
----------------------------------------------------------------------
diff --git a/src/remote_sasl.c b/src/remote_sasl.c
index 93e6129..d9631a4 100644
--- a/src/remote_sasl.c
+++ b/src/remote_sasl.c
@@ -273,6 +273,8 @@ static void set_policy_settings(pn_connection_t* conn, permissions_t* permission
         if (permissions->sources.start && permissions->sources.capacity) {
             qd_conn->policy_settings->sources = strdup(permissions->sources.start);
         }
+        qd_conn->policy_settings->allowDynamicSource = true;
+        qd_conn->policy_settings->allowAnonymousSender = true;
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/8370f159/tests/system_tests_authz_service_plugin.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_authz_service_plugin.py b/tests/system_tests_authz_service_plugin.py
index d6f0534..565b6dc 100644
--- a/tests/system_tests_authz_service_plugin.py
+++ b/tests/system_tests_authz_service_plugin.py
@@ -115,6 +115,17 @@ mech_list: SCRAM-SHA-1 PLAIN
         self.assertEqual(1, client.received)
         self.assertEqual(0, len(client.errors))
 
+    def test_dynamic_source_anonymous_sender(self):
+        if not SASL.extended():
+            self.skipTest("Cyrus library not available. skipping test")
+
+        container = Container()
+        client = DynamicSourceAnonymousSender()
+        container.connect("admin:admin@127.0.0.1:%d" % self.router_port, handler=client)
+        container.run()
+        self.assertEqual('hello', client.message)
+        self.assertEqual(0, len(client.errors))
+
 
 class ConnectionHandler(MessagingHandler):
     def __init__(self, address, count):
@@ -143,6 +154,25 @@ class ConnectionHandler(MessagingHandler):
         event.container.create_receiver(event.connection, self.address)
         event.container.create_sender(event.connection, self.address)
 
+class DynamicSourceAnonymousSender(MessagingHandler):
+    def __init__(self):
+        super(DynamicSourceAnonymousSender, self).__init__()
+        self.sender = None
+        self.message = None
+        self.errors = []
+
+    def on_message(self, event):
+        self.message = event.message.body;
+        event.connection.close()
+
+    def on_link_opened(self, event):
+        if event.receiver:
+            self.sender.send(Message(address=event.receiver.remote_source.address, body='hello'))
+
+    def on_connection_opened(self, event):
+        event.container.create_receiver(event.connection, None, dynamic=True)
+        self.sender = event.container.create_sender(event.connection, None)
+
 if __name__ == '__main__':
     unittest.main(main_module())
 


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