[openrtm-commit:01848] r693 - in trunk/OpenRTM-aist-Python/OpenRTM_aist: . test
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 3月 12日 (土) 04:16:43 JST
Author: miyamoto
Date: 2016-03-12 04:16:43 +0900 (Sat, 12 Mar 2016)
New Revision: 693
Added:
trunk/OpenRTM-aist-Python/OpenRTM_aist/test/test_INSRTObject.py
Modified:
trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
Log:
[compat,->RELENG_1_2] refs #3412
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2016-03-11 17:12:38 UTC (rev 692)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2016-03-11 19:16:43 UTC (rev 693)
@@ -981,6 +981,17 @@
self.publishPorts(comp)
self.subscribePorts(comp)
+ try:
+ poa = self._orb.resolve_initial_references("omniINSPOA")
+ poa._get_the_POAManager().activate()
+ id = comp.getCategory() + "/" + comp.getInstanceName()
+ poa.activate_object_with_id(id, comp)
+
+ except:
+ self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
+
+
+
return True
@@ -1009,6 +1020,16 @@
self._namingManager.unbindObject(name)
self._listeners.naming_.postUnbind(comp, names)
+ try:
+ poa = self._orb.resolve_initial_references("omniINSPOA")
+ poa._get_the_POAManager().activate()
+ id = comp.getCategory() + "/" + comp.getInstanceName()
+ poa.deactivate_object(id)
+ except:
+ self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
+
+
+
return True
Added: trunk/OpenRTM-aist-Python/OpenRTM_aist/test/test_INSRTObject.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/test/test_INSRTObject.py (rev 0)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/test/test_INSRTObject.py 2016-03-11 19:16:43 UTC (rev 693)
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+#
+# \file test_INSRTObject.py
+# \brief
+# \date $Date: $
+# \author Nobuhiko Miyamoto
+#
+
+
+import sys
+sys.path.insert(1,"../")
+
+try:
+ import unittest2 as unittest
+except (ImportError):
+ import unittest
+
+import time
+
+#from Manager import *
+import OpenRTM_aist
+import OpenRTM
+import RTC, RTC__POA
+
+testcomp1_spec = ["implementation_id", "TestComp1",
+ "type_name", "TestComp1",
+ "description", "Test example component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Myiyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "C++",
+ "lang_type", "compile",
+ "conf.default.test1", "0",
+ ""]
+
+
+
+
+
+
+
+
+def TestComp1Init(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=testcomp1_spec)
+ manager.registerFactory(profile,
+ OpenRTM_aist.DataFlowComponentBase,
+ OpenRTM_aist.Delete)
+
+
+
+
+
+
+def TestComp1ModuleInit(manager):
+ TestComp1Init(manager)
+ com = manager.createComponent("TestComp1")
+
+
+
+
+
+
+class test_INSRTObject(unittest.TestCase):
+
+ def setUp(self):
+
+ sys.argv.extend(['-p','2810'])
+ self.manager = OpenRTM_aist.Manager.init(sys.argv)
+ self.manager.setModuleInitProc(TestComp1ModuleInit)
+ self.manager.activateManager()
+
+
+ def tearDown(self):
+
+ comps = self.manager.getComponents()[:]
+ for comp in comps:
+ self.manager.unregisterComponent(comp)
+ comp_id = comp.getProperties()
+ factory = self.manager._factory.find(comp_id)
+ factory.destroy(comp)
+ self.manager.shutdownNaming()
+ time.sleep(0.1)
+
+ def test_getComponent(self):
+ rtobj = self.manager.getORB().string_to_object("corbaloc:iiop:localhost:2810/example/TestComp10")
+ rtc = rtobj._narrow(OpenRTM.DataFlowComponent)
+ name = rtc.get_component_profile().instance_name
+ self.assertEqual(name, "TestComp10")
+
+
+
+
+############### test #################
+if __name__ == '__main__':
+ unittest.main()
More information about the openrtm-commit
mailing list