# Path: apiary/base.py
# class BeeKeeper(object):
# class StatsGatherer(ChildProcess):
# class QueenBee(ChildProcess):
# class WorkerBee(Thread):
# class WorkerBeeProcess(ChildProcess):
# class Message (object):
#     def __init__(self, options, arguments):
#     def start(self):
#     def __init__(self, options, stats_queue):
#     def worker_status(self, message):
#     def report(self):
#     def run_child_process(self):
#     def __init__(self, options, arguments, job_queue, stats_queue):
#     def run_child_process(self):
#     def __init__(self, options, job_queue, stats_queue):
#     def status(self, status, body=None):
#     def error(self, message):
#     def tally(self, name):
#     def level(self, name, increment):
#     def series(self, name, value):
#     def process_message(self, message):
#     def start_job(self, job_id):
#     def send_request(self, request):
#     def finish_request(self, request):
#     def finish_job(self, job_id):
#     def run(self):
#     def __init__(self, options, protocol, job_queue, stats_queue):
#     def run_child_process(self):
#     def __init__(self, type, body=None):
#     def __str__(self):
#     def __repr__(self):
# def add_options(parser):
#     EXCHANGE = 'b.direct'
#     STOP = 3
#     JOB = 8
#     STAT_TALLY = 9
#     STAT_LEVEL = 10
#     STAT_SERIES = 11


import sys
import time
import threading
import unittest
import apiary
import amqplib.client_0_8 as amqp
from apiary.base import Messages
        c.addsleep()
        c.addend('aaa')
        c.addend('xxx')
        
        self.start_workers(SimpleWorkerBee, 2)
        
        c.main()
        r = ','.join(c.results)
        self.assert_('(1234.5	a1234.6	b1234.7	c)' in r)
        self.assert_('(4321.0	x4321.1	y4321.2	z)' in r)
        
        self.join_workers()


class TestErrors(apiaryTestCase):
    def do_nothing(self):
        pass

    def testConnectionError(self):
        self.options.amqp_host = "localhost:1"
        self._transport = apiary.Transport(self.options)
        self.assertRaises(apiary.ConnectionError, self.connect)
 
    def testExclusiveQueueUse(self):
        self._transport = apiary.Transport(self.options)
        self._transport.connect()
        self._transport.usequeue('minder-end')
        self._transport.consume('minder-end', 'm0', self.do_nothing)
        self._transport2 = apiary.Transport(self.options)
        self._transport2.connect()

# Path: apiary/base.py
# class BeeKeeper(object):
# class StatsGatherer(ChildProcess):
# class QueenBee(ChildProcess):
# class WorkerBee(Thread):
# class WorkerBeeProcess(ChildProcess):
# class Message (object):
#     def __init__(self, options, arguments):
#     def start(self):
#     def __init__(self, options, stats_queue):
#     def worker_status(self, message):
#     def report(self):
#     def run_child_process(self):
#     def __init__(self, options, arguments, job_queue, stats_queue):
#     def run_child_process(self):
#     def __init__(self, options, job_queue, stats_queue):
#     def status(self, status, body=None):
#     def error(self, message):
#     def tally(self, name):
#     def level(self, name, increment):
#     def series(self, name, value):
#     def process_message(self, message):
#     def start_job(self, job_id):
#     def send_request(self, request):
#     def finish_request(self, request):
#     def finish_job(self, job_id):
#     def run(self):
#     def __init__(self, options, protocol, job_queue, stats_queue):
#     def run_child_process(self):
#     def __init__(self, type, body=None):
#     def __str__(self):
#     def __repr__(self):
# def add_options(parser):
#     EXCHANGE = 'b.direct'
#     STOP = 3
#     JOB = 8
#     STAT_TALLY = 9
#     STAT_LEVEL = 10
#     STAT_SERIES = 11


# Path: historical/test_apiary/apiarytests.py
import sys
import time
import threading
import unittest
import apiary
import amqplib.client_0_8 as amqp
from apiary.base import Messages

        c.addsleep()
        c.addend('aaa')
        c.addend('xxx')
        
        self.start_workers(SimpleWorkerBee, 2)
        
        c.main()
        r = ','.join(c.results)
        self.assert_('(1234.5	a1234.6	b1234.7	c)' in r)
        self.assert_('(4321.0	x4321.1	y4321.2	z)' in r)
        
        self.join_workers()


class TestErrors(apiaryTestCase):
    def do_nothing(self):
        pass

    def testConnectionError(self):
        self.options.amqp_host = "localhost:1"
        self._transport = apiary.Transport(self.options)
        self.assertRaises(apiary.ConnectionError, self.connect)
 
    def testExclusiveQueueUse(self):
        self._transport = apiary.Transport(self.options)
        self._transport.connect()
        self._transport.usequeue('minder-end')
        self._transport.consume('minder-end', 'm0', self.do_nothing)
        self._transport2 = apiary.Transport(self.options)
        self._transport2.connect()

        self._transport2.usequeue('minder-end')