test_PublisherFlush.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 #
5 # \file test_PublisherFlush.py
6 # \brief test for PublisherFlush class
7 # \date $Date: 2007/09/27 $
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 import sys
19 sys.path.insert(1,"../")
20 
21 import unittest
22 
23 from PublisherFlush import *
24 import OpenRTM_aist
25 
26 class Consumer:
27  def put(self,data):
28  return data
29 
30 class TestPublisherNew(unittest.TestCase):
31 
32  def setUp(self):
34  return
35 
36  def test_init(self):
37  self.assertEqual(self._pf.init(None),OpenRTM_aist.DataPortStatus.PORT_OK)
38  return
39 
40  def test_setConsumer(self):
41  self.assertEqual(self._pf.setConsumer(None),OpenRTM_aist.DataPortStatus.INVALID_ARGS)
42  self.assertEqual(self._pf.init(Consumer()),OpenRTM_aist.DataPortStatus.PORT_OK)
43  return
44 
45  def test_setBuffer(self):
46  self.assertEqual(self._pf.setBuffer(None),OpenRTM_aist.DataPortStatus.PORT_OK)
47  return
48 
49  def test_write(self):
51  cinfo = OpenRTM_aist.ConnectorInfo("",
52  "",
53  [],
54  prop)
55  self.assertEqual(self._pf.write(123,0,0),OpenRTM_aist.DataPortStatus.PRECONDITION_NOT_MET)
56  self.assertEqual(self._pf.setConsumer(OpenRTM_aist.InPortCorbaCdrConsumer()),
57  OpenRTM_aist.DataPortStatus.PORT_OK)
58  self.assertEqual(self._pf.setListener(cinfo,OpenRTM_aist.ConnectorListeners()),
59  OpenRTM_aist.DataPortStatus.PORT_OK)
60  self.assertEqual(self._pf.write(123,0,0),OpenRTM_aist.DataPortStatus.CONNECTION_LOST)
61  return
62 
64  self.assertEqual(self._pf.isActive(),False)
65  self.assertEqual(self._pf.activate(),OpenRTM_aist.DataPortStatus.PORT_OK)
66  self.assertEqual(self._pf.isActive(),True)
67  self.assertEqual(self._pf.activate(),OpenRTM_aist.DataPortStatus.PRECONDITION_NOT_MET)
68  self.assertEqual(self._pf.deactivate(),OpenRTM_aist.DataPortStatus.PORT_OK)
69  self.assertEqual(self._pf.isActive(),False)
70  self.assertEqual(self._pf.deactivate(),OpenRTM_aist.DataPortStatus.PRECONDITION_NOT_MET)
71  return
72 
73 
74 ############### test #################
75 if __name__ == '__main__':
76  unittest.main()
The Properties class represents a persistent set of properties.
Definition: Properties.py:83


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