DISPATCH-451: Test connector config settings; Fix setting descriptions

The logic behind the config settings for listeners and connectors is
the same. Add tests to verify that connector settings are propagated
over the wire.
Clarify how maxSessionFrames may be adjusted when the product of
maxFrameSize and maxSessionFrames exceeds 2^31-1.


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

Branch: refs/heads/master
Commit: d5e02b8d7084343fe47873cba4e8bfba66dd1b37
Parents: f1dbfbf
Author: Chuck Rolke <[email protected]>
Authored: Mon Oct 10 11:13:44 2016 -0400
Committer: Chuck Rolke <[email protected]>
Committed: Mon Oct 10 11:13:44 2016 -0400

----------------------------------------------------------------------
 python/qpid_dispatch/management/qdrouter.json |   4 +-
 tests/system_tests_protocol_settings.py       | 109 +++++++++++++++++++++
 2 files changed, 111 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d5e02b8d/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json 
b/python/qpid_dispatch/management/qdrouter.json
index c57a3c1..a748dbf 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -620,7 +620,7 @@
                 },
                 "maxSessionFrames": {
                     "type": "integer",
-                    "description": "Session incoming window measured in 
transfer frames for sessions created on this connection. This is the number of 
transfer frames that may simultaneously be in flight for all links in the 
session. Setting this value to zero selects the default session window size. 
Policy settings, if specified, will overwrite this value. Defaults to 100.",
+                    "description": "Session incoming window measured in 
transfer frames for sessions created on this connection. This is the number of 
transfer frames that may simultaneously be in flight for all links in the 
session. Setting this value to zero selects the default session window size. 
Policy settings, if specified, will overwrite this value. The numerical product 
of maxFrameSize and maxSessionFrames may not exceed 2^31-1. If (maxFrameSize x 
maxSessionFrames) exceeds 2^31-1 then maxSessionFrames is reduced to (2^31-1 / 
maxFrameSize). maxSessionFrames has a minimum value of 1. Defaults to 100.",
                     "default": 100,
                     "required": false,
                     "create": true
@@ -746,7 +746,7 @@
                 },
                 "maxSessionFrames": {
                     "type": "integer",
-                    "description": "Session incoming window measured in 
transfer frames for sessions created on this connection. This is the number of 
transfer frames that may simultaneously be in flight for all links in the 
session. Setting this value to zero selects the default session window size. 
Policy settings will not overwrite this value. Defaults to 100.",
+                    "description": "Session incoming window measured in 
transfer frames for sessions created on this connection. This is the number of 
transfer frames that may simultaneously be in flight for all links in the 
session. Setting this value to zero selects the default session window size. 
Policy settings will not overwrite this value. The numerical product of 
maxFrameSize and maxSessionFrames may not exceed 2^31-1. If (maxFrameSize x 
maxSessionFrames) exceeds 2^31-1 then maxSessionFrames is reduced to (2^31-1 / 
maxFrameSize). maxSessionFrames has a minimum value of 1. Defaults to 100.",
                     "default": 100,
                     "required": false,
                     "create": true

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d5e02b8d/tests/system_tests_protocol_settings.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_protocol_settings.py 
b/tests/system_tests_protocol_settings.py
index 79f2f03..233b9f3 100644
--- a/tests/system_tests_protocol_settings.py
+++ b/tests/system_tests_protocol_settings.py
@@ -312,5 +312,114 @@ class MaxFrameMaxSessionFramesZeroTest(TestCase):
             self.assertTrue(" incoming-window=1," in begin_lines[0])
 
 
+class ConnectorSettingsDefaultTest(TestCase):
+    """
+    The internal logic for protocol settings in listener and connector
+    is common code. This test makes sure that defaults in the connector
+    config make it to the wire.
+    """
+    inter_router_port = None
+
+    @staticmethod
+    def ssl_config(client_server, connection):
+        return []  # Over-ridden by RouterTestSsl
+
+    @classmethod
+    def setUpClass(cls):
+        """Start two routers"""
+        super(ConnectorSettingsDefaultTest, cls).setUpClass()
+
+        def router(name, client_server, connection):
+            config = cls.ssl_config(client_server, connection) + [
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
+
+                ('listener', {'port': cls.tester.get_port()}),
+                connection
+            ]
+
+            config = Qdrouterd.Config(config)
+
+            cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
+
+        cls.routers = []
+
+        inter_router_port = cls.tester.get_port()
+
+        router('A', 'server',
+               ('listener', {'role': 'inter-router', 'port': 
inter_router_port}))
+        router('B', 'client',
+               ('connector', {'name': 'connectorToA', 'role': 'inter-router', 
'port': inter_router_port,
+                              'verifyHostName': 'no'}))
+
+        cls.routers[0].wait_router_connected('QDR.B')
+        cls.routers[1].wait_router_connected('QDR.A')
+
+    def test_connector_default(self):
+        with  open('../setUpClass/A.log', 'r') as router_log:
+            log_lines = router_log.read().split("\n")
+            open_lines = [s for s in log_lines if "<- @open" in s]
+            # defaults
+            self.assertTrue(' max-frame-size=16384,' in open_lines[0])
+            self.assertTrue(' channel-max=32767,' in open_lines[0])
+            begin_lines = [s for s in log_lines if "<- @begin" in s]
+            # defaults
+            self.assertTrue(" incoming-window=100," in begin_lines[0])
+
+
+class ConnectorSettingsNondefaultTest(TestCase):
+    """
+    The internal logic for protocol settings in listener and connector
+    is common code. This test makes sure that settings in the connector
+    config make it to the wire. The listener tests test the setting logic.
+    """
+    inter_router_port = None
+
+    @staticmethod
+    def ssl_config(client_server, connection):
+        return []  # Over-ridden by RouterTestSsl
+
+    @classmethod
+    def setUpClass(cls):
+        """Start two routers"""
+        super(ConnectorSettingsNondefaultTest, cls).setUpClass()
+
+        def router(name, client_server, connection):
+            config = cls.ssl_config(client_server, connection) + [
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
+
+                ('listener', {'port': cls.tester.get_port()}),
+                connection
+            ]
+
+            config = Qdrouterd.Config(config)
+
+            cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
+
+        cls.routers = []
+
+        inter_router_port = cls.tester.get_port()
+
+        router('A', 'server',
+               ('listener', {'role': 'inter-router', 'port': 
inter_router_port}))
+        router('B', 'client',
+               ('connector', {'name': 'connectorToA', 'role': 'inter-router', 
'port': inter_router_port,
+                              'maxFrameSize': '2048', 'maxSessionFrames': 
'10', 'maxSessions': '20',
+                              'verifyHostName': 'no'}))
+
+        cls.routers[0].wait_router_connected('QDR.B')
+        cls.routers[1].wait_router_connected('QDR.A')
+
+    def test_connector_default(self):
+        with  open('../setUpClass/A.log', 'r') as router_log:
+            log_lines = router_log.read().split("\n")
+            open_lines = [s for s in log_lines if "<- @open" in s]
+            # nondefaults
+            self.assertTrue(' max-frame-size=2048,' in open_lines[0])
+            self.assertTrue(' channel-max=19,' in open_lines[0])
+            begin_lines = [s for s in log_lines if "<- @begin" in s]
+            # nondefaults
+            self.assertTrue(" incoming-window=10," in begin_lines[0])
+
+
 if __name__ == '__main__':
     unittest.main(main_module())


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to