You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2018/02/16 18:44:51 UTC
qpid-dispatch git commit: DISPATCH-883 - Prevent the router from
crashing when the connection properties is not PN_STRING or PN_SYMBOL or
PN_INTEGER. Also added a few system tests
Repository: qpid-dispatch
Updated Branches:
refs/heads/1.0.x 9e7b3bff9 -> ae87d1c06
DISPATCH-883 - Prevent the router from crashing when the connection properties is not PN_STRING or PN_SYMBOL or PN_INTEGER. Also added a few system tests
(cherry picked from commit b46e5de3def3b26ebe3cbb45d8c03cbe2e163598)
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ae87d1c0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ae87d1c0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ae87d1c0
Branch: refs/heads/1.0.x
Commit: ae87d1c066f80109c6d52d3365a796b4d0f3ddec
Parents: 9e7b3bf
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Tue Nov 21 12:59:13 2017 -0500
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Fri Feb 16 13:41:03 2018 -0500
----------------------------------------------------------------------
src/router_core/agent_connection.c | 14 ++++---
tests/system_tests_one_router.py | 66 +++++++++++++++++++++++++++++++--
2 files changed, 70 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ae87d1c0/src/router_core/agent_connection.c
----------------------------------------------------------------------
diff --git a/src/router_core/agent_connection.c b/src/router_core/agent_connection.c
index fd7aa5d..810cbae 100644
--- a/src/router_core/agent_connection.c
+++ b/src/router_core/agent_connection.c
@@ -212,12 +212,14 @@ static void qdr_connection_insert_column_CT(qdr_connection_t *conn, int col, qd_
// We are assuming for now that all values are either strings or integers
qd_get_next_pn_data(&data, &value_string, &value_int);
- qd_compose_insert_string(body, key);
-
- if (value_string)
- qd_compose_insert_string(body, value_string);
- else if (value_int)
- qd_compose_insert_int(body, value_int);
+ // We now have the key and the value. Do not insert the key or the value if key is empty
+ if (key) {
+ qd_compose_insert_string(body, key);
+ if (value_string)
+ qd_compose_insert_string(body, value_string);
+ else if (value_int)
+ qd_compose_insert_int(body, value_int);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ae87d1c0/tests/system_tests_one_router.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py
index f9beed5..47cd3ef 100644
--- a/tests/system_tests_one_router.py
+++ b/tests/system_tests_one_router.py
@@ -18,14 +18,18 @@
#
import unittest
-from proton import Condition, Message, Delivery, PENDING, ACCEPTED, REJECTED, Url
+from proton import Condition, Message, Delivery, PENDING, ACCEPTED, REJECTED, Url, symbol
from system_test import TestCase, Qdrouterd, main_module, TIMEOUT
from proton.handlers import MessagingHandler, TransactionHandler
from proton.reactor import Container, AtMostOnce, AtLeastOnce
from proton.utils import BlockingConnection, SyncRequestResponse
from qpid_dispatch.management.client import Node
-CONNECTION_PROPERTIES = {u'connection': u'properties', u'int_property': 6451}
+CONNECTION_PROPERTIES_UNICODE_STRING = {u'connection': u'properties', u'int_property': 6451}
+CONNECTION_PROPERTIES_SYMBOL = dict()
+CONNECTION_PROPERTIES_SYMBOL[symbol("connection")] = symbol("properties")
+CONNECTION_PROPERTIES_BINARY = {'client_identifier': 'policy_server'}
+
class OneRouterTest(TestCase):
"""System tests involving a single router"""
@@ -1156,10 +1160,13 @@ class OneRouterTest(TestCase):
test.run()
self.assertTrue(test.received_error)
- def test_connection_properties(self):
+ def test_connection_properties_unicode_string(self):
+ """
+ Tests connection property that is a map of unicode strings and integers
+ """
connection = BlockingConnection(self.router.addresses[0],
timeout=60,
- properties=CONNECTION_PROPERTIES)
+ properties=CONNECTION_PROPERTIES_UNICODE_STRING)
client = SyncRequestResponse(connection)
node = Node.connect(self.router.addresses[0])
@@ -1176,6 +1183,57 @@ class OneRouterTest(TestCase):
self.assertTrue(found)
client.connection.close()
+ def test_connection_properties_symbols(self):
+ """
+ Tests connection property that is a map of symbols
+ """
+ connection = BlockingConnection(self.router.addresses[0],
+ timeout=60,
+ properties=CONNECTION_PROPERTIES_SYMBOL)
+ client = SyncRequestResponse(connection)
+
+ node = Node.connect(self.router.addresses[0])
+
+ results = node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'properties']).results
+
+ found = False
+ for result in results:
+ if u'connection' in result[0]:
+ if result[0][u'connection'] == u'properties':
+ found = True
+ break
+
+ self.assertTrue(found)
+
+ client.connection.close()
+
+ def test_connection_properties_binary(self):
+ """
+ Tests connection property that is a binary map. The router ignores AMQP binary data type.
+ Router should not return anything for connection properties
+ """
+ connection = BlockingConnection(self.router.addresses[0],
+ timeout=60,
+ properties=CONNECTION_PROPERTIES_BINARY)
+ client = SyncRequestResponse(connection)
+
+ node = Node.connect(self.router.addresses[0])
+
+ results = node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'properties']).results
+
+ results_found = True
+
+ for result in results:
+ if not result[0]:
+ results_found = False
+ else:
+ results_found = True
+ break
+
+ self.assertFalse(results_found)
+
+ client.connection.close()
+
class Timeout(object):
def __init__(self, parent):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org