Refactored DE and Applier to use oslo.service

In this PS, I have refactored the Decision Engine and the Applier
to use the oslo service utility.

Change-Id: If29158cc9b5e5e50f6c69d67c232cceeb07084f2
Closes-Bug: #1541850
This commit is contained in:
Vincent Françoise
2016-03-18 10:22:46 +01:00
parent a9e7251d0d
commit eb861f86ab
16 changed files with 286 additions and 286 deletions

View File

@@ -18,22 +18,22 @@
#
from mock import patch
from threading import Thread
from watcher.applier.manager import ApplierManager
from watcher.common.messaging.messaging_core import MessagingCore
from watcher.applier import manager as applier_manager
from watcher.common.messaging import messaging_handler
from watcher.common import service
from watcher.tests import base
class TestApplierManager(base.TestCase):
def setUp(self):
super(TestApplierManager, self).setUp()
self.applier = ApplierManager()
self.applier = service.Service(applier_manager.ApplierManager)
@patch.object(MessagingCore, "connect")
@patch.object(Thread, "join")
def test_connect(self, m_messaging, m_thread):
self.applier.connect()
self.applier.join()
self.assertEqual(2, m_messaging.call_count)
self.assertEqual(1, m_thread.call_count)
@patch.object(messaging_handler.MessagingHandler, "stop")
@patch.object(messaging_handler.MessagingHandler, "start")
def test_start(self, m_messaging_start, m_messaging_stop):
self.applier.start()
self.applier.stop()
self.assertEqual(2, m_messaging_start.call_count)
self.assertEqual(2, m_messaging_stop.call_count)