19 from omniORB
import CORBA
23 sys.path.insert(1,
"../")
24 sys.path.insert(1,
"../RTM_IDL")
28 import SDOPackage, SDOPackage__POA
30 from SdoOrganization
import *
35 OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
84 rtc =
TestComp(OpenRTM_aist.Manager.instance())
85 self.
org = Organization_impl(rtc.getObjRef())
88 OpenRTM_aist.Manager.instance().shutdownManager()
92 print self.org.get_organization_id()
95 nv_list = [SDOPackage.NameValue(
"test", 100)]
96 self.org.add_organization_property(SDOPackage.OrganizationProperty(nv_list))
97 self.assertEqual(self.org.get_organization_property().properties[0].name,
"test")
98 self.org.remove_organization_property(
"test")
99 ret_val = self.org.get_organization_property()
100 self.assertEqual(len(ret_val.properties), 0)
102 self.assertRaises(SDOPackage.InvalidParameter, self.org.remove_organization_property,
None )
105 self.org.set_organization_property_value(
"test", 100)
106 self.assertRaises(SDOPackage.InvalidParameter, self.org.set_organization_property_value,
None,
None )
108 val = omniORB.any.from_any(self.org.get_organization_property_value(
"test"))
109 self.assertEqual(val, 100)
113 self.assertRaises(SDOPackage.InvalidParameter, self.org.get_organization_property_value,
"aaa" )
114 self.assertRaises(SDOPackage.InvalidParameter, self.org.get_organization_property_value,
None )
116 self.assertRaises(SDOPackage.InvalidParameter, self.org.set_organization_property_value,
None,
"aaa" )
120 rtc =
TestComp(OpenRTM_aist.Manager.instance())
121 self.org.set_owner(rtc.getObjRef())
122 self.assertNotEqual(self.org.get_owner(),
None)
123 self.assertRaises(SDOPackage.InvalidParameter, self.org.set_owner,
None )
128 self.
_poa = self._orb.resolve_initial_references(
"RootPOA")
129 OpenRTM_aist.RTObject_impl.__init__(self, orb=self.
_orb, poa=self.
_poa)
135 self.assertEqual(self.org.get_members(),[])
137 member.setInstanceName(
"test0")
138 self.org.set_members([member])
140 member.setInstanceName(
"test1")
141 self.org.add_members([member])
142 self.assertEqual(len(self.org.get_members()),2)
143 self.org.remove_member(
"test1")
144 self.assertEqual(len(self.org.get_members()),1)
146 self.assertRaises(SDOPackage.InvalidParameter, self.org.set_members,
None )
147 self.assertRaises(SDOPackage.InvalidParameter, self.org.add_members,
None )
148 self.assertRaises(SDOPackage.InvalidParameter, self.org.remove_member,
None )
152 self.org.set_dependency(SDOPackage.OWN)
153 self.assertEqual(self.org.get_dependency(), SDOPackage.OWN)
155 self.assertRaises(SDOPackage.InvalidParameter, self.org.set_dependency,
None )
159 if __name__ ==
'__main__':
def test_get_members(self)
def __init__(self, manager)
def onAborting(self, ec_id)
def onExecute(self, ec_id)
def onStateUpdate(self, ec_id)
def test_get_organization_property_value(self)
def test_get_organization_id(self)
def onStartup(self, ec_id)
def onActivated(self, ec_id)
def test_get_organization_property(self)
def onShutdown(self, ec_id)
def onRateChanged(self, ec_id)
def test_get_dependency(self)
DataFlowComponentBase class.
def onDeactivated(self, ec_id)