17 sys.path.insert(1,
"../")
20 from SdoServiceAdmin
import *
22 import SDOPackage,SDOPackage__POA
23 from omniORB
import CORBA, PortableServer
24 from omniORB
import any
29 self.
_orb = CORBA.ORB_init()
30 self.
_poa = self.
_orb.resolve_initial_references(
"RootPOA")
31 OpenRTM_aist.RTObject_impl.__init__(self, orb=self.
_orb, poa=self.
_poa)
44 OpenRTM_aist.SdoServiceConsumerBase.__init__(self)
51 any_val = any.to_any(
"3.14159")
52 nv = SDOPackage.NameValue(
"PROPERTIES NAME 0", any_val)
53 sprof = SDOPackage.ServiceProfile(
"test id",
"INTERFACE_TYPE",[nv],SDOServiceMock())
63 OpenRTM_aist.Manager.instance().shutdownManager()
69 self.assertEqual(sdoadmin.addSdoServiceConsumerFactory(),
False)
75 self.assertEqual(sdoadmin.removeSdoServiceConsumerFactory(),
False)
80 any_val = any.to_any(
"3.14159")
81 nv = SDOPackage.NameValue(
"PROPERTIES NAME 0", any_val)
82 sprof = SDOPackage.ServiceProfile(
"ID 0",
"INTERFACE_TYPE",[nv],
SDOServiceMock())
84 self.assertEqual(sdoadmin.addSdoServiceConsumer(sprof),
False)
89 any_val = any.to_any(
"3.14159")
90 nv = SDOPackage.NameValue(
"PROPERTIES NAME 0", any_val)
91 sprof = SDOPackage.ServiceProfile(
"test id",
"INTERFACE_TYPE",[nv],
SDOServiceMock())
93 self.assertEqual(sdoadmin.addSdoServiceConsumer(sprof),
False)
95 self.assertEqual(sdoadmin.removeSdoServiceConsumer(
"test id"),
True)
96 self.assertEqual(sdoadmin.addSdoServiceConsumer(sprof),
False)
98 self.assertEqual(sdoadmin.removeSdoServiceConsumer(
"test id2"),
False)
104 any_val = any.to_any(
"3.14159")
105 nv = SDOPackage.NameValue(
"PROPERTIES NAME 0", any_val)
106 sprof = SDOPackage.ServiceProfile(
"test id",
"INTERFACE_TYPE",[nv],
SDOServiceMock())
107 self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),
True)
108 sdoadmin._allConsumerAllowed =
False 109 self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),
False)
110 sdoadmin._consumerTypes = [
"type0",
"type1",
"type2",
"INTERFACE_TYPE"]
111 self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),
True)
112 sdoadmin._consumerTypes = [
"type0",
"type1",
"type2"]
113 self.assertEqual(sdoadmin.isAllowedConsumerType(sprof),
False)
118 factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
121 any_val = any.to_any(
"3.14159")
122 nv = SDOPackage.NameValue(
"PROPERTIES NAME 0", any_val)
123 sprof = SDOPackage.ServiceProfile(
"test id",
"INTERFACE_TYPE",[nv],
SDOServiceMock())
124 self.assertEqual(sdoadmin.isExistingConsumerType(sprof),
False)
126 self.assertEqual(sdoadmin.isExistingConsumerType(sprof),
True)
132 self.assertNotEqual(sdoadmin.getUUID(),
"")
133 self.assertNotEqual(sdoadmin.getUUID(),
None)
138 if __name__ ==
'__main__':
def test_addSdoServiceConsumer(self)
def test_isAllowedConsumerType(self)
def test_addSdoServiceConsumerFactory(self)
def test_removeSdoServiceConsumerFactory(self)
def test_isExistingConsumerType(self)
def reinit(self, profile)
def test_removeSdoServiceConsumer(self)