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
00019 from omniORB import CORBA
00020 from omniORB import any
00021 from omniORB import *
00022
00023 import sys
00024 sys.path.insert(1,"../")
00025 sys.path.insert(1,"../RTM_IDL")
00026
00027 import unittest
00028
00029 from CorbaConsumer import *
00030
00031 import OpenRTM, OpenRTM__POA
00032
00033 class InPortTest(OpenRTM__POA.InPortCdr):
00034 def __init__(self):
00035 self.orb = CORBA.ORB_init()
00036 self.poa = self.orb.resolve_initial_references("RootPOA")
00037 poaManager = self.poa._get_the_POAManager()
00038 poaManager.activate()
00039
00040
00041 def put(self, data):
00042
00043 return OpenRTM.PORT_OK
00044
00045
00046 class TestCorbaConsumer(unittest.TestCase):
00047 def setUp(self):
00048
00049 self._cc = CorbaConsumer()
00050
00051 def test_case(self):
00052 self._cc.setObject(InPortTest()._this())
00053 obj = self._cc._ptr()._narrow(OpenRTM.InPortCdr)
00054 cdr = cdrMarshal(any.to_any("hoge").typecode(), "hoge", 1)
00055 self.assertEqual(OpenRTM.PORT_OK,obj.put(cdr))
00056 self._cc.releaseObject()
00057 self.assertEqual(self._cc._ptr(), None)
00058
00059
00060
00061
00062 if __name__ == '__main__':
00063 unittest.main()