19 sys.path.insert(1,
"../")
20 sys.path.insert(1,
"../RTM_IDL")
24 import SDOPackage, SDOPackage__POA
26 from SdoConfiguration
import *
29 from omniORB
import CORBA, PortableServer
35 class OrganizationTest(SDOPackage__POA.Organization):
40 configsample_spec = [
"implementation_id",
"ConfigSample",
41 "type_name",
"ConfigSample",
42 "description",
"Configuration example component",
44 "vendor",
"Shinji Kurihara, AIST",
45 "category",
"example",
46 "activity_type",
"DataFlowComponent",
49 "lang_type",
"compile",
51 "conf.default.int_param0",
"0",
52 "conf.default.int_param1",
"1",
53 "conf.default.double_param0",
"0.11",
54 "conf.default.double_param1",
"9.9",
55 "conf.default.str_param0",
"hoge",
56 "conf.default.str_param1",
"dara",
57 "conf.default.vector_param0",
"0.0,1.0,2.0,3.0,4.0",
60 configsample_mode_spec = [
"conf.default.int_param0",
"10",
61 "conf.default.int_param1",
"11",
62 "conf.default.double_param0",
"0.22",
63 "conf.default.double_param1",
"9999.9",
64 "conf.default.str_param0",
"hogehoge",
65 "conf.default.str_param1",
"daradaradata",
66 "conf.default.vector_param0",
"0.1,1.1,2.1,3.1,4.1",
72 self.
_orb = CORBA.ORB_init()
73 self.
_poa = self._orb.resolve_initial_references(
"RootPOA")
80 OpenRTM_aist.Manager.instance().shutdownManager()
84 dprof = SDOPackage.DeviceProfile(
"test",
"",
"",
"0.1.0",[])
85 self._sdoconf.set_device_profile(dprof)
86 self.assertEqual(self._sdoconf.getDeviceProfile().device_type,
"test")
87 self.assertEqual(self._sdoconf.getDeviceProfile().version,
"0.1.0")
89 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.set_device_profile,
None )
93 sprof = SDOPackage.ServiceProfile(
"test",
"MyService",[],
ServiceProf())
94 self._sdoconf.add_service_profile(sprof)
95 profiles = self._sdoconf.getServiceProfiles()
96 self.assertEqual(profiles[0].id,
"test")
97 self.assertEqual(self._sdoconf.getServiceProfile(
"test").id,
"test")
98 self._sdoconf.remove_service_profile(
"test")
99 self.assertEqual(self._sdoconf.getServiceProfile(
"test").id,
"")
101 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.add_service_profile,
None )
102 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.remove_service_profile,
None )
109 self._sdoconf.add_organization(org)
110 self._sdoconf.add_organization(org)
111 self._sdoconf.add_organization(org)
112 self.assertEqual(len(self._sdoconf.getOrganizations()), 3)
114 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.add_organization,
None )
115 self.assertRaises(SDOPackage.InternalError, self._sdoconf.remove_organization,
"aaa" )
116 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.remove_organization,
None )
120 self._sdoconf.get_configuration_parameters()
124 param_val = self._sdoconf.get_configuration_parameter_values()
125 self.assertEqual(param_val, [])
128 param_val = self._sdoconf.get_configuration_parameter_value(
"aaa")
129 self.assertEqual(param_val,
None)
131 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.get_configuration_parameter_value,
None )
135 self.assertEqual(self._sdoconf.set_configuration_parameter(
"name",123),
True)
136 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.set_configuration_parameter,
None,
None )
137 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.set_configuration_parameter,
"name",
None )
138 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.set_configuration_parameter,
None,123 )
141 conf_sets = self._sdoconf.get_configuration_sets()
142 self.assertEqual(len(conf_sets), 1)
146 conf_set = self._sdoconf.get_configuration_set(
"default")
147 self.assertEqual(conf_set.configuration_data[0].name,
"int_param0")
148 self.assertEqual(conf_set.configuration_data[0].value.value(),
"0")
150 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.get_configuration_set,
None )
153 self._sdoconf.set_configuration_set_values(SDOPackage.ConfigurationSet(
"default2",
"",[]))
155 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.set_configuration_set_values,
None )
158 self.assertEqual(self._sdoconf.get_active_configuration_set().id,
"default")
162 self._sdoconf.add_configuration_set(SDOPackage.ConfigurationSet(
"default2",
"",[]))
164 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.add_configuration_set,
None )
167 self._sdoconf.add_configuration_set(SDOPackage.ConfigurationSet(
"default2",
"",[]))
168 self.assertEqual(self._sdoconf.remove_configuration_set(
"default2"),
True)
170 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.remove_configuration_set,
None )
173 self._sdoconf.add_configuration_set(SDOPackage.ConfigurationSet(
"default2",
"",[]))
174 self.assertEqual(self._sdoconf.activate_configuration_set(
"default2"),
True)
176 self.assertRaises(SDOPackage.InvalidParameter, self._sdoconf.activate_configuration_set,
None )
179 self._sdoconf.getObjRef()
182 self._sdoconf.getOrganizations()
185 self._sdoconf.getDeviceProfile()
188 self._sdoconf.getServiceProfiles()
191 self._sdoconf.getServiceProfile(
"default")
194 self._sdoconf.getOrganizations()
197 print self._sdoconf.getUUID()
202 if __name__ ==
'__main__':
def test_getServiceProfile(self)
def test_add_service_profile(self)
def test_add_configuration_set(self)
def test_getServiceProfiles(self)
The Properties class represents a persistent set of properties.
def test_add_organization(self)
def test_remove_configuration_set(self)
def test_get_configuration_parameter_value(self)
def test_activate_configuration_set(self)
def test_set_configuration_set_values(self)
def test_getOrganizations(self)
def test_get_configuration_sets(self)
def test_get_configuration_parameter_values(self)
def test_getDeviceProfile(self)
def test_set_configuration_parameter(self)
def test_get_configuration_parameters(self)
def test_set_device_profile(self)
def test_get_configuration_set(self)
def test_get_active_configuration_set(self)