def test_echo(self, size, use_ssl): data = dummyTextGenerator(size) ssl_ctx = self.ssl_ctx if use_ssl else None with constructAcceptor(self.log, ssl_ctx, _SampleBridge()) as acceptor: with utils.closing( StandAloneRpcClient(acceptor._host, acceptor._port, 'jms.topic.vdsm_requests', str(uuid4()), ssl_ctx, False)) as client: self.assertEqual( client.callMethod('echo', (data, ), str(uuid4())), data)
def test_event(self, use_ssl): with constructAcceptor(self.log, use_ssl, _SampleBridge(), 'jms.queue.events') as acceptor: sslctx = DEAFAULT_SSL_CONTEXT if use_ssl else None with utils.closing( StandAloneRpcClient(acceptor._host, acceptor._port, 'jms.topic.vdsm_requests', 'jms.queue.events', sslctx, False)) as client: event_queue = queue.Queue() custom_topic = 'jms.queue.events' client.subscribe(custom_topic, event_queue) client.callMethod("event", [], str(uuid4())) try: event, event_params = event_queue.get(timeout=CALL_TIMEOUT) except queue.Empty: self.fail("Event queue timed out.") self.assertEqual(event, 'vdsm.event') self.assertEqual(event_params['content'], True)