test_PeriodicECSharedComposite.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 
5 ## \file test_PeriodicECSharedComposite.py
6 ## \brief test for PeriodicECSharedComposite class
7 ## \date $Date: $
8 ## \author Shinji Kurihara
9 #
10 # Copyright (C) 2006
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 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 ############### test #################
156 if __name__ == '__main__':
157  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:34