Salome HOME
0020303: Install some .py in the correct way - integrate patch from E.Adam.
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / Test / TestLifeCycleCORBA_SWIG.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #  File   : TestLifeCycleCORBA_SWIG.py
23 #  Author : Paul RASCLE, EDF
24 #  Module : SALOME
25 #  $Header$
26 #
27 import sys, os,signal,string,commands
28 import runSalome
29 import setenv
30 import orbmodule
31 import TestKiller
32 import addToKillList
33
34 # get SALOME environment :
35
36 args, modules_list, modules_root_dir = setenv.get_config()
37 setenv.set_env(args, modules_list, modules_root_dir)
38
39 # set environment for trace in logger
40 # (with file, servers may be killed before the write to the file...)
41
42 #os.environ["SALOME_trace"] = "file:/tmp/traceUnitTest.log"
43 #os.environ["SALOME_trace"] = "local"
44 os.environ["SALOME_trace"] = "with_logger"
45
46 # launch CORBA naming server
47
48 clt=orbmodule.client()
49
50 # launch CORBA logger server
51
52 myServer=runSalome.LoggerServer(args)
53 myServer.run()
54 clt.waitLogger("Logger")
55
56 # launch notify server
57
58 myServer=runSalome.NotifyServer(args,modules_root_dir)
59 myServer.run()
60
61 # launch registry server
62
63 myServer=runSalome.RegistryServer(args)
64 myServer.run()
65 clt.waitNS("/Registry")
66
67 # launch module catalog server
68
69 cataServer=runSalome.CatalogServer(args)
70 cataServer.setpath(modules_list,modules_root_dir)
71 cataServer.run()
72 clt.waitNS("/Kernel/ModulCatalog")
73
74 # launch container manager server
75
76 myCmServer = runSalome.LauncherServer(args)
77 myCmServer.setpath(modules_list,modules_root_dir)
78 myCmServer.run()
79 clt.waitNS("/SalomeLauncher")
80
81 # execute Unit Test
82
83 command = ['TestLifeCycleCORBA']
84 ret = os.spawnvp(os.P_WAIT, command[0], command)
85
86 import LifeCycleCORBA_SWIGTest
87 import unittest
88 unittest.TextTestRunner(verbosity=2).run(LifeCycleCORBA_SWIGTest.suite())
89
90 # kill containers created by the Container Manager
91
92 import Engines
93 launcher = clt.waitNS("/SalomeLauncher",Engines.SalomeLauncher)
94 launcher.Shutdown()
95
96 # kill Test process
97
98 addToKillList.killList()
99
100 TestKiller.killProcess(runSalome.process_id)