Example #1
0
    def __preroll(self, *arg, **argd):
        Axon.Scheduler.scheduler.run = Axon.Scheduler.scheduler()
        ontest = timestamper(*arg, **argd).activate()

        target = Axon.Component.component().activate()

        ontest.link((ontest, "outbox"), (target, "inbox"))
        ontest.link((ontest, "signal"), (target, "control"))
        execute = Axon.Scheduler.scheduler.run.main()

        return ontest, target, execute
Example #2
0
    def test_shutdown(self):
        """Shuts down in response to a shutdownMicroprocess message"""

        for msg in [producerFinished(self), shutdownMicroprocess(self)]:
            ontest = timestamper().activate()

            for _ in xrange(0, 10):
                ontest.next()
            self.assert_(0 == len(ontest.outboxes["outbox"]))
            self.assert_(0 == len(ontest.outboxes["signal"]))

            ontest._deliver(msg, "control")
            try:
                for _ in xrange(0, 10):
                    ontest.next()
                self.fail()
            except StopIteration:
                pass
            self.assert_(0 == len(ontest.outboxes["outbox"]))
            self.assert_(1 == len(ontest.outboxes["signal"]))
            received = ontest._collect("signal")
            self.assert_(msg == received)