00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import sys
00019 sys.path.insert(1,"../")
00020
00021 import unittest
00022
00023 import OpenRTM_aist
00024
00025 from ManagerConfig import *
00026
00027 configsample_spec = ["implementation_id", "ConfigSample",
00028 "type_name", "ConfigSample",
00029 "description", "Configuration example component",
00030 "version", "1.0",
00031 "vendor", "Shinji Kurihara, AIST",
00032 "category", "example",
00033 "activity_type", "DataFlowComponent",
00034 "max_instance", "10",
00035 "language", "C++",
00036 "lang_type", "compile",
00037
00038 "conf.default.int_param0", "0",
00039 "conf.default.int_param1", "1",
00040 "conf.default.double_param0", "0.11",
00041 "conf.default.double_param1", "9.9",
00042 "conf.default.str_param0", "hoge",
00043 "conf.default.str_param1", "dara",
00044 "conf.default.vector_param0", "0.0,1.0,2.0,3.0,4.0",
00045 ""]
00046
00047 class TestManagerConfig(unittest.TestCase) :
00048
00049 def setUp(self):
00050 argv = (sys.argv[0], "-f", "./rtc.conf")
00051 self.mgrConf = ManagerConfig(argv)
00052
00053
00054 def tearDown(self):
00055 OpenRTM_aist.Manager.instance().shutdownManager()
00056 return
00057
00058 def test_configure(self):
00059 prop = OpenRTM_aist.Properties(defaults_str=configsample_spec)
00060 self.mgrConf.configure(prop)
00061 self.assertEqual(prop.getProperty("type_name"),"ConfigSample","Result failed.")
00062
00063
00064 def test_parseArgs(self):
00065 argv = (sys.argv[0], "-f", "./rtc.conf")
00066 self.mgrConf.parseArgs(argv)
00067
00068
00069
00070
00071
00072
00073 def test_findConfigFile(self):
00074 self.assertEqual(self.mgrConf.findConfigFile(),True,"Result failed.")
00075
00076
00077 def test_setSystemInformation(self):
00078 prop = OpenRTM_aist.Properties(defaults_str=configsample_spec)
00079
00080
00081
00082 prop = self.mgrConf.setSystemInformation(prop)
00083 self.assertEqual(prop.getProperty("manager.os.name"),"Linux","Result failed.")
00084
00085
00086
00087 def test_fileExist(self):
00088 self.assertEqual(self.mgrConf.fileExist("rtc.conf"),True,"Result failed.")
00089 self.assertEqual(self.mgrConf.fileExist("./rtc.conf"),True,"Result failed.")
00090
00091
00092
00093
00094
00095
00096 if __name__ == '__main__':
00097 unittest.main()
00098
00099