test_PeriodicECSharedComposite.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 
5 
17 
18 import sys
19 sys.path.insert(1,"../")
20 sys.path.insert(1,"../RTM_IDL")
21 
22 import OpenRTM_aist
23 import RTC
24 
25 import unittest
26 
27 
28 configsample_spec = ["implementation_id", "TestComp",
29  "type_name", "TestComp",
30  "description", "Test example component",
31  "version", "1.0",
32  "vendor", "Shinji Kurihara, AIST",
33  "category", "example",
34  "activity_type", "DataFlowComponent",
35  "max_instance", "10",
36  "language", "Python",
37  "lang_type", "script",
38  # Configuration variables
39  "conf.default.int_param0", "0",
40  "conf.default.int_param1", "1",
41  "conf.default.double_param0", "0.11",
42  "conf.default.double_param1", "9.9",
43  "conf.default.str_param0", "hoge",
44  "conf.default.str_param1", "dara",
45  "conf.default.vector_param0", "0.0,1.0,2.0,3.0,4.0",
46  ""]
47 
48 com = None
49 
50 
52 
53  def __init__(self, manager):
54  OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
55 
56  def onInitialize(self):
57  print("onInitialize")
58  return RTC.RTC_OK
59 
60  def onFinalize(self):
61  print("onFinalize")
62  return RTC.RTC_OK
63 
64  def onStartup(self, ec_id):
65  print("onStartup")
66  return RTC.RTC_OK
67 
68  def onShutdown(self, ec_id):
69  print("onSutdown")
70  return RTC.RTC_OK
71 
72  def onActivated(self, ec_id):
73  print("onActivated")
74  return RTC.RTC_OK
75 
76  def onDeactivated(self, ec_id):
77  print("onDeactivated")
78  return RTC.RTC_OK
79 
80  def onExecute(self, ec_id):
81  print("onExecute")
82  return RTC.RTC_OK
83 
84  def onAborting(self, ec_id):
85  print("onAborting")
86  return RTC.RTC_OK
87 
88  def onReset(self, ec_id):
89  print("onReset")
90  return RTC.RTC_OK
91 
92  def onStateUpdate(self, ec_id):
93  print("onStateUpdate")
94  return RTC.RTC_OK
95 
96  def onRateChanged(self, ec_id):
97  print("onRateChanged")
98  return RTC.RTC_OK
99 
100 
101 def TestCompInit(manager):
102  global com
103  profile = OpenRTM_aist.Properties(defaults_str=configsample_spec)
104  manager.registerFactory(profile,
105  TestComp,
106  OpenRTM_aist.Delete)
107  com = manager.createComponent("TestComp")
108 
109 
110 class TestPeriodicECSharedComposite(unittest.TestCase):
111 
112  def setUp(self):
113  self.manager = OpenRTM_aist.Manager.init(sys.argv)
115  return
116 
117  def test_organization(self):
118  global com
119  self.manager.setModuleInitProc(TestCompInit)
120  self.manager.activateManager()
122  self.assertEqual(organization.set_members([com.getObjRef()]),True)
123  #self.assertEqual(organization.add_members([com.getObjRef()]),True)
124  self.assertEqual(organization.remove_member("TestComp0"),True)
125  self.assertEqual(organization.add_members([com.getObjRef()]),True)
126  organization.removeAllMembers()
127  return
128 
129 
130  def test_onInitialize(self):
131  self.assertEqual(self.composite.onInitialize(), RTC.RTC_OK)
132  return
133 
134 
135  def test_onActivated(self):
136  self.assertEqual(self.composite.onActivated(None), RTC.RTC_OK)
137  return
138 
139 
141  self.assertEqual(self.composite.onDeactivated(None), RTC.RTC_OK)
142  return
143 
144 
145  def test_onReset(self):
146  self.assertEqual(self.composite.onReset(None), RTC.RTC_OK)
147  return
148 
149 
150  def test_delegatePort(self):
151  return
152 
153 
154 
155 
156 if __name__ == '__main__':
157  unittest.main()
test_PeriodicECSharedComposite.TestComp.onRateChanged
def onRateChanged(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:96
test_PeriodicECSharedComposite.TestComp.onDeactivated
def onDeactivated(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:76
test_PeriodicECSharedComposite.TestComp.onAborting
def onAborting(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:84
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.test_onActivated
def test_onActivated(self)
Definition: test_PeriodicECSharedComposite.py:135
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.setUp
def setUp(self)
Definition: test_PeriodicECSharedComposite.py:112
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.manager
manager
Definition: test_PeriodicECSharedComposite.py:113
test_PeriodicECSharedComposite.TestComp
Definition: test_PeriodicECSharedComposite.py:51
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite
Definition: test_PeriodicECSharedComposite.py:110
test_PeriodicECSharedComposite.TestComp.onInitialize
def onInitialize(self)
Definition: test_PeriodicECSharedComposite.py:56
test_PeriodicECSharedComposite.TestComp.onStateUpdate
def onStateUpdate(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:92
test_PeriodicECSharedComposite.TestCompInit
def TestCompInit(manager)
Definition: test_PeriodicECSharedComposite.py:101
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.test_onReset
def test_onReset(self)
Definition: test_PeriodicECSharedComposite.py:145
test_PeriodicECSharedComposite.TestComp.onFinalize
def onFinalize(self)
Definition: test_PeriodicECSharedComposite.py:60
OpenRTM_aist.DataFlowComponentBase.DataFlowComponentBase
DataFlowComponentBase class.
Definition: DataFlowComponentBase.py:35
OpenRTM_aist.PeriodicECSharedComposite.PeriodicECOrganization
Definition: PeriodicECSharedComposite.py:88
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.test_onInitialize
def test_onInitialize(self)
Definition: test_PeriodicECSharedComposite.py:130
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.test_onDeactivated
def test_onDeactivated(self)
Definition: test_PeriodicECSharedComposite.py:140
test_PeriodicECSharedComposite.TestComp.onShutdown
def onShutdown(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:68
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.composite
composite
Definition: test_PeriodicECSharedComposite.py:114
test_PeriodicECSharedComposite.TestComp.onExecute
def onExecute(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:80
OpenRTM_aist.PeriodicECSharedComposite.PeriodicECSharedComposite
PeriodicECSharedComposite class.
Definition: PeriodicECSharedComposite.py:617
OpenRTM_aist.Properties.Properties
Definition: Properties.py:83
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.test_organization
def test_organization(self)
Definition: test_PeriodicECSharedComposite.py:117
test_PeriodicECSharedComposite.TestPeriodicECSharedComposite.test_delegatePort
def test_delegatePort(self)
Definition: test_PeriodicECSharedComposite.py:150
test_PeriodicECSharedComposite.TestComp.onReset
def onReset(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:88
test_PeriodicECSharedComposite.TestComp.__init__
def __init__(self, manager)
Constructor.
Definition: test_PeriodicECSharedComposite.py:53
test_PeriodicECSharedComposite.TestComp.onStartup
def onStartup(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:64
test_PeriodicECSharedComposite.TestComp.onActivated
def onActivated(self, ec_id)
Definition: test_PeriodicECSharedComposite.py:72


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Apr 21 2025 02:45:07