diff --git a/barbican/queue/__init__.py b/barbican/queue/__init__.py index 51f81caf2..e23388409 100644 --- a/barbican/queue/__init__.py +++ b/barbican/queue/__init__.py @@ -18,7 +18,7 @@ Queue objects for Barbican """ import oslo_messaging as messaging from oslo_messaging.notify import dispatcher as notify_dispatcher -from oslo_messaging import server as msg_server +from oslo_messaging.notify import listener from barbican.common import config from barbican.common import exception @@ -107,9 +107,9 @@ def get_notification_server(targets, endpoints, serializer=None): allow_requeue = getattr(getattr(CONF, KS_NOTIFICATIONS_GRP_NAME), 'allow_requeue') TRANSPORT._require_driver_features(requeue=allow_requeue) - dispatcher = notify_dispatcher.NotificationDispatcher(targets, endpoints, - serializer, - allow_requeue) + dispatcher = notify_dispatcher.NotificationDispatcher(endpoints, + serializer) # we don't want blocking executor so use eventlet as executor choice - return msg_server.MessageHandlingServer(TRANSPORT, dispatcher, - executor='eventlet') + return listener.NotificationServer(TRANSPORT, targets, dispatcher, + executor='eventlet', + allow_requeue=allow_requeue) diff --git a/barbican/tests/queue/test_keystone_listener.py b/barbican/tests/queue/test_keystone_listener.py index 1e594a100..0e8b89146 100644 --- a/barbican/tests/queue/test_keystone_listener.py +++ b/barbican/tests/queue/test_keystone_listener.py @@ -266,7 +266,8 @@ class WhenUsingMessageServer(UtilMixin, utils.BaseTestCase): super(WhenUsingMessageServer, self).setUp() queue.init(self.conf) - patcher = mock.patch('oslo_messaging.server.MessageHandlingServer') + patcher = mock.patch('oslo_messaging.notify.listener.' + 'NotificationServer') mock_server_class = patcher.start() self.addCleanup(patcher.stop) @@ -316,7 +317,7 @@ class WhenUsingMessageServer(UtilMixin, utils.BaseTestCase): msg_server.start() self.msg_server_mock.start.assert_called_with() - @mock.patch.object(service.Service, 'stop') + @mock.patch.object(service.Service, 'stop', autospec=True) def test_should_stop(self, mock_service_stop): msg_server = keystone_listener.MessageServer(self.conf) msg_server.stop()