class TestManagerConfig(unittest.TestCase) :
  
  def setUp(self):
    argv = (sys.argv[0], "-f", "./rtc.conf")
    self.mgrConf = ManagerConfig(argv)


  def tearDown(self):
    OpenRTM_aist.Manager.instance().shutdownManager()
    return
  
  def test_configure(self):
    prop = OpenRTM_aist.Properties(defaults_str=configsample_spec)
    self.mgrConf.configure(prop)
    self.assertEqual(prop.getProperty("type_name"),"ConfigSample","Result failed.")

    
  def test_parseArgs(self):
    argv = (sys.argv[0], "-f", "./rtc.conf")
    self.mgrConf.parseArgs(argv)

    # Failed Pattern
    # argv = (sys.argv[0], "-c", "./rtc.conf")
    # self.mgrConf.parseArgs(3,argv)
    

  def test_findConfigFile(self):
    self.assertEqual(self.mgrConf.findConfigFile(),True,"Result failed.")


  def test_setSystemInformation(self):
    prop = OpenRTM_aist.Properties(defaults_str=configsample_spec)
    # Failed Pattern
    # self.assertEqual(prop.getProperty("manager.os.name"),"Linux","Result failed.")

    prop = self.mgrConf.setSystemInformation(prop)
    self.assertEqual(prop.getProperty("manager.os.name"),"Linux","Result failed.")
    #self.assertEqual(prop.getProperty("manager.os.name"),"Windows","Result failed.")


  def test_fileExist(self):
    self.assertEqual(self.mgrConf.fileExist("rtc.conf"),True,"Result failed.")
    self.assertEqual(self.mgrConf.fileExist("./rtc.conf"),True,"Result failed.")
class TestManagerConfig(unittest.TestCase):
    def setUp(self):
        argv = (sys.argv[0], "-f", "./rtc.conf")
        self.mgrConf = ManagerConfig(argv)

    def tearDown(self):
        OpenRTM_aist.Manager.instance().shutdownManager()
        return

    def test_configure(self):
        prop = OpenRTM_aist.Properties(defaults_str=configsample_spec)
        self.mgrConf.configure(prop)
        self.assertEqual(prop.getProperty("type_name"), "ConfigSample",
                         "Result failed.")

    def test_parseArgs(self):
        argv = (sys.argv[0], "-f", "./rtc.conf")
        self.mgrConf.parseArgs(argv)

        # Failed Pattern
        # argv = (sys.argv[0], "-c", "./rtc.conf")
        # self.mgrConf.parseArgs(3,argv)

    def test_findConfigFile(self):
        self.assertEqual(self.mgrConf.findConfigFile(), True, "Result failed.")

    def test_setSystemInformation(self):
        prop = OpenRTM_aist.Properties(defaults_str=configsample_spec)
        # Failed Pattern
        # self.assertEqual(prop.getProperty("manager.os.name"),"Linux","Result failed.")

        prop = self.mgrConf.setSystemInformation(prop)
        self.assertEqual(prop.getProperty("manager.os.name"), "Linux",
                         "Result failed.")
        #self.assertEqual(prop.getProperty("manager.os.name"),"Windows","Result failed.")

    def test_fileExist(self):
        self.assertEqual(self.mgrConf.fileExist("rtc.conf"), True,
                         "Result failed.")
        self.assertEqual(self.mgrConf.fileExist("./rtc.conf"), True,
                         "Result failed.")
 def setUp(self):
     argv = (sys.argv[0], "-f", "./rtc.conf")
     self.mgrConf = ManagerConfig(argv)
 def setUp(self):
     argv = (sys.argv[0], "-f", "./rtc.conf")
     self.mgrConf = ManagerConfig(argv)