def main(): octavia_service.prepare_service(sys.argv) gmr.TextGuruMeditation.setup_autorun(version) launcher = service.launch(CONF, consumer.Consumer()) launcher.wait()
def test_consumer_graceful_stop(self, mock_rpc_server, mock_endpoint, mock_target, mock_get_transport): mock_rpc_server_rv = mock.Mock() mock_rpc_server.return_value = mock_rpc_server_rv cons = consumer.Consumer() cons.start() cons.stop(graceful=True) mock_rpc_server_rv.stop.assert_called_once_with() mock_rpc_server_rv.wait.assert_called_once_with()
def test_config_setup(self, mock_rpc_server, mock_endpoint, mock_target, mock_get_transport): mock_get_transport_rv = mock.Mock() mock_get_transport.return_value = mock_get_transport_rv mock_rpc_server_rv = mock.Mock() mock_rpc_server.return_value = mock_rpc_server_rv mock_endpoint_rv = mock.Mock() mock_endpoint.return_value = mock_endpoint_rv mock_target_rv = mock.Mock() mock_target.return_value = mock_target_rv consumer.Consumer() mock_get_transport.assert_called_once_with(cfg.CONF) mock_target.assert_called_once_with(topic='foo_topic', server='foo_host', fanout=False) mock_endpoint.assert_called_once_with() mock_rpc_server.assert_called_once_with(mock_get_transport_rv, mock_target_rv, [mock_endpoint_rv], executor='eventlet')
def test_consumer_start(self, mock_rpc_server, mock_endpoint, mock_target, mock_get_transport): mock_get_transport_rv = mock.Mock() mock_get_transport.return_value = mock_get_transport_rv mock_rpc_server_rv = mock.Mock() mock_rpc_server.return_value = mock_rpc_server_rv mock_endpoint_rv = mock.Mock() mock_endpoint.return_value = mock_endpoint_rv mock_target_rv = mock.Mock() mock_target.return_value = mock_target_rv consumer.Consumer().start() mock_get_transport.assert_called_once_with(cfg.CONF) mock_target.assert_called_once_with(topic='foo_topic', server='foo_host', fanout=False) mock_endpoint.assert_called_once_with() access_policy = dispatcher.DefaultRPCAccessPolicy mock_rpc_server.assert_called_once_with(mock_get_transport_rv, mock_target_rv, [mock_endpoint_rv], executor='eventlet', access_policy=access_policy)
def main(): service.prepare_service(sys.argv) c = consumer.Consumer() c.listen()