19 sys.path.insert(1,
"../")
24 from CorbaNaming
import *
30 self.
orb = OpenRTM_aist.Manager.instance().getORB()
34 self.name_list.append(CosNaming.NameComponent(
"Mon",
"mon_cxt"))
35 self.name_list.append(CosNaming.NameComponent(
"Tus",
"tus_cxt"))
36 self.name_list.append(CosNaming.NameComponent(
"Wed",
"wed_cxt"))
37 self.name_list.append(CosNaming.NameComponent(
"Thu",
"thu_cxt"))
38 self.name_list.append(CosNaming.NameComponent(
"Fri",
"fri_cxt"))
39 self.name_list.append(CosNaming.NameComponent(
"Sat",
"sat_cxt"))
40 self.name_list.append(CosNaming.NameComponent(
"Sun",
"sun_cxt"))
46 OpenRTM_aist.Manager.instance().shutdownManager()
52 self.naming.init(
"localhost")
54 print "Exeption at naming init." 58 self.naming.clearAll()
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()
95 new_obj = self.naming.resolve(self.
name_list)
96 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
99 new_obj = self.naming.resolve(self.
name_list)
100 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
108 obj = self.naming.newContext()
111 new_obj = self.naming.resolve(self.
name_list)
112 self.assertEqual(obj._is_equivalent(new_obj),
True,
"Resolve failed.")
114 self.naming.rebindRecursive(self.naming.getRootContext(), self.
name_list, obj)
115 new_obj = self.naming.resolve(self.
name_list)
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)
150 self.naming.destroy(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"))
176 string_name = self.naming.toString(name)
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 test_bindByString(self)
def test_rebindRecursive(self)
def bind_test_sequence(self, sname)