示例#1
0
    def test_setup_after_cancel(self):
        setup = BoboSetup()

        setup.add_complex_event(event_def=BoboComplexEvent(
            name=NAME_NFA_A, pattern=stub_pattern_1, action=NoAction()))

        setup.config_null_data(delay_sec=NULL_DATA_DELAY,
                               null_data=BoboNullDataStatic(DATA_DICT_A))

        setup.configure()
        setup.start()
        sleep(SLEEP_WAIT)
        setup.cancel()

        self.assertFalse(setup.is_ready())
        self.assertFalse(setup.is_active())
        self.assertFalse(setup.is_inactive())
        self.assertTrue(setup.is_cancelled())
        self.assertTrue(setup.is_configured())

        self.assertFalse(setup.get_receiver().is_active())
        self.assertFalse(setup.get_decider().is_active())
        self.assertFalse(setup.get_producer().is_active())
        self.assertFalse(setup.get_forwarder().is_active())
        self.assertFalse(setup.get_null_data_generator().is_active())
示例#2
0
    def test_start_when_active(self):
        setup = BoboSetup()

        setup.add_complex_event(event_def=BoboComplexEvent(
            name=NAME_NFA_A, pattern=stub_pattern_1, action=NoAction()))

        setup.start()
        sleep(SLEEP_WAIT)

        with self.assertRaises(RuntimeError):
            setup.start()

        setup.cancel()