test_DataInPort.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- Python -*-
00003 
00004 #
00005 #  \file test_DataInPort.py
00006 #  \brief RTC::Port implementation for Data InPort
00007 #  \date $Date: 2007/09/27 $
00008 #  \author Shinji Kurihara
00009 # 
00010 #  Copyright (C) 2006
00011 #      Noriaki Ando
00012 #      Task-intelligence Research Group,
00013 #      Intelligent Systems Research Institute,
00014 #      National Institute of
00015 #          Advanced Industrial Science and Technology (AIST), Japan
00016 #      All rights reserved.
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 ############### test #################
00057 if __name__ == '__main__':
00058         unittest.main()


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Aug 27 2015 14:17:28