예제 #1
0
    def test_setup_messaging_handler(self, m_target_cls, m_get_rpc_server):
        m_target = mock.Mock()
        m_target_cls.return_value = m_target
        handler = messaging_handler.MessagingHandler(
            publisher_id=self.PUBLISHER_ID,
            topic_name=self.TOPIC_WATCHER,
            endpoints=[self.ENDPOINT],
            version=self.VERSION,
            serializer=None,
        )

        handler.run()

        m_target_cls.assert_called_once_with(
            server="fake-fqdn",
            topic="TEST_TOPIC_WATCHER",
            version="1.0",
        )
        m_get_rpc_server.assert_called_once_with(
            handler.transport,
            m_target,
            [self.ENDPOINT],
            executor='eventlet',
            serializer=None,
        )
예제 #2
0
    def test_messaging_handler_remove_endpoint(self):
        handler = messaging_handler.MessagingHandler(
            publisher_id=self.PUBLISHER_ID,
            topic_name=self.TOPIC_WATCHER,
            endpoint=self.ENDPOINT,
            version=self.VERSION,
            serializer=None,
        )

        self.assertEqual(handler.endpoints, [self.ENDPOINT])

        handler.remove_endpoint(self.ENDPOINT)

        self.assertEqual(handler.endpoints, [])
예제 #3
0
 def build_topic_handler(self, topic_name):
     return messaging_handler.MessagingHandler(
         self.publisher_id, topic_name, self,
         self.api_version, self.serializer)
예제 #4
0
파일: service.py 프로젝트: akinsWin/watcher
 def build_topic_handler(self, topic_name, endpoints=()):
     return messaging_handler.MessagingHandler(
         self.publisher_id, topic_name, [self.manager] + list(endpoints),
         self.api_version, self.serializer)