def test_module_acknowledge_default(): # Standard situation. Event passes through as it's # the first time is is acknowledged. actor_config = ActorConfig('acknowledge', 100, 1, {}, "") acknowledge = Acknowledge(actor_config) acknowledge.pool.queue.inbox.disableFallThrough() acknowledge.pool.queue.outbox.disableFallThrough() acknowledge.pool.queue.acknowledge.disableFallThrough() acknowledge.pool.queue.dropped.disableFallThrough() acknowledge.start() event_one = Event("one") acknowledge.pool.queue.inbox.put(event_one) assert getter(acknowledge.pool.queue.outbox).get() == "one" acknowledge.stop()
def test_module_acknowledge_dropped(): # An event tries to pass through with an unacknowledged ack_id and # therefor should be dropped. actor_config = ActorConfig('acknowledge', 100, 1, {}, "") acknowledge = Acknowledge(actor_config) acknowledge.pool.queue.inbox.disableFallThrough() acknowledge.pool.queue.outbox.disableFallThrough() acknowledge.pool.queue.acknowledge.disableFallThrough() acknowledge.pool.queue.dropped.disableFallThrough() acknowledge.start() acknowledge.pool.queue.inbox.put(Event("one")) acknowledge.pool.queue.inbox.put(Event("one")) assert getter(acknowledge.pool.queue.dropped).get() == "one" acknowledge.stop()
def test_module_acknowledge_acknowledge(): # An unacknowledged ack_id gets acknowledged and therefor lets then next # event with the same ack_id through. actor_config = ActorConfig('acknowledge', 100, 1, {}, "") acknowledge = Acknowledge(actor_config) acknowledge.pool.queue.inbox.disableFallThrough() acknowledge.pool.queue.outbox.disableFallThrough() acknowledge.pool.queue.acknowledge.disableFallThrough() acknowledge.pool.queue.dropped.disableFallThrough() acknowledge.start() event_one = Event("one") acknowledge.pool.queue.inbox.put(event_one) assert getter(acknowledge.pool.queue.outbox).get() == "one" acknowledge.pool.queue.acknowledge.put(event_one) acknowledge.pool.queue.inbox.put(event_one) assert getter(acknowledge.pool.queue.outbox).get() == "one" acknowledge.stop()