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/05/17 20:55:13 UTC

[2/2] qpid-dispatch git commit: DISPATCH-155 - From Jakub Scholz and Ganesh Murthy - Allow two connectors to the same host/port.

DISPATCH-155 - From Jakub Scholz and Ganesh Murthy - Allow two connectors to the same host/port.


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

Branch: refs/heads/master
Commit: e590e9ed9ffec96ae790518a210ccc4aee9a8b26
Parents: e9459c1
Author: Ted Ross <tr...@redhat.com>
Authored: Tue May 17 16:54:10 2016 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Tue May 17 16:54:10 2016 -0400

----------------------------------------------------------------------
 python/qpid_dispatch_internal/management/agent.py | 14 ++++++--------
 tests/system_test.py                              | 12 ++++++++++--
 tests/system_tests_management.py                  |  2 +-
 tests/system_tests_qdmanage.py                    | 11 ++++++++---
 4 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e590e9ed/python/qpid_dispatch_internal/management/agent.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/agent.py b/python/qpid_dispatch_internal/management/agent.py
index e6c664c..77e3416 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@ -319,11 +319,11 @@ class PolicyStatsEntity(EntityAdapter):
         return self.attributes.get('applicationName')
 
 
-def _host_port_identifier(entity):
-    for attr in ['host', 'port']: # Set default values if need be
+def _host_port_name_identifier(entity):
+    for attr in ['host', 'port', 'name']: # Set default values if need be
         entity.attributes.setdefault(
             attr, entity.entity_type.attribute(attr).missing_value())
-    return "%s:%s" % (entity.attributes['host'], entity.attributes['port'])
+    return "%s:%s:%s" % (entity.attributes['host'], entity.attributes['port'], entity.attributes['name'])
 
 
 class ListenerEntity(EntityAdapter):
@@ -333,7 +333,7 @@ class ListenerEntity(EntityAdapter):
         return config_listener
 
     def _identifier(self):
-        return _host_port_identifier(self)
+        return _host_port_name_identifier(self)
 
     def __str__(self):
         return super(ListenerEntity, self).__str__().replace("Entity(", "ListenerEntity(")
@@ -341,8 +341,6 @@ class ListenerEntity(EntityAdapter):
     def _delete(self):
         self._qd.qd_connection_manager_delete_listener(self._dispatch, self._implementations[0].key)
 
-    def _identifier(self): return _host_port_identifier(self)
-
 class ConnectorEntity(EntityAdapter):
     def create(self):
         config_connector = self._qd.qd_dispatch_configure_connector(self._dispatch, self)
@@ -353,7 +351,7 @@ class ConnectorEntity(EntityAdapter):
         self._qd.qd_connection_manager_delete_connector(self._dispatch, self._implementations[0].key)
 
     def _identifier(self):
-        return _host_port_identifier(self)
+        return _host_port_name_identifier(self)
 
     def __str__(self):
         return super(ConnectorEntity, self).__str__().replace("Entity(", "ConnectorEntity(")
@@ -469,7 +467,7 @@ class RouterAddressEntity(EntityAdapter):
 
 class ConnectionEntity(EntityAdapter):
     def _identifier(self):
-        return self.attributes.get('host')
+        return self.attributes.get('host') + ":" + str(self.attributes.get('identity'))
 
     def __str__(self):
         return super(ConnectionEntity, self).__str__().replace("Entity(", "ConnectionEntity(")

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e590e9ed/tests/system_test.py
----------------------------------------------------------------------
diff --git a/tests/system_test.py b/tests/system_test.py
index f97b2bc..f4d070f 100755
--- a/tests/system_test.py
+++ b/tests/system_test.py
@@ -437,10 +437,18 @@ class Qdrouterd(Process):
         return address_list
 
     def is_connected(self, port, host='127.0.0.1'):
-        """If router has a connection to host:port return the management info.
+        """If router has a connection to host:port:identity return the management info.
         Otherwise return None"""
         try:
-            return self.management.read(name="connection/%s:%s" % (host, port))
+            ret_val = False
+            response = self.management.query(type="org.apache.qpid.dispatch.connection")
+            index_name = response.attribute_names.index('name')
+            index_identity = response.attribute_names.index('identity')
+            for result in response.results:
+                outs = 'connection/%s:%s:%s' % (host, port, str(result[index_identity]))
+                if result[index_name] == outs:
+                    ret_val = True
+            return ret_val
         except:
             return False
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e590e9ed/tests/system_tests_management.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_management.py b/tests/system_tests_management.py
index 1f6d486..662e11b 100644
--- a/tests/system_tests_management.py
+++ b/tests/system_tests_management.py
@@ -257,7 +257,7 @@ class ManagementTest(system_test.TestCase):
         self.assertEqual(str(self.router.ports[0]), entity.port)
 
         entity = self.node.read(
-            type=LISTENER, identity='listener/0.0.0.0:%s' % self.router.ports[1])
+            type=LISTENER, identity='listener/0.0.0.0:%s:l1' % self.router.ports[1])
         self.assertEqual('l1', entity.name)
         self.assertEqual(str(self.router.ports[1]), entity.port)
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e590e9ed/tests/system_tests_qdmanage.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_qdmanage.py b/tests/system_tests_qdmanage.py
index 5621675..b8837b3 100644
--- a/tests/system_tests_qdmanage.py
+++ b/tests/system_tests_qdmanage.py
@@ -212,10 +212,15 @@ class QdmanageTest(TestCase):
 
         # Re-create the connector and then try wait_connectors
         self.create(long_type, name, str(QdmanageTest.inter_router_port))
-        full_name = 'connection/0.0.0.0:' + str(QdmanageTest.inter_router_port)
-        output = json.loads(self.run_qdmanage('READ --type=org.apache.qpid.dispatch.connection --name ' + full_name))
 
-        self.assertEquals(full_name, output['name'])
+        results = json.loads(self.run_qdmanage('QUERY --type=org.apache.qpid.dispatch.connection'))
+
+        created = False
+        for result in results:
+            name = result['name']
+            if 'connection/0.0.0.0:%s:' % QdmanageTest.inter_router_port in name:
+                created = True
+        self.assertTrue(created)
 
     def test_zzz_add_connector(self):
         port = self.get_port()


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