def test_run(self):
     moduleFactory = ModuleFactory('TestModule', 
                                   self.path_to_default_test_config_file,
                                   self.path_to_test_modules,
                                   self.path_to_test_modules_py)
     self.assertIsInstance(moduleFactory.get_module_instance(), Test)
     self.assertIsInstance(moduleFactory.get_module_configuration(), Configuration)
 def test_run(self):
     moduleFactory = ModuleFactory('TestModule',
                                   self.path_to_default_test_config_file,
                                   self.path_to_test_modules,
                                   self.path_to_test_modules_py)
     self.assertIsInstance(moduleFactory.get_module_instance(), Test)
     self.assertIsInstance(moduleFactory.get_module_configuration(),
                           Configuration)
 def test_run(self):
     moduleFactory = ModuleFactory('TestModule', 
                                   self.path_to_default_test_config_file,
                                   self.path_to_test_modules,
                                   self.path_to_test_modules_py)
     module = moduleFactory.get_module_instance()
     data_store = DataStore()
     data_store.put('nEvent', 2)
     run_engine = RunEngineFactory([moduleFactory], data_store).get_run_engine()
     self.assertIsInstance(run_engine, RunEngine)
     run_engine.run()
     self.assertEqual(module.beginCalled, 1)
     self.assertEqual(module.eventCalled, 2)
     self.assertEqual(module.endCalled, 1)
 def test_run(self):
     moduleFactory = ModuleFactory('TestModule',
                                   self.path_to_default_test_config_file,
                                   self.path_to_test_modules,
                                   self.path_to_test_modules_py)
     module = moduleFactory.get_module_instance()
     data_store = DataStore()
     data_store.put('nEvent', 2)
     run_engine = RunEngineFactory([moduleFactory],
                                   data_store).get_run_engine()
     self.assertIsInstance(run_engine, RunEngine)
     run_engine.run()
     self.assertEqual(module.beginCalled, 1)
     self.assertEqual(module.eventCalled, 2)
     self.assertEqual(module.endCalled, 1)
def parse_module_sequence(p_value):
    """
    Parses the module sequence in the configuration file.
    
    :return: a list of ModuleFactory objects.
    """
    result = []
    lines = p_value.split('\n')
    for line in lines:
        line.strip()
        if len(line) == 0:
            continue
        moduleConfiguration_str = line.split(' ')
        #remove empty entries
        moduleConfiguration_str = list(filter(bool, moduleConfiguration_str))
        moduleName = moduleConfiguration_str[0]
        modulePathConfigurationFile = None
        if len(moduleConfiguration_str) > 1:
            modulePathConfigurationFile = moduleConfiguration_str[1]
        result.append(ModuleFactory(moduleName, modulePathConfigurationFile))
    return result