Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import OpenRTM_aist
00019 import RTC, RTC__POA
00020
00021 import CORBA
00022 import sys
00023 sys.path.insert(1,"../")
00024
00025 import unittest
00026
00027 from DataInPort import *
00028
00029 class TestObj(OpenRTM_aist.RTObject_impl):
00030 def __init__(self):
00031 self._orb = CORBA.ORB_init()
00032 self._poa = self._orb.resolve_initial_references("RootPOA")
00033 OpenRTM_aist.RTObject_impl.__init__(self, orb=self._orb, poa=self._poa)
00034
00035
00036 class TestDataInPort(unittest.TestCase):
00037 def setUp(self):
00038 self._orb = CORBA.ORB_init()
00039 self._poa = self._orb.resolve_initial_references("RootPOA")
00040 inport = OpenRTM_aist.InPort("in", RTC.TimedLong(RTC.Time(0,0),0),
00041 OpenRTM_aist.RingBuffer(8))
00042 self._dip = DataInPort("in", inport, None)
00043
00044 def test_case(self):
00045 nvlist = [OpenRTM_aist.NVUtil.newNV("dataport.interface_type","CORBA_Any"),
00046 OpenRTM_aist.NVUtil.newNV("dataport.dataflow_type","Push"),
00047 OpenRTM_aist.NVUtil.newNV("dataport.subscription_type","Flush")]
00048
00049 prof = RTC.ConnectorProfile("connector0","",[TestObj(),TestObj()],nvlist)
00050
00051 self.assertEqual(self._dip.publishInterfaces(prof), RTC.RTC_OK)
00052 self.assertEqual(self._dip.subscribeInterfaces(prof), RTC.RTC_OK)
00053 self._dip.unsubscribeInterfaces(prof)
00054
00055
00056
00057 if __name__ == '__main__':
00058 unittest.main()