qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject [1/3] qpid-dispatch git commit: DISPATCH-364 - Added a test to verify attach-failure on the inter-router listener.
Date Wed, 08 Jun 2016 12:19:45 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 4612b70d6 -> d4b88c151


DISPATCH-364 - Added a test to verify attach-failure on the inter-router listener.


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

Branch: refs/heads/master
Commit: d4b88c1515c403246accc8b0dda5dc3430924ed8
Parents: 2661d28
Author: Ted Ross <tross@redhat.com>
Authored: Tue Jun 7 14:50:50 2016 -0400
Committer: Ted Ross <tross@redhat.com>
Committed: Wed Jun 8 08:16:17 2016 -0400

----------------------------------------------------------------------
 tests/system_tests_two_routers.py | 46 ++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d4b88c15/tests/system_tests_two_routers.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_two_routers.py b/tests/system_tests_two_routers.py
index 32a2ee4..6d268f2 100644
--- a/tests/system_tests_two_routers.py
+++ b/tests/system_tests_two_routers.py
@@ -1005,6 +1005,20 @@ class RouterTest(TestCase):
         self.assertEqual(None, test.error)
 
 
+    def test_15_attach_on_inter_router(self):
+        test = AttachOnInterRouterTest(self.routers[0].addresses[5])
+        test.run()
+        self.assertEqual(None, test.error)
+
+
+class Timeout(object):
+    def __init__(self, parent):
+        self.parent = parent
+
+    def on_timer_task(self, event):
+        self.parent.timeout()
+
+
 class ExcessDeliveriesReleasedTest(MessagingHandler):
     def __init__(self, address1, address2):
         super(ExcessDeliveriesReleasedTest, self).__init__(prefetch=0)
@@ -1019,7 +1033,13 @@ class ExcessDeliveriesReleasedTest(MessagingHandler):
         self.n_accepted = 0
         self.n_released = 0
 
+    def timeout(self):
+        self.error = "Timeout Expired"
+        self.conn1.close()
+        self.conn2.close()
+
     def on_start(self, event):
+        self.timer = event.reactor.schedule(5, Timeout(self))
         self.conn1 = event.container.connect(self.address1)
         self.conn2 = event.container.connect(self.address2)
         self.sender   = event.container.create_sender(self.conn1, self.dest)
@@ -1044,6 +1064,7 @@ class ExcessDeliveriesReleasedTest(MessagingHandler):
                 self.error = "Expected 6 received, got %d" % self.n_received
             self.conn1.close()
             self.conn2.close()
+            self.timer.cancel()
 
     def on_message(self, event):
         self.n_received += 1
@@ -1054,6 +1075,31 @@ class ExcessDeliveriesReleasedTest(MessagingHandler):
         Container(self).run()
 
 
+class AttachOnInterRouterTest(MessagingHandler):
+    def __init__(self, address):
+        super(AttachOnInterRouterTest, self).__init__(prefetch=0)
+        self.address = address
+        self.dest = "AOIRtest"
+        self.error = None
+        self.sender = None
+
+    def timeout(self):
+        self.error = "Timeout Expired"
+        self.conn.close()
+
+    def on_start(self, event):
+        self.timer  = event.reactor.schedule(5, Timeout(self))
+        self.conn   = event.container.connect(self.address)
+        self.sender = event.container.create_sender(self.conn, self.dest)
+
+    def on_link_remote_close(self, event):
+        self.conn.close()
+        self.timer.cancel()
+
+    def run(self):
+        Container(self).run()
+
+
 
 try:
     SSLDomain(SSLDomain.MODE_CLIENT)


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


Mime
View raw message