test_CorbaConsumer.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 #
5 # \file test_CorbaConsumer.py
6 # \brief CORBA Consumer class
7 # \date $Date: 2007/09/20 $
8 # \author Shinji Kurihara
9 #
10 # Copyright (C) 2006
11 # Noriaki Ando
12 # Task-intelligence Research Group,
13 # Intelligent Systems Research Institute,
14 # National Institute of
15 # Advanced Industrial Science and Technology (AIST), Japan
16 # All rights reserved.
17 
18 
19 from omniORB import CORBA
20 from omniORB import any
21 from omniORB import *
22 
23 import sys
24 sys.path.insert(1,"../")
25 sys.path.insert(1,"../RTM_IDL")
26 
27 import unittest
28 
29 from CorbaConsumer import *
30 
31 import OpenRTM, OpenRTM__POA
32 
33 class InPortTest(OpenRTM__POA.InPortCdr):
34  def __init__(self):
35  self.orb = CORBA.ORB_init()
36  self.poa = self.orb.resolve_initial_references("RootPOA")
37  poaManager = self.poa._get_the_POAManager()
38  poaManager.activate()
39 
40 
41  def put(self, data):
42  #print "put data: ", data
43  return OpenRTM.PORT_OK
44 
45 
46 class TestCorbaConsumer(unittest.TestCase):
47  def setUp(self):
48 
49  self._cc = CorbaConsumer()
50 
51  def test_case(self):
52  self._cc.setObject(InPortTest()._this())
53  obj = self._cc._ptr()._narrow(OpenRTM.InPortCdr)
54  cdr = cdrMarshal(any.to_any("hoge").typecode(), "hoge", 1)
55  self.assertEqual(OpenRTM.PORT_OK,obj.put(cdr))
56  self._cc.releaseObject()
57  self.assertEqual(self._cc._ptr(), None)
58 
59 
60 
61 
62 if __name__ == '__main__':
63  unittest.main()


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:06