Exemplo n.º 1
0
class ScenariosTestCase(unittest.TestCase):
    def setUp(self):
        self.__scenarios_dir = '/tmp/scenarios'
        if os.path.exists(self.__scenarios_dir):
            shutil.rmtree(self.__scenarios_dir)
        os.makedirs(self.__scenarios_dir)
        test_helper.setupScenario(
            test_helper.SCENARIO1,
            self.__scenarios_dir + '/' + test_helper.SCENARIO1,
            test_helper.SENARIO_SPEC_1)
        test_helper.setupScenario(
            test_helper.SCENARIO2,
            self.__scenarios_dir + '/' + test_helper.SCENARIO2,
            test_helper.SENARIO_SPEC_1)
        self.scenarios = Scenarios(scenario_directory=self.__scenarios_dir)

    def tearDown(self):
        shutil.rmtree(self.__scenarios_dir)

    def test_can_get_scenario_list(self):
        list = self.scenarios.getScenarios()
        self.assertEqual([test_helper.SCENARIO1, test_helper.SCENARIO2],
                         sorted(list))

    def test_can_get_scenario(self):
        scenario = self.scenarios.getScenario(test_helper.SCENARIO1)
        self.assertEqual(test_helper.SCENARIO1, scenario.getName())
Exemplo n.º 2
0
 def setUp(self):
     self.__scenarios_dir = '/tmp/scenarios'
     if os.path.exists(self.__scenarios_dir):
         shutil.rmtree(self.__scenarios_dir)
     os.makedirs(self.__scenarios_dir)
     test_helper.setupScenario(
         test_helper.SCENARIO1,
         self.__scenarios_dir + '/' + test_helper.SCENARIO1,
         test_helper.SENARIO_SPEC_1)
     test_helper.setupScenario(
         test_helper.SCENARIO2,
         self.__scenarios_dir + '/' + test_helper.SCENARIO2,
         test_helper.SENARIO_SPEC_1)
     self.scenarios = Scenarios(scenario_directory=self.__scenarios_dir)
Exemplo n.º 3
0
 def setUp(self):
     self.__scenarios_dir = '/tmp/scenarios'
     if os.path.exists(self.__scenarios_dir):
         shutil.rmtree(self.__scenarios_dir)
     os.makedirs(self.__scenarios_dir)
     test_helper.setupScenario(test_helper.SCENARIO1, self.__scenarios_dir+'/'+test_helper.SCENARIO1, test_helper.SENARIO_SPEC_1)
     test_helper.setupScenario(test_helper.SCENARIO2, self.__scenarios_dir+'/'+test_helper.SCENARIO2, test_helper.SENARIO_SPEC_1)
     self.scenarios = Scenarios(scenario_directory=self.__scenarios_dir)
Exemplo n.º 4
0
class ScenariosTestCase(unittest.TestCase):
    def setUp(self):
        self.__scenarios_dir = '/tmp/scenarios'
        if os.path.exists(self.__scenarios_dir):
            shutil.rmtree(self.__scenarios_dir)
        os.makedirs(self.__scenarios_dir)
        test_helper.setupScenario(test_helper.SCENARIO1, self.__scenarios_dir+'/'+test_helper.SCENARIO1, test_helper.SENARIO_SPEC_1)
        test_helper.setupScenario(test_helper.SCENARIO2, self.__scenarios_dir+'/'+test_helper.SCENARIO2, test_helper.SENARIO_SPEC_1)
        self.scenarios = Scenarios(scenario_directory=self.__scenarios_dir)

    def tearDown(self):
        shutil.rmtree(self.__scenarios_dir)

    def test_can_get_scenario_list(self):
        list = self.scenarios.getScenarios()
        self.assertEqual([test_helper.SCENARIO1, test_helper.SCENARIO2],sorted(list))

    def test_can_get_scenario(self):
        scenario = self.scenarios.getScenario(test_helper.SCENARIO1)
        self.assertEqual(test_helper.SCENARIO1, scenario.getName())
Exemplo n.º 5
0
def start():
    global s, server, output, bind_point, _scenario, _eps, _eps_wave, port
    s = Scenarios(ROOTDIR + '/scenarios/', eps=_eps, eps_wave=_eps_wave, output=output, port=port)
    if output == "syslog":
        s.setProcessor(processor_syslog)
    elif output == "zeromq":
        zeromq.init_sockets(bind_point)
        s.setProcessor(zeromq.send)
    elif output == "es":
        s.setProcessor(processor_es)
    else:
        s.setProcessor(processor_stdout)

    s.start(_scenario)

    while 1:
        time.sleep(1)
Exemplo n.º 6
0
def start():
    global s, server, output, bind_point, _scenario, _eps, _eps_wave
    s = Scenarios(ROOTDIR + '/scenarios/', eps=_eps, eps_wave=_eps_wave, output=output)
    if output == "syslog":
        s.setProcessor(processor_syslog)
    elif output == "zeromq":
        zeromq.init_sockets(bind_point)
        s.setProcessor(zeromq.send)
    elif output == "es":
        s.setProcessor(processor_es)
    else:
        s.setProcessor(processor_stdout)

    s.start(_scenario)

    while 1:
        time.sleep(1)