Github user ganeshmurthy commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/244#discussion_r161897073
--- Diff: tests/system_tests_exchange_bindings.py ---
@@ -0,0 +1,676 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import ast
+import unittest2 as unittest
+from threading import Thread
+from time import sleep
+from subprocess import PIPE, STDOUT
+
+try:
+ import Queue as Queue # 2.7
+except ImportError:
+ import queue as Queue # 3.x
+
+from system_test import TestCase, Qdrouterd, main_module, TIMEOUT, Process
+from proton import Message, Timeout
+from proton.reactor import AtMostOnce, AtLeastOnce
+from proton.utils import BlockingConnection, SendException
+
+# TIMEOUT=5
+_EXCHANGE_TYPE = "org.apache.qpid.dispatch.router.config.exchange"
+_BINDING_TYPE = "org.apache.qpid.dispatch.router.config.binding"
+
+
+class _AsyncReceiver(object):
+ def __init__(self, address, source, credit=100, timeout=0.1):
+ super(_AsyncReceiver, self).__init__()
+ self.conn = BlockingConnection(address)
+ self.rcvr = self.conn.create_receiver(address=source,
credit=credit)
+ self.thread = Thread(target=self._poll)
+ self.queue = Queue.Queue()
+ self._run = True
+ self._timeout = timeout
+ self.thread.start()
+
+ def _poll(self):
+ while self._run:
+ try:
+ msg = self.rcvr.receive(timeout=self._timeout)
+ except Timeout:
+ continue
+ try:
+ self.rcvr.accept()
+ except IndexError:
+ # PROTON-1743
+ pass
+ self.queue.put(msg)
+ self.rcvr.close()
+ self.conn.close()
+
+ def stop(self):
+ self._run = False
+ self.thread.join(timeout=TIMEOUT)
+
+
+class ExchangeBindingsTest(TestCase):
+ """
+ Tests the exchange/bindings of the dispatch router.
+ """
+ def _create_router(self, name, config):
+
+ config = [
+ ('router', {'mode': 'standalone', 'id': 'QDR.%s'%name}),
+ ('listener', {'role': 'normal', 'host': '0.0.0.0',
+ 'port': self.tester.get_port(),
+ 'saslMechanisms':'ANONYMOUS'})
+ ] + config
+ return self.tester.qdrouterd(name, Qdrouterd.Config(config))
+
+ def run_qdmanage(self, router, cmd, input=None,
expect=Process.EXIT_OK):
+ p = self.popen(
+ ['qdmanage'] + cmd.split(' ')
+ + ['--bus', router.addresses[0], '--indent=-1', '--timeout',
str(TIMEOUT)],
+ stdin=PIPE, stdout=PIPE, stderr=STDOUT, expect=expect)
+ out = p.communicate(input)[0]
+ try:
+ p.teardown()
+ except Exception, e:
+ raise Exception("%s\n%s" % (e, out))
+ return out
+
+ def _validate_entity(self, name, kind, entities, expected):
+ for entity in entities:
+ if "name" in entity and entity["name"] == name:
+ for k,v in expected.items():
+ self.assertTrue(k in entity)
+ self.assertEqual(v, entity[k])
+ return;
--- End diff --
No semi colon here
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]