Пример #1
0
    def test_get_stats(self):
        ep = ListeningBaseEndpoint(node=self.container.node)
        gl = spawn(ep.listen, binding="test_get_stats")

        ep.get_ready_event().wait(timeout=5)

        gs_res = ep.get_stats()
        self.assertEquals(gs_res, (0, 1)) # num of messages, num listeners

        ep.close()
        gl.join(timeout=5)
Пример #2
0
    def test_get_stats(self):
        ep = ListeningBaseEndpoint(node=self.container.node)
        gl = spawn(ep.listen, binding="test_get_stats")

        ep.get_ready_event().wait(timeout=5)

        gs_res = ep.get_stats()
        self.assertEquals(gs_res, (0, 1))  # num of messages, num listeners

        ep.close()
        gl.join(timeout=5)
Пример #3
0
    def test_get_stats_multiple_on_named_queue(self):
        ep1 = ListeningBaseEndpoint(node=self.container.node, from_name="test_get_stats_multi")
        gl1 = spawn(ep1.listen)

        ep2 = ListeningBaseEndpoint(node=self.container.node, from_name="test_get_stats_multi")
        gl2 = spawn(ep2.listen)

        ep1.get_ready_event().wait(timeout=5)
        ep2.get_ready_event().wait(timeout=5)

        gs_res1 = ep1.get_stats()
        self.assertEquals(gs_res1, (0, 2)) # num of messages, num listeners

        gs_res2 = ep2.get_stats()
        self.assertEquals(gs_res2, (0, 2)) # num of messages, num listeners

        ep1.close()
        ep2.close()
        gl1.join(timeout=5)
        gl2.join(timeout=5)
Пример #4
0
    def test_get_stats_multiple_on_named_queue(self):
        ep1 = ListeningBaseEndpoint(node=self.container.node,
                                    from_name="test_get_stats_multi")
        gl1 = spawn(ep1.listen)

        ep2 = ListeningBaseEndpoint(node=self.container.node,
                                    from_name="test_get_stats_multi")
        gl2 = spawn(ep2.listen)

        ep1.get_ready_event().wait(timeout=5)
        ep2.get_ready_event().wait(timeout=5)

        gs_res1 = ep1.get_stats()
        self.assertEquals(gs_res1, (0, 2))  # num of messages, num listeners

        gs_res2 = ep2.get_stats()
        self.assertEquals(gs_res2, (0, 2))  # num of messages, num listeners

        ep1.close()
        ep2.close()
        gl1.join(timeout=5)
        gl2.join(timeout=5)
Пример #5
0
    def test_close(self):
        ep = ListeningBaseEndpoint(node=Mock(soec=NodeB))
        ep._chan = Mock()
        ep.close()

        ep._chan.close.assert_called_once_with()
Пример #6
0
    def test_close(self):
        ep = ListeningBaseEndpoint(node=Mock(soec=NodeB))
        ep._chan = Mock()
        ep.close()

        ep._chan.close.assert_called_once_with()