qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject qpid-dispatch git commit: DISPATCH-1062 - Added unit test to test if phase shows up as zero for autoLinked waypointed addresses
Date Mon, 09 Jul 2018 20:33:23 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 5f4f69c9a -> d9c747d49


DISPATCH-1062 - Added unit test to test if phase shows up as zero for autoLinked waypointed
addresses


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

Branch: refs/heads/master
Commit: d9c747d4993fcf5deaca894e1d0a2c56b16b58cc
Parents: 5f4f69c
Author: Ganesh Murthy <gmurthy@redhat.com>
Authored: Mon Jul 9 16:31:05 2018 -0400
Committer: Ganesh Murthy <gmurthy@redhat.com>
Committed: Mon Jul 9 16:31:05 2018 -0400

----------------------------------------------------------------------
 tests/system_tests_multi_tenancy.py | 71 ++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d9c747d4/tests/system_tests_multi_tenancy.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_multi_tenancy.py b/tests/system_tests_multi_tenancy.py
index 6674dc9..a651c96 100644
--- a/tests/system_tests_multi_tenancy.py
+++ b/tests/system_tests_multi_tenancy.py
@@ -28,6 +28,7 @@ from system_test import TestCase, Qdrouterd, main_module, TIMEOUT
 from proton.handlers import MessagingHandler
 from proton.reactor import Container, DynamicNodeProperties
 from qpid_dispatch_internal.compat import UNICODE
+from qpid_dispatch.management.client import Node
 
 # PROTON-828:
 try:
@@ -463,6 +464,16 @@ class RouterTest(TestCase):
         test.run()
         self.assertEqual(None, test.error)
 
+    def test_37_two_router_waypoint_no_tenant_external_addr_phase(self):
+        """
+        Attaches two receiver each to one router with an autoLinked address and makes sure
that the phase
+        on both receivers is set to 1
+        :return:
+        """
+        test = WaypointReceiverPhaseTest(self.routers[0].addresses[0], self.routers[1].addresses[2],
"0.0.0.0/queue.ext")
+        test.run()
+        self.assertEqual(None, test.error)
+
 
 class Entity(object):
     def __init__(self, status_code, status_description, attrs):
@@ -835,6 +846,66 @@ class LinkRouteTest(MessagingHandler):
         container.run()
 
 
+class WaypointReceiverPhaseTest(MessagingHandler):
+    def __init__(self, first_host, second_host, dest):
+        super(WaypointReceiverPhaseTest, self).__init__()
+        self.first_host = first_host
+        self.second_host = second_host
+        self.first_conn = None
+        self.second_conn = None
+        self.error = None
+        self.timer = None
+        self.receiver1 = None
+        self.receiver2 = None
+        self.dest = dest
+        self.receiver1_phase = False
+        self.receiver2_phase = False
+
+    def timeout(self):
+        self.error = "The phase on the receiver links were not set to 1"
+        self.first_conn.close()
+        self.second_conn.close()
+
+    def on_start(self, event):
+        self.timer = event.reactor.schedule(TIMEOUT, Timeout(self))
+        self.first_conn = event.container.connect(self.first_host)
+        self.second_conn = event.container.connect(self.second_host)
+        self.receiver1 = event.container.create_receiver(self.first_conn, self.dest, name="AAA")
+        self.receiver2 = event.container.create_receiver(self.second_conn, self.dest, name="BBB")
+
+    def on_link_opened(self, event):
+        if event.receiver == self.receiver1:
+            local_node = Node.connect(self.first_host, timeout=TIMEOUT)
+            out = local_node.query(type='org.apache.qpid.dispatch.router.link')
+            link_type_index = out.attribute_names.index('linkType')
+            link_dir_index = out.attribute_names.index('linkDir')
+            owning_addr_index = out.attribute_names.index('owningAddr')
+            link_name_index = out.attribute_names.index('linkName')
+
+            for result in out.results:
+                if result[link_type_index] == "endpoint" and result[link_dir_index] == "out"
and result[link_name_index] == 'AAA' and result[owning_addr_index] == 'M10.0.0.0/queue.ext':
+                    self.receiver1_phase = True
+        elif event.receiver == self.receiver2:
+            local_node = Node.connect(self.second_host, timeout=TIMEOUT)
+            out = local_node.query(type='org.apache.qpid.dispatch.router.link')
+            link_type_index = out.attribute_names.index('linkType')
+            link_dir_index = out.attribute_names.index('linkDir')
+            owning_addr_index = out.attribute_names.index('owningAddr')
+            link_name_index = out.attribute_names.index('linkName')
+
+            for result in out.results:
+                if result[link_type_index] == "endpoint" and result[link_dir_index] == "out"
and result[link_name_index] == 'BBB' and result[owning_addr_index] == 'M10.0.0.0/queue.ext':
+                    self.receiver2_phase = True
+
+        if self.receiver1_phase and self.receiver2_phase:
+            self.first_conn.close()
+            self.second_conn.close()
+            self.timer.cancel()
+
+    def run(self):
+        Container(self).run()
+
+
 class WaypointTest(MessagingHandler):
     def __init__(self, first_host, second_host, first_address, second_address, container_id="ALC"):
         super(WaypointTest, self).__init__()


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


Mime
View raw message