test_ExtTrigExecutionContext.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- Python -*-
3 
4 #
5 # \file test_ExtTrigExecutionContext.py
6 # \brief ExtTrigExecutionContext class
7 # \date $Date: 2007/09/06$
8 # \author Shinji Kurihara
9 #
10 # Copyright (C) 2007
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 import threading
21 
22 import unittest
23 import OpenRTM_aist
24 import RTC, RTC__POA
25 
26 from ExtTrigExecutionContext import *
27 
28 from omniORB import CORBA, PortableServer
29 
31  def __init__(self):
32  self._orb = CORBA.ORB_init()
33  self._poa = self._orb.resolve_initial_references("RootPOA")
34  OpenRTM_aist.RTObject_impl.__init__(self, orb=self._orb, poa=self._poa)
35  self._error = False
36  self._ref = self._this()
37  self._eclist = []
38 
39  def on_execute(self, ec_id):
40  return RTC.RTC_OK
41 
42 class TestExtTrigExecutionContext(unittest.TestCase):
43  def setUp(self):
44  self._dfp = DFP()
45  self._dfp._poa._get_the_POAManager().activate()
47  #self.etec = ExtTrigExecutionContext(self._dfp._ref)
48 
49  def tearDown(self):
50  OpenRTM_aist.Manager.instance().shutdownManager()
51  return
52 
53  def test_tick(self):
54  pass
55 
56  def test_run(self):
57  self.assertEqual(self.etec.start(),RTC.RTC_OK)
58  self.assertEqual(self.etec.add_component(self._dfp._this()),RTC.RTC_OK)
59  self.assertEqual(self.etec.activate_component(self._dfp._this()),RTC.RTC_OK)
60  import time
61  time.sleep(1)
62  self.etec.tick()
63  self.etec.tick()
64  time.sleep(1)
65  self.assertEqual(self.etec.deactivate_component(self._dfp._this()),RTC.RTC_OK)
66  time.sleep(1)
67  self.assertEqual(self.etec.remove_component(self._dfp._this()),RTC.RTC_OK)
68  th = threading.Thread(target=self.stop)
69  th.start()
70  self.etec.tick()
71  if th:
72  th.join()
73  self._dfp._poa.deactivate_object(self._dfp._poa.servant_to_id(self.etec))
74  self._dfp._poa.deactivate_object(self._dfp._poa.servant_to_id(self._dfp))
75 
76  def stop(self):
77  self.etec.stop()
78 
79 ############### test #################
80 if __name__ == '__main__':
81  unittest.main()


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