# Path: oshino/core/processor.py
# class AugmentFixture(object):
# 
#     def apply_augment(self, data):
#         if "service" not in data or hasattr(self, "stopped"):
#             return
# 
#         key = data["service"]
#         if key not in self.augments:
#             return
# 
#         subscribers = self.augments[key]
#         for sub in subscribers:
#             sub.put_nowait(data)
# 
#     def on_stop(self):
#         if hasattr(self, "stopped"):
#             return
# 
#         logger.info("Stopping all augments")
# 
#         self.stopped = True
#         for _, subscribers in self.augments.items():
#             for sub in subscribers:
#                 sub.put_nowait(StopEvent())
# 
#         for _, subscribers in self.augments.items():
#             for sub in subscribers:
#                 while not sub.empty():
#                     sleep(0.1)


from copy import copy
from riemann_client.transport import BlankTransport, RiemannError
from oshino.core.processor import AugmentFixture
        self.events.append(kwargs)

    def clear_queue(self):
        self.events = []

    def flush(self, transport):
        response = transport.send(self.events)
        self.clear_queue()
        return response


class MockTransport(BlankTransport):

    def __init__(self, host=None, port=None, broken=False):
        self.connected = False
        self.broken = broken
        self.sneaky = False

    def connect(self):
        if self.broken:
            raise ConnectionRefusedError
        self.connected = True

    def disconnect(self):
        self.connected = False

    def send(self, message):
        if self.broken or self.sneaky:
            raise RiemannError


# Path: oshino/core/processor.py
# class AugmentFixture(object):
# 
#     def apply_augment(self, data):
#         if "service" not in data or hasattr(self, "stopped"):
#             return
# 
#         key = data["service"]
#         if key not in self.augments:
#             return
# 
#         subscribers = self.augments[key]
#         for sub in subscribers:
#             sub.put_nowait(data)
# 
#     def on_stop(self):
#         if hasattr(self, "stopped"):
#             return
# 
#         logger.info("Stopping all augments")
# 
#         self.stopped = True
#         for _, subscribers in self.augments.items():
#             for sub in subscribers:
#                 sub.put_nowait(StopEvent())
# 
#         for _, subscribers in self.augments.items():
#             for sub in subscribers:
#                 while not sub.empty():
#                     sleep(0.1)


# Path: tests/mocks.py
from copy import copy
from riemann_client.transport import BlankTransport, RiemannError
from oshino.core.processor import AugmentFixture

        self.events.append(kwargs)

    def clear_queue(self):
        self.events = []

    def flush(self, transport):
        response = transport.send(self.events)
        self.clear_queue()
        return response


class MockTransport(BlankTransport):

    def __init__(self, host=None, port=None, broken=False):
        self.connected = False
        self.broken = broken
        self.sneaky = False

    def connect(self):
        if self.broken:
            raise ConnectionRefusedError
        self.connected = True

    def disconnect(self):
        self.connected = False

    def send(self, message):
        if self.broken or self.sneaky:
            raise RiemannError


        return True