OpenRTM_aist
test
test_OutPortPullConnector.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# -*- Python -*-
3
4
#
5
# \file test_OutPortPullConnector.py
6
# \brief test for OutPortPullConnector class
7
# \date $Date: 2007/09/19$
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
import
sys
20
sys.path.insert(1,
"../"
)
21
22
from
omniORB
import
*
23
from
omniORB
import
any
24
25
import
unittest
26
from
OutPortPullConnector
import
*
27
28
import
RTC, RTC__POA
29
30
import
OpenRTM_aist
31
32
class
MyBuffer
:
33
def
__init__
(self):
34
self.
_data
=
None
35
return
36
37
def
write
(self, data):
38
self.
_data
= data
39
return
40
41
def
read
(self):
42
return
self.
_data
43
44
def
init
(self,info):
45
pass
46
47
class
OutPortProviderMock:
48
_buffer =
None
49
_prop =
None
50
51
def
init
(self, prop):
52
self.
_prop
= prop
53
54
def
setBuffer
(self, buff):
55
self.
_buffer
= buff
56
57
def
setListener
(self, info, listener):
58
pass
59
60
def
setConnector
(self, con):
61
pass
62
63
64
class
TestOutPortPullConnector(unittest.TestCase):
65
def
setUp
(self):
66
self.
_buffer
=
MyBuffer
()
67
self.
_profile
=
OpenRTM_aist.ConnectorInfo
(
"test"
,
68
"id"
,
69
[
"in"
,
"out"
],
70
OpenRTM_aist.Properties
())
71
72
self.
_oc
=
OutPortPullConnector
(self.
_profile
,
OutPortProviderMock
(),
OpenRTM_aist.ConnectorListeners
(), self.
_buffer
)
73
return
74
75
def
test_write
(self):
76
self.
_oc
.write(123)
77
# self.assertEqual(self._buffer.read(), 123)
78
return
79
80
81
def
test_disconnect
(self):
82
self.assertEqual(self.
_oc
.disconnect(), OpenRTM_aist.DataPortStatus.PORT_OK)
83
return
84
85
86
def
test_getBuffer
(self):
87
self.assertEqual(self.
_oc
.getBuffer(),self.
_buffer
)
88
return
89
90
91
92
if
__name__ ==
'__main__'
:
93
unittest.main()
test_OutPortPullConnector.MyBuffer._data
_data
Definition:
test_OutPortPullConnector.py:34
test_OutPortPullConnector.TestOutPortPullConnector.test_getBuffer
def test_getBuffer(self)
Definition:
test_OutPortPullConnector.py:86
test_OutPortPullConnector.MyBuffer.read
def read(self)
Definition:
test_OutPortPullConnector.py:41
OpenRTM_aist.ConnectorListener.ConnectorListeners
Definition:
ConnectorListener.py:762
test_OutPortPullConnector.OutPortProviderMock.setListener
def setListener(self, info, listener)
Definition:
test_OutPortPullConnector.py:57
test_OutPortPullConnector.TestOutPortPullConnector._oc
_oc
Definition:
test_OutPortPullConnector.py:72
OpenRTM_aist.Properties.Properties
The Properties class represents a persistent set of properties.
Definition:
Properties.py:83
test_OutPortPullConnector.TestOutPortPullConnector.setUp
def setUp(self)
Definition:
test_OutPortPullConnector.py:65
test_OutPortPullConnector.OutPortProviderMock.setBuffer
def setBuffer(self, buff)
Definition:
test_OutPortPullConnector.py:54
test_OutPortPullConnector.TestOutPortPullConnector._profile
_profile
Definition:
test_OutPortPullConnector.py:67
test_OutPortPullConnector.MyBuffer.write
def write(self, data)
Definition:
test_OutPortPullConnector.py:37
test_OutPortPullConnector.OutPortProviderMock._prop
_prop
Definition:
test_OutPortPullConnector.py:49
test_OutPortPullConnector.MyBuffer
Definition:
test_OutPortPullConnector.py:32
test_OutPortPullConnector.MyBuffer.__init__
def __init__(self)
Definition:
test_OutPortPullConnector.py:33
OutPortPullConnector
test_OutPortPullConnector.OutPortProviderMock._buffer
_buffer
Definition:
test_OutPortPullConnector.py:48
test_OutPortPullConnector.OutPortProviderMock
Definition:
test_OutPortPullConnector.py:47
test_OutPortPullConnector.OutPortProviderMock.setConnector
def setConnector(self, con)
Definition:
test_OutPortPullConnector.py:60
test_OutPortPullConnector.OutPortProviderMock.init
def init(self, prop)
Definition:
test_OutPortPullConnector.py:51
test_OutPortPullConnector.TestOutPortPullConnector.test_write
def test_write(self)
Definition:
test_OutPortPullConnector.py:75
test_OutPortPullConnector.TestOutPortPullConnector.test_disconnect
def test_disconnect(self)
Definition:
test_OutPortPullConnector.py:81
test_OutPortPullConnector.TestOutPortPullConnector._buffer
_buffer
Definition:
test_OutPortPullConnector.py:66
test_OutPortPullConnector.MyBuffer.init
def init(self, info)
Definition:
test_OutPortPullConnector.py:44
OpenRTM_aist.ConnectorBase.ConnectorInfo
Definition:
ConnectorBase.py:31
openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:07