19 sys.path.insert(1,
"../")
24 from CorbaNaming
import *
30 self.
orb = OpenRTM_aist.Manager.instance().getORB()
46 OpenRTM_aist.Manager.instance().shutdownManager()
52 self.
naming.init(
"localhost")
54 print "Exeption at naming init." 63 obj = self.
naming.newContext()
64 self.
naming.bind(sname, obj)
67 new_obj = self.
naming.resolve(sname)
68 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
73 name =
"localhost.host_cxt\/Manager123456.mgr_cxt/MobileRobot.cat_cxt/Kani0.rtc" 76 lname.append(CosNaming.NameComponent(
"localhost.host_cxt\/Manager123456",
"mgr_cxt"))
77 lname.append(CosNaming.NameComponent(
"MobileRobot",
"cat_cxt"))
78 lname.append(CosNaming.NameComponent(
"Kani0",
"rtc"))
80 obj = self.
naming.newContext()
81 self.
naming.bindByString(name, obj)
82 new_obj = self.
naming.resolve(name)
83 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
84 new_obj = self.
naming.resolve(lname)
85 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
92 obj = self.
naming.newContext()
96 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
100 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
108 obj = self.
naming.newContext()
112 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
116 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
120 obj = self.
naming.newContext()
122 name.append(CosNaming.NameComponent(
"bindcxt",
"bindcxt_cxt"))
124 self.
naming.bindContext(
"bindcxt.bindcxt_cxt", obj)
125 new_obj = self.
naming.resolve(name)
126 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
130 obj = self.
naming.newContext()
138 name.append(CosNaming.NameComponent(
"newContext",
"new_cxt"))
140 self.
naming.bindNewContext(name)
141 new_obj = self.
naming.resolve(name)
145 obj = self.
naming.newContext()
147 name.append(CosNaming.NameComponent(
"destroy",
"destroy_cxt"))
149 self.
naming.bind(name, obj)
154 obj = self.
naming.newContext()
156 name.append(CosNaming.NameComponent(
"desRec0",
"desRec0_cxt"))
157 name.append(CosNaming.NameComponent(
"desRec1",
"desRec1_cxt"))
158 name.append(CosNaming.NameComponent(
"desRec2",
"desRec2_cxt"))
160 self.
naming.bind(name, obj)
161 self.
naming.destroyRecursive(obj)
166 self.
naming.list(self.
naming.getRootContext(), 100, bl, bi)
167 print bl[0][0].binding_name[0].id
172 name.append(CosNaming.NameComponent(
"desRec0",
"desRec0_cxt"))
173 name.append(CosNaming.NameComponent(
"desRec1",
"desRec1_cxt"))
174 name.append(CosNaming.NameComponent(
"desRec2",
"desRec2_cxt"))
177 self.assertEqual(str(
"desRec0.desRec0_cxt/desRec1.desRec1_cxt/desRec2.desRec2_cxt/"),str(string_name))
178 print ".",string_name,
"." 181 if __name__ ==
'__main__':
def test_bindContext(self)
def test_destroyRecursive(self)
def test_bindNewContext(self)
def toString(nv, name=None)
Get string value in NVList specified by name.
def test_bindByString(self)
def test_rebindRecursive(self)
def bind_test_sequence(self, sname)