def test_listen_error(self): """Make sure a router exits if an initial HTTP listener fails, doesn't hang""" listen_port = self.get_port() config = Qdrouterd.Config([ ('router', {'mode': 'standalone', 'id': 'bad'}), ('listener', {'port': listen_port, 'maxFrameSize': '2048', 'stripAnnotations': 'no'}), ('listener', {'port': listen_port, 'http':True})]) r = Qdrouterd(name="expect_fail", config=config, wait=False); self.assertEqual(1, r.wait())
def router(name, mode, connection, extra=None): config = [('router', { 'mode': mode, 'id': name }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no' }), ('listener', { 'port': cls.tester.get_port(), 'role': 'route-container', 'stripAnnotations': 'no' }), ('linkRoute', { 'prefix': 'queue', 'containerId': 'LRC_S', 'direction': 'out' }), ('linkRoute', { 'prefix': 'queue', 'containerId': 'LRC_R', 'direction': 'in' }), ('address', { 'prefix': 'closest', 'distribution': 'closest' }), ('address', { 'prefix': 'spread', 'distribution': 'balanced' }), ('address', { 'prefix': 'multicast', 'distribution': 'multicast' }), connection] if extra: config.append(extra) config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def router(name, connection, args=[]): config = [('router', { 'mode': 'interior', 'id': name }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no' }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'multiTenant': 'yes' }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'role': 'route-container' }), ('address', { 'prefix': 'closest', 'distribution': 'closest' }), ('address', { 'prefix': 'spread', 'distribution': 'balanced' }), ('address', { 'prefix': 'multicast', 'distribution': 'multicast' }), ('address', { 'prefix': '0.0.0.0/queue', 'waypoint': 'yes' }), connection] config = Qdrouterd.Config(config) cls.routers.append( cls.tester.qdrouterd(name, config, wait=True, cl_args=args))
def test_http_get(self): if not sys.version_info >= (2, 9): return config = Qdrouterd.Config([ ('router', { 'id': 'QDR.HTTP' }), ('listener', { 'port': self.get_port(), 'httpRoot': os.path.dirname(__file__) }), ('listener', { 'port': self.get_port(), 'httpRoot': os.path.dirname(__file__) }), ]) r = self.qdrouterd('http-test-router', config) def test(port): self.assert_get("http://localhost:%d" % port) self.assertRaises(urllib2.HTTPError, urllib2.urlopen, "http://localhost:%d/nosuch" % port) # Sequential calls on multiple ports for port in r.ports: test(port) # Concurrent calls on multiple ports class TestThread(threading.Thread): def __init__(self, port): threading.Thread.__init__(self) self.port, self.ex = port, None self.start() def run(self): try: test(self.port) except Exception, e: self.ex = e
def setUpClass(cls): """Uses a default config for testing""" super(CommandLineTest, cls).setUpClass() cls.name = "test-router-1" CommandLineTest.testname = cls.name CommandLineTest.testport = cls.tester.get_port() cls.config = Qdrouterd.Config([ ('router', { 'mode': 'standalone', 'id': CommandLineTest.name }), ('listener', { 'port': CommandLineTest.testport }), ('log', { 'module': 'DEFAULT', 'enable': 'trace+', 'includeSource': 'true', 'outputFile': os.getcwd() + "/" + CommandLineTest.name + '.log' }) ])
def setUpClass(cls): super(QdmanageTest, cls).setUpClass() config = Qdrouterd.Config([('ssl-profile', { 'name': 'server-ssl', 'cert-db': cls.ssl_file('ca-certificate.pem'), 'cert-file': cls.ssl_file('server-certificate.pem'), 'key-file': cls.ssl_file('server-private-key.pem'), 'password': '******' }), ('listener', { 'port': cls.tester.get_port() }), ('listener', { 'port': cls.tester.get_port(), 'ssl-profile': 'server-ssl' })]) cls.router = cls.tester.qdrouterd('test-router', config, wait=True)
def setUpClass(cls): """Start a router and a messenger""" super(RouterMessageLogTestAll, cls).setUpClass() name = "test-router" config = Qdrouterd.Config([ ('router', { 'mode': 'standalone', 'id': 'QDR' }), ('listener', { 'port': cls.tester.get_port(), 'maxFrameSize': MAX_FRAME, 'messageLoggingComponents': 'all' }), ('log', { 'module': 'MESSAGE', 'enable': 'trace+', 'outputFile': 'QDR-message.log' }), ('log', { 'module': 'DEFAULT', 'enable': 'info+', 'includeSource': 'true', 'outputFile': 'QDR.log' }), ('address', { 'prefix': 'closest', 'distribution': 'closest' }), ('address', { 'prefix': 'spread', 'distribution': 'balanced' }), ('address', { 'prefix': 'multicast', 'distribution': 'multicast' }), ]) cls.router = cls.tester.qdrouterd(name, config) cls.router.wait_ready()
def router(name, connection): config = [ ('router', {'mode': 'interior', 'id': name}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'multiTenant': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'role': 'route-container'}), ('linkRoute', {'prefix': 'hosted-group-1/link', 'direction': 'in', 'containerId': 'LRC'}), ('linkRoute', {'prefix': 'hosted-group-1/link', 'direction': 'out', 'containerId': 'LRC'}), ('autoLink', {'address': 'hosted-group-1/queue.waypoint', 'containerId': 'ALC', 'direction': 'in'}), ('autoLink', {'address': 'hosted-group-1/queue.waypoint', 'containerId': 'ALC', 'direction': 'out'}), ('autoLink', {'address': 'hosted-group-1/queue.ext', 'containerId': 'ALCE', 'direction': 'in', 'externalAddress': 'EXT'}), ('autoLink', {'address': 'hosted-group-1/queue.ext', 'containerId': 'ALCE', 'direction': 'out', 'externalAddress': 'EXT'}), ('address', {'prefix': 'closest', 'distribution': 'closest'}), ('address', {'prefix': 'spread', 'distribution': 'balanced'}), ('address', {'prefix': 'multicast', 'distribution': 'multicast'}), ('address', {'prefix': 'hosted-group-1/queue', 'waypoint': 'yes'}), ('policy', {'enableVhostPolicy': 'true'}), ('vhost', {'hostname': 'hosted-group-1', 'allowUnknownUser': '******', 'aliases': '0.0.0.0', 'groups': { '$default': { 'users': '*', 'maxConnections': 100, 'remoteHosts': '*', 'sources': '*', 'targets': '*', 'allowAnonymousSender': 'true', 'allowWaypointLinks': 'true', 'allowDynamicSource': 'true' } } }), connection ] config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def setUpClass(cls): super(RouteContainerIngressCount, cls).setUpClass() config = Qdrouterd.Config([ ('router', { 'mode': 'standalone', 'id': 'QDR' }), # # Create a general-purpose listener for sending and receiving deliveries # ('listener', { 'port': cls.tester.get_port() }), # Create a route-container listener and give it a name myListener. # Later on we will create an autoLink which has a connection property of myListener. # ('listener', { 'role': 'route-container', 'name': 'myListener', 'port': cls.tester.get_port() }), # # Note here that the connection is set to a previously declared 'myListener' # ('autoLink', { 'addr': 'myListener.1', 'connection': 'myListener', 'direction': 'in' }), ('autoLink', { 'addr': 'myListener.1', 'connection': 'myListener', 'direction': 'out' }), ]) cls.router = cls.tester.qdrouterd(name="A", config=config, wait=True)
def test_http_metrics(self): config = Qdrouterd.Config([ ('router', {'id': 'QDR.METRICS'}), ('listener', {'port': self.get_port(), 'http': 'yes'}), ('listener', {'port': self.get_port(), 'httpRootDir': os.path.dirname(__file__)}), ]) r = self.qdrouterd('metrics-test-router', config) def test(port): result = urlopen("http://localhost:%d/metrics" % port, cafile=self.ssl_file('ca-certificate.pem')) self.assertEqual(200, result.getcode()) data = result.read().decode('utf-8') assert 'connections' in data assert 'deliveries_ingress' in data assert 'deliveries_delayed_1sec' in data assert 'deliveries_delayed_10sec' in data assert 'deliveries_redirected_to_fallback' in data # Sequential calls on multiple ports for port in r.ports: test(port) # Concurrent calls on multiple ports class TestThread(threading.Thread): def __init__(self, port): threading.Thread.__init__(self) self.port, self.ex = port, None self.start() def run(self): try: test(self.port) except Exception as e: self.ex = e threads = [TestThread(p) for p in r.ports + r.ports] for t in threads: t.join() for t in threads: if t.ex: raise t.ex
def setUpClass(cls): """Start the router""" super(PolicyWarnings, cls).setUpClass() listen_port = cls.tester.get_port() policy_config_path = os.path.join(DIR, 'policy-6') config = Qdrouterd.Config([('router', { 'mode': 'standalone', 'id': 'QDR.Policy' }), ('listener', { 'port': listen_port }), ('policy', { 'maxConnections': 2, 'policyDir': policy_config_path, 'enableVhostPolicy': 'true' })]) cls.router = cls.tester.qdrouterd('PolicyWarnings', config, wait=False) try: cls.router.wait_ready(timeout=5) except Exception, e: pass
def setUpClass(cls): """Uses a default config for testing""" super(CommandLineTest2, cls).setUpClass() cls.name = "test-router-2" CommandLineTest2.testname = cls.name CommandLineTest2.testport = cls.tester.get_port() # output has been deprecated. We are using it here to test backward compatibility. cls.config = Qdrouterd.Config([ ('router', { 'mode': 'standalone', 'id': CommandLineTest2.testname }), ('listener', { 'port': CommandLineTest2.testport }), ('log', { 'module': 'DEFAULT', 'enable': 'trace+', 'includeSource': 'true', 'output': os.getcwd() + "/" + CommandLineTest2.name + '.log' }) ])
def setUpClass(cls): super(LogModuleProtocolTest, cls).setUpClass() name = "test-router" LogModuleProtocolTest.listen_port = cls.tester.get_port() config = Qdrouterd.Config([('router', { 'mode': 'standalone', 'id': 'QDR' }), ('listener', { 'port': LogModuleProtocolTest.listen_port }), ('address', { 'prefix': 'closest', 'distribution': 'closest' }), ('address', { 'prefix': 'balanced', 'distribution': 'balanced' }), ('address', { 'prefix': 'multicast', 'distribution': 'multicast' })]) cls.router = cls.tester.qdrouterd(name, config) cls.router.wait_ready() cls.address = cls.router.addresses[0]
def setUpClass(cls): super(DetachAfterAttachTest, cls).setUpClass() name = "test-router" config = Qdrouterd.Config([ ('router', {'mode': 'standalone', 'id': 'A'}), ('listener', {'host': '127.0.0.1', 'role': 'normal', 'port': cls.tester.get_port()}), ('listener', {'role': 'route-container', 'name': 'myListener', 'port': cls.tester.get_port()}), ('autoLink', {'address': 'myListener.1', 'connection': 'myListener', 'direction': 'in'}), ('autoLink', {'address': 'myListener.1', 'connection': 'myListener', 'direction': 'out'}), ]) cls.router = cls.tester.qdrouterd(name, config) cls.router.wait_ready() cls.route_address = cls.router.addresses[1]
def setUpClass(cls): super(DefaultDistributionTest, cls).setUpClass() name = "test-router" config = Qdrouterd.Config([('router', { 'mode': 'standalone', 'id': 'QDR', "defaultDistribution": 'unavailable' }), ('listener', { 'port': cls.tester.get_port() }), ('address', { 'prefix': 'closest', 'distribution': 'closest' }), ('address', { 'prefix': 'spread', 'distribution': 'balanced' }), ('address', { 'prefix': 'multicast', 'distribution': 'multicast' })]) cls.router = cls.tester.qdrouterd(name, config) cls.router.wait_ready() cls.address = cls.router.addresses[0]
def setUpClass(cls): """ Set up router instance configuration to be used for testing. :return: """ super(RouterTestBadConfiguration, cls).setUpClass() cls.name = "test-router" cls.config = Qdrouterd.Config([ ('router', {'mode': 'standalone', 'id': 'QDR.A'}), # Define a connector that uses an unresolvable hostname ('connector', {'name': 'UnresolvableConn', 'host': 'unresolvable.host.name', 'port': 'amqp'}), ('listener', {'port': cls.tester.get_port()}), ]) try: cls.router = cls.tester.qdrouterd(cls.name, cls.config, wait=False) except OSError: pass
def router(name, mode, connection, extra=None): config = [('router', { 'mode': mode, 'id': name }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no' }), ('address', { 'prefix': 'queue', 'waypoint': 'yes' }), ('address', { 'prefix': 'multi', 'ingressPhase': '0', 'egressPhase': '9' }), connection] if extra: config.append(extra) config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def router(name): config = [('router', { 'mode': 'standalone', 'id': name }), ('listener', { 'port': cls.tester.get_port() }), ('listener', { 'port': cls.tester.get_port(), 'failoverList': 'other-host:25000' }), ('listener', { 'port': cls.tester.get_port(), 'failoverList': 'second-host:25000, amqps://third-host:5671' })] config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def test_https_get(self): if not sys.version_info >= (2, 9): return def listener(**kwargs): args = dict(kwargs) args.update({'port': self.get_port(), 'httpRootDir': os.path.dirname(__file__)}) return ('listener', args) config = Qdrouterd.Config([ ('router', {'id': 'QDR.HTTPS'}), ('sslProfile', {'name': 'simple-ssl', 'caCertFile': self.ssl_file('ca-certificate.pem'), 'certFile': self.ssl_file('server-certificate.pem'), 'privateKeyFile': self.ssl_file('server-private-key.pem'), 'ciphers': 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS', 'password': '******' }), listener(sslProfile='simple-ssl', requireSsl=False, authenticatePeer=False), listener(sslProfile='simple-ssl', requireSsl=True, authenticatePeer=False), listener(sslProfile='simple-ssl', requireSsl=True, authenticatePeer=True)]) # saslMechanisms='EXTERNAL' r = self.qdrouterd('https-test-router', config) r.wait_ready() self.assert_get("https://localhost:%s" % r.ports[0]) # requireSsl=false Allows simple-ssl HTTP self.assert_get("http://localhost:%s" % r.ports[0]) self.assert_get("https://localhost:%s" % r.ports[1]) # requireSsl=True does not allow simple-ssl HTTP self.assertRaises(Exception, self.assert_get, "http://localhost:%s" % r.ports[1]) # authenticatePeer=True requires a client cert self.assertRaises(URLError, self.assert_get, "https://localhost:%s" % r.ports[2]) # Provide client cert self.assert_get_cert("https://localhost:%d" % r.ports[2])
def setUpClass(cls): super(RouterTestDeprecatedLAutoLink, cls).setUpClass() name = "test-autolink" config = Qdrouterd.Config([ ('router', { 'mode': 'standalone', 'id': 'QDR.B' }), # We are trying to declare a link route with both 'dir' and 'direction' attributes. # The router must not start in this case. ('autoLink', { 'addr': 'node.1', 'containerId': 'container.1', 'dir': 'in', 'direction': 'in' }), ('autoLink', { 'addr': 'node.1', 'containerId': 'container.1', 'direction': 'out' }), ('listener', { 'port': cls.tester.get_port() }), ]) cls.router = cls.tester.qdrouterd(name, config, wait=False, perform_teardown=False) # Try connecting for 4 seconds. If unable to connect, just move on. try: cls.router.wait_ready(timeout=4) except: pass
def test_http_get(self): config = Qdrouterd.Config([ ('router', {'id': 'QDR.HTTP'}), # httpRoot has been deprecated. We are using it here to test backward compatibility. ('listener', {'port': self.get_port(), 'httpRoot': os.path.dirname(__file__)}), ('listener', {'port': self.get_port(), 'httpRootDir': os.path.dirname(__file__)}), ]) r = self.qdrouterd('http-test-router', config) def test(port): self.assert_get("http://localhost:%d" % port) self.assertRaises(HTTPError, urlopen, "http://localhost:%d/nosuch" % port) # Sequential calls on multiple ports for port in r.ports: test(port) # Concurrent calls on multiple ports class TestThread(threading.Thread): def __init__(self, port): threading.Thread.__init__(self) self.port, self.ex = port, None self.start() def run(self): try: test(self.port) except Exception as e: self.ex = e threads = [TestThread(p) for p in r.ports + r.ports] for t in threads: t.join() for t in threads: if t.ex: raise t.ex # https not configured self.assertRaises(URLError, urlopen, "https://localhost:%d/nosuch" % r.ports[0])
def router(name, client_server, connection): config = [ # Use the deprecated attributes helloInterval, raInterval, raIntervalFlux, remoteLsMaxAge # The routers should still start successfully after using these deprecated entities. ('router', {'remoteLsMaxAge': 60, 'helloInterval': 1, 'raInterval': 30, 'raIntervalFlux': 4, 'mode': 'interior', 'id': 'QDR.%s'%name, 'allowUnsettledMulticast': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'linkCapacity': 500}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'both'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'out'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'in'}), ('address', {'prefix': 'closest', 'distribution': 'closest'}), ('address', {'prefix': 'balanced', 'distribution': 'balanced'}), ('address', {'prefix': 'multicast', 'distribution': 'multicast'}), # for testing pattern matching ('address', {'pattern': 'a.b.c.d', 'distribution': 'closest'}), ('address', {'pattern': '#.b.c.d', 'distribution': 'multicast'}), ('address', {'pattern': 'a/*/#/d', 'distribution': 'closest'}), ('address', {'pattern': '*/b/c/d', 'distribution': 'multicast'}), ('address', {'pattern': 'a.x.d', 'distribution': 'closest'}), ('address', {'pattern': 'a.*.d', 'distribution': 'multicast'}), connection ] config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def _create_router(self, name, ra_interval=None, ra_stale=None, ra_flux=None, extra=None): config = [ ( 'router', { 'id': name, 'mode': 'interior', # these are the default values from qdrouter.json 'raIntervalSeconds': ra_interval or 30, 'raIntervalFluxSeconds': ra_flux or 4, 'remoteLsMaxAgeSeconds': ra_stale or 60 }), ('listener', { 'role': 'normal', 'port': self.tester.get_port() }), ('address', { 'prefix': 'closest', 'distribution': 'closest' }), ('address', { 'prefix': 'multicast', 'distribution': 'multicast' }), ] if extra: config.extend(extra) return self.tester.qdrouterd(name, Qdrouterd.Config(config), wait=False, expect=None)
def test_http_listener_delete(self): name = 'delete_listener' normal_listen_port = self.get_port() http_delete_listen_port = self.get_port() config = Qdrouterd.Config([ ('router', {'mode': 'standalone', 'id': 'A'}), ('listener', {'port': normal_listen_port, 'maxFrameSize': '2048', 'stripAnnotations': 'no'}), ('listener', {'name': name, 'port': http_delete_listen_port, 'http': True})]) router = self.qdrouterd(name="expect_fail_1", config=config, wait=True) exception_occurred = False def address(): return router.addresses[0] long_type = 'org.apache.qpid.dispatch.listener' delete_command = 'DELETE --type=' + long_type + ' --name=' + name try: out = self.run_qdmanage(delete_command, address=address()) except Exception as e: exception_occurred = True self.assertTrue("BadRequestStatus: HTTP listeners cannot be deleted" in str(e)) self.assertTrue(exception_occurred)
def setUpClass(cls): super(QdstatSslNoExternalTest, cls).setUpClass() # Write SASL configuration file: with open('tests-mech-NOEXTERNAL.conf', 'w') as sasl_conf: sasl_conf.write("mech_list: ANONYMOUS DIGEST-MD5 PLAIN\n") # qdrouterd configuration: config = Qdrouterd.Config([ ('router', {'id': 'QDR.C', 'saslConfigPath': os.getcwd(), 'workerThreads': 1, 'saslConfigName': 'tests-mech-NOEXTERNAL'}), ('sslProfile', {'name': 'server-ssl', 'caCertFile': cls.ssl_file('ca-certificate.pem'), 'certFile': cls.ssl_file('server-certificate.pem'), 'privateKeyFile': cls.ssl_file('server-private-key.pem'), 'password': '******'}), ('listener', {'port': cls.tester.get_port()}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'no'}), ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'yes', 'requireSsl': 'yes', 'saslMechanisms': 'EXTERNAL'}) ]) cls.router = cls.tester.qdrouterd('test-router', config)
def router(name, connection): config = [ ('router', {'mode': 'interior', 'id': name}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'multiTenant': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'role': 'route-container'}), ('linkRoute', {'prefix': '0.0.0.0/link', 'direction': 'in', 'containerId': 'LRC'}), ('linkRoute', {'prefix': '0.0.0.0/link', 'direction': 'out', 'containerId': 'LRC'}), ('autoLink', {'address': '0.0.0.0/queue.waypoint', 'containerId': 'ALC', 'direction': 'in'}), ('autoLink', {'address': '0.0.0.0/queue.waypoint', 'containerId': 'ALC', 'direction': 'out'}), ('autoLink', {'address': '0.0.0.0/queue.ext', 'containerId': 'ALCE', 'direction': 'in', 'externalAddress': 'EXT'}), ('autoLink', {'address': '0.0.0.0/queue.ext', 'containerId': 'ALCE', 'direction': 'out', 'externalAddress': 'EXT'}), ('address', {'prefix': 'closest', 'distribution': 'closest'}), ('address', {'prefix': 'spread', 'distribution': 'balanced'}), ('address', {'prefix': 'multicast', 'distribution': 'multicast'}), ('address', {'prefix': '0.0.0.0/queue', 'waypoint': 'yes'}), connection ] config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def setUpClass(cls): super(Http2TestOneInteriorRouter, cls).setUpClass() if skip_test(): return cls.http2_server_name = "http2_server" os.environ["QUART_APP"] = "http2server:app" os.environ['SERVER_LISTEN_PORT'] = str(cls.tester.get_port()) cls.http2_server = cls.tester.http2server( name=cls.http2_server_name, listen_port=int(os.getenv('SERVER_LISTEN_PORT')), py_string='python3', server_file="http2_server.py") name = "http2-test-router" cls.connector_name = 'connectorToBeDeleted' cls.connector_props = { 'port': os.getenv('SERVER_LISTEN_PORT'), 'address': 'examples', 'host': '127.0.0.1', 'protocolVersion': 'HTTP2', 'name': cls.connector_name } config = Qdrouterd.Config([('router', { 'mode': 'interior', 'id': 'QDR' }), ('listener', { 'port': cls.tester.get_port(), 'role': 'normal', 'host': '0.0.0.0' }), ('httpListener', { 'port': cls.tester.get_port(), 'address': 'examples', 'host': '127.0.0.1', 'protocolVersion': 'HTTP2' }), ('httpConnector', cls.connector_props)]) cls.router_qdra = cls.tester.qdrouterd(name, config, wait=True)
def router(name, client_server, connection): config = [ ('router', {'mode': 'interior', 'id': 'QDR.%s'%name, 'allowUnsettledMulticast': 'yes'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}), # The following listeners were exclusively added to test the stripAnnotations attribute in qdrouterd.conf file # Different listeners will be used to test all allowed values of stripAnnotations ('no', 'both', 'out', 'in') ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'both'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'out'}), ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'in'}), ('address', {'prefix': 'closest', 'distribution': 'closest'}), ('address', {'prefix': 'spread', 'distribution': 'balanced'}), ('address', {'prefix': 'multicast', 'distribution': 'multicast'}), # for testing pattern matching ('address', {'pattern': 'a.b.c.d', 'distribution': 'closest'}), ('address', {'pattern': '#.b.c.d', 'distribution': 'multicast'}), ('address', {'pattern': 'a/*/#/d', 'distribution': 'closest'}), ('address', {'pattern': '*/b/c/d', 'distribution': 'multicast'}), ('address', {'pattern': 'a.x.d', 'distribution': 'closest'}), ('address', {'pattern': 'a.*.d', 'distribution': 'multicast'}), connection ] config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
def setUpClass(cls): super(TcpAdaptorManagementTest, cls).setUpClass() if DISABLE_SELECTOR_TESTS: return cls.tcp_server_port = cls.tester.get_port() cls.tcp_listener_port = cls.tester.get_port() cls.test_name = 'TCPMgmtTest' # Here we have a simple barebones standalone router config. config = [ ('router', { 'mode': 'standalone', 'id': cls.test_name }), ('listener', { 'role': 'normal', 'port': cls.tester.get_port() }), ] config = Qdrouterd.Config(config) cls.router = cls.tester.qdrouterd(cls.test_name, config, wait=True) # Start the echo server. This is the server that the tcpConnector # will be connecting to. server_prefix = "ECHO_SERVER ES_%s" % cls.test_name cls.logger = Logger( title="TcpAdaptor", print_to_console=True, save_for_dump=False, ofilename="../setUpClass/TcpAdaptor_echo_server.log") cls.echo_server = TcpEchoServer(prefix=server_prefix, port=cls.tcp_server_port, logger=cls.logger) # The router and the echo server are running at this point. assert cls.echo_server.is_running
def setUpClass(cls): super(QdstatSslTest, cls).setUpClass() # Write SASL configuration file: with open('tests-mech-EXTERNAL.conf', 'w') as sasl_conf: sasl_conf.write("mech_list: EXTERNAL ANONYMOUS DIGEST-MD5 PLAIN\n") # qdrouterd configuration. Note well: modifying the order of # listeners will require updating ssl_test() cls.strict_port = cls.tester.get_port() config = Qdrouterd.Config([ ('router', {'id': 'QDR.B', 'saslConfigPath': os.getcwd(), 'workerThreads': 1, 'saslConfigName': 'tests-mech-EXTERNAL'}), ('sslProfile', {'name': 'server-ssl', 'caCertFile': cls.ssl_file('ca-certificate.pem'), 'certFile': cls.ssl_file('server-certificate.pem'), 'privateKeyFile': cls.ssl_file('server-private-key.pem'), 'password': '******'}), # 'none', 'none_s': ('listener', {'host': 'localhost', 'port': cls.tester.get_port()}), # 'strict', 'strict_s': ('listener', {'host': 'localhost', 'port': cls.strict_port, 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'yes'}), # 'unsecured', 'unsecured_s': ('listener', {'host': 'localhost', 'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'no'}), # 'auth', 'auth_s': ('listener', {'host': 'localhost', 'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'yes', 'requireSsl': 'yes', 'saslMechanisms': 'EXTERNAL'}) ]) cls.router = cls.tester.qdrouterd('test-router', config)
def router(name, connection): config = [('router', { 'mode': 'interior', 'id': name }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no' }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'multiTenant': 'yes' }), ('listener', { 'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'role': 'route-container' }), connection] config = Qdrouterd.Config(config) cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))