コード例 #1
0
    def test_message_received(self):
        store = {}

        dispatcher = TestDispatcher()
        consumer = Consumer(MemoryCache(store), dispatcher, 1)  # Don't need to start 5 non-processes...
        consumer.start()

        key, value = "mSg", "MsG"  #TODO: Our operation is a swapcase : l
        dispatcher.simulate(TestMessage(key))
        self.assertEqual(value, store.get(key))
コード例 #2
0
    def test_message_received(self):
        store = {}

        dispatcher = TestDispatcher()
        consumer = Consumer(MemoryCache(store), dispatcher,
                            1)  # Don't need to start 5 non-processes...
        consumer.start()

        key, value = "mSg", "MsG"  #TODO: Our operation is a swapcase : l
        dispatcher.simulate(TestMessage(key))
        self.assertEqual(value, store.get(key))
コード例 #3
0
ファイル: cli.py プロジェクト: krallin/tutorial-workertier
def start_consumer(cache, dispatcher, config):
    from workertier.consumer import Consumer

    consumer = Consumer(cache, dispatcher)
    consumer.start()
コード例 #4
0
 def test_launch(self):
     n_consumers = 8
     dispatcher = TestDispatcher()
     consumer = Consumer(None, dispatcher, n_consumers)
     consumer.start()
     self.assertEqual(n_consumers, dispatcher.started)
コード例 #5
0
ファイル: cli.py プロジェクト: krallin/tutorial-workertier
def start_consumer(cache, dispatcher, config):
    from workertier.consumer import Consumer

    consumer = Consumer(cache, dispatcher)
    consumer.start()
コード例 #6
0
 def test_launch(self):
     n_consumers = 8
     dispatcher = TestDispatcher()
     consumer = Consumer(None, dispatcher, n_consumers)
     consumer.start()
     self.assertEqual(n_consumers, dispatcher.started)