test_CorbaConsumer.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- Python -*-
00003 
00004 #
00005 #  \file test_CorbaConsumer.py
00006 #  \brief CORBA Consumer class
00007 #  \date $Date: 2007/09/20 $
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 
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                 #print "put data: ", data
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 ############### test #################
00062 if __name__ == '__main__':
00063         unittest.main()


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