예제 #1
0
파일: tests.py 프로젝트: NorthIsUp/samsa
    def test_get_topic(self):
        topics = TopicMap(cluster=mock.Mock())
        topic = topics.get('topic-1')
        self.assertIsInstance(topic, Topic)

        # Retrieving the topic again should return the same object instance.
        self.assertIs(topic, topics.get('topic-1'))
예제 #2
0
    def test_get_topic(self):
        topics = TopicMap(cluster=mock.Mock())
        with mock.patch('samsa.partitions.DataWatch'):
            topic = topics.get('topic-1')
        self.assertIsInstance(topic, Topic)

        # Retrieving the topic again should return the same object instance.
        self.assertIs(topic, topics.get('topic-1'))
예제 #3
0
파일: tests.py 프로젝트: keshavmagge/samsa
    def test_get_topic(self):
        topics = TopicMap(cluster=mock.Mock())
        with mock.patch('samsa.partitions.DataWatch'):
            topic = topics.get('topic-1')
        self.assertIsInstance(topic, Topic)

        # Retrieving the topic again should return the same object instance.
        self.assertIs(topic, topics.get('topic-1'))
예제 #4
0
    def __init__(self, zookeeper, handler=None):
        if not zookeeper.connected:
            raise Exception("Zookeeper must be connected before use.")

        self.zookeeper = zookeeper

        if not handler:
            handler = ThreadingHandler()
        self.handler = handler

        self.brokers = BrokerMap(self)
        self.topics = TopicMap(self)