18 sys.path.insert(1,
"../")
22 from ComponentActionListener
import *
27 PreComponentActionListener.__init__(self)
36 PostComponentActionListener.__init__(self)
45 PortActionListener.__init__(self)
54 ExecutionContextActionListener.__init__(self)
66 OpenRTM_aist.Manager.instance().shutdownManager()
70 self.assertEqual(
"PRE_ON_INITIALIZE",
71 PreComponentActionListener.toString(
72 PreComponentActionListenerType.PRE_ON_INITIALIZE))
74 self.assertEqual(
"PRE_ON_FINALIZE",
75 PreComponentActionListener.toString(
76 PreComponentActionListenerType.PRE_ON_FINALIZE))
78 self.assertEqual(
"PRE_ON_STARTUP",
79 PreComponentActionListener.toString(
80 PreComponentActionListenerType.PRE_ON_STARTUP))
82 self.assertEqual(
"PRE_ON_SHUTDOWN",
83 PreComponentActionListener.toString(
84 PreComponentActionListenerType.PRE_ON_SHUTDOWN))
86 self.assertEqual(
"PRE_ON_ACTIVATED",
87 PreComponentActionListener.toString(
88 PreComponentActionListenerType.PRE_ON_ACTIVATED))
90 self.assertEqual(
"PRE_ON_DEACTIVATED",
91 PreComponentActionListener.toString(
92 PreComponentActionListenerType.PRE_ON_DEACTIVATED))
94 self.assertEqual(
"PRE_ON_ABORTING",
95 PreComponentActionListener.toString(
96 PreComponentActionListenerType.PRE_ON_ABORTING))
98 self.assertEqual(
"PRE_ON_ERROR",
99 PreComponentActionListener.toString(
100 PreComponentActionListenerType.PRE_ON_ERROR))
102 self.assertEqual(
"PRE_ON_RESET",
103 PreComponentActionListener.toString(
104 PreComponentActionListenerType.PRE_ON_RESET))
106 self.assertEqual(
"PRE_ON_EXECUTE",
107 PreComponentActionListener.toString(
108 PreComponentActionListenerType.PRE_ON_EXECUTE))
110 self.assertEqual(
"PRE_ON_STATE_UPDATE",
111 PreComponentActionListener.toString(
112 PreComponentActionListenerType.PRE_ON_STATE_UPDATE))
114 self.assertEqual(
"PRE_ON_RATE_CHANGED",
115 PreComponentActionListener.toString(
116 PreComponentActionListenerType.PRE_ON_RATE_CHANGED))
121 self.assertEqual(
"POST_ON_INITIALIZE",
122 PostComponentActionListener.toString(
123 PostComponentActionListenerType.POST_ON_INITIALIZE))
125 self.assertEqual(
"POST_ON_FINALIZE",
126 PostComponentActionListener.toString(
127 PostComponentActionListenerType.POST_ON_FINALIZE))
129 self.assertEqual(
"POST_ON_STARTUP",
130 PostComponentActionListener.toString(
131 PostComponentActionListenerType.POST_ON_STARTUP))
133 self.assertEqual(
"POST_ON_SHUTDOWN",
134 PostComponentActionListener.toString(
135 PostComponentActionListenerType.POST_ON_SHUTDOWN))
137 self.assertEqual(
"POST_ON_ACTIVATED",
138 PostComponentActionListener.toString(
139 PostComponentActionListenerType.POST_ON_ACTIVATED))
141 self.assertEqual(
"POST_ON_DEACTIVATED",
142 PostComponentActionListener.toString(
143 PostComponentActionListenerType.POST_ON_DEACTIVATED))
145 self.assertEqual(
"POST_ON_ABORTING",
146 PostComponentActionListener.toString(
147 PostComponentActionListenerType.POST_ON_ABORTING))
149 self.assertEqual(
"POST_ON_ERROR",
150 PostComponentActionListener.toString(
151 PostComponentActionListenerType.POST_ON_ERROR))
153 self.assertEqual(
"POST_ON_RESET",
154 PostComponentActionListener.toString(
155 PostComponentActionListenerType.POST_ON_RESET))
157 self.assertEqual(
"POST_ON_EXECUTE",
158 PostComponentActionListener.toString(
159 PostComponentActionListenerType.POST_ON_EXECUTE))
161 self.assertEqual(
"POST_ON_STATE_UPDATE",
162 PostComponentActionListener.toString(
163 PostComponentActionListenerType.POST_ON_STATE_UPDATE))
165 self.assertEqual(
"POST_ON_RATE_CHANGED",
166 PostComponentActionListener.toString(
167 PostComponentActionListenerType.POST_ON_RATE_CHANGED))
172 self.assertEqual(
"ADD_PORT",
173 PortActionListener.toString(
174 PortActionListenerType.ADD_PORT))
176 self.assertEqual(
"REMOVE_PORT",
177 PortActionListener.toString(
178 PortActionListenerType.REMOVE_PORT))
183 self.assertEqual(
"ATTACH_EC",
184 ExecutionContextActionListener.toString(
185 ExecutionContextActionListenerType.EC_ATTACHED))
187 self.assertEqual(
"DETACH_EC",
188 ExecutionContextActionListener.toString(
189 ExecutionContextActionListenerType.EC_DETACHED))
195 preactions = ComponentActionListeners()
197 preactions.preaction_[0].addListener(listener,
True)
198 preactions.preaction_[0].notify(
"test precomp ec_id")
199 preactions.preaction_[0].removeListener(listener)
203 postactions = ComponentActionListeners()
205 postactions.postaction_[0].addListener(listener,
True)
206 postactions.postaction_[0].notify(
"test postcomp ec_id",
True)
207 postactions.postaction_[0].removeListener(listener)
211 portactions = ComponentActionListeners()
213 portactions.portaction_[0].addListener(listener,
True)
214 portactions.portaction_[0].notify(
"test port pprof")
215 portactions.portaction_[0].removeListener(listener)
219 ecactions = ComponentActionListeners()
221 ecactions.ecaction_[0].addListener(listener,
True)
222 ecactions.ecaction_[0].notify(
"test ec ec_id")
223 ecactions.ecaction_[0].removeListener(listener)
228 if __name__ ==
'__main__':
def __call__(self, pprof)
def test_PreComponentActionListenerHolder(self)
def test_PortActionListenerHolder(self)
def test_ExecutionContextActionListener_toString(self)
def test_PortActionListener_toString(self)
def test_PostComponentActionListenerHolder(self)
def test_PostComponentActionListener_toString(self)
def __call__(self, id, ret)
def __call__(self, ec_id)
def test_PreComponentActionListener_toString(self)
def test_ExecutionContextActionListenerHolder(self)