test_InPortCorbaCdrConsumer.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 
5 # \file test_InPortCorbaCdrConsumer.py
6 # \brief test for InPortCorbaCdrConsumer class
7 # \date $Date: 2007/09/20 $
8 # \author Shinji Kurihara
9 #
10 # Copyright (C) 2003-2005
11 # Task-intelligence Research Group,
12 # Intelligent Systems Research Institute,
13 # National Institute of
14 # Advanced Industrial Science and Technology (AIST), Japan
15 # All rights reserved.
16 
17 
18 import sys
19 sys.path.insert(1,"../")
20 
21 import unittest
22 
23 from InPortCorbaCdrConsumer import *
24 
25 import RTC, RTC__POA
26 import OpenRTM_aist
27 
28 
29 class TestInPortCorbaCdrConsumer(unittest.TestCase):
30  def setUp(self):
32  self._cons = OpenRTM_aist.InPortConsumerFactory.instance().createObject("corba_cdr")
33  self._inp = OpenRTM_aist.InPort("in",RTC.TimedLong(RTC.Time(0,0),0))
34  self._orb = OpenRTM_aist.Manager.instance().getORB()
35  return
36 
37  def test_init(self):
38  self._cons.init(OpenRTM_aist.Properties())
39  return
40 
41  def test_put(self):
42  self.assertEqual(self._cons.put(123),OpenRTM_aist.DataPortStatus.CONNECTION_LOST)
43  return
44 
46  self._cons.publishInterfaceProfile(OpenRTM_aist.Properties())
47  return
48 
50  ior = self._orb.object_to_string(self._inp.get_port_profile().port_ref)
51  self.assertEqual(self._cons.subscribeInterface([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ior",ior)]),True)
52  self.assertEqual(self._cons.subscribeInterface([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ref",
53  self._inp.get_port_profile().port_ref)]),True)
54  return
55 
57  ior = self._orb.object_to_string(self._inp.get_port_profile().port_ref)
58  self.assertEqual(self._cons.subscribeInterface([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ior",ior)]),True)
59  self._cons.unsubscribeInterface([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ior",ior)])
60  self.assertEqual(self._cons.subscribeInterface([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ref",
61  self._inp.get_port_profile().port_ref)]),True)
62  self._cons.unsubscribeInterface([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ref",
63  self._inp.get_port_profile().port_ref)])
64  return
65 
67  ior = self._orb.object_to_string(self._inp.get_port_profile().port_ref)
68  self.assertEqual(self._cons.subscribeFromIor([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ior",ior)]),True)
69  return
70 
72  self.assertEqual(self._cons.subscribeFromRef([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ref",
73  self._inp.get_port_profile().port_ref)]),True)
74  return
75 
77  ior = self._orb.object_to_string(self._inp.get_port_profile().port_ref)
78  self.assertEqual(self._cons.subscribeFromIor([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ior",ior)]),True)
79  self.assertEqual(self._cons.unsubscribeFromIor([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ior",ior)]),True)
80  return
81 
83  self.assertEqual(self._cons.subscribeFromRef([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ref",
84  self._inp.get_port_profile().port_ref)]),True)
85  self.assertEqual(self._cons.unsubscribeFromRef([OpenRTM_aist.NVUtil.newNV("dataport.corba_cdr.inport_ref",
86  self._inp.get_port_profile().port_ref)]),True)
87  return
88 
89 ############### test #################
90 if __name__ == '__main__':
91  unittest.main()
92 
The Properties class represents a persistent set of properties.
Definition: Properties.py:83
InPort template class.
Definition: InPort.py:58
def newNV(name, value)
Create NameVale.
Definition: NVUtil.py:50


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34