]> SALOME platform Git repositories - modules/kernel.git/blob - src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py
Salome HOME
CCAR: move DSC trace function from Calcium directory to DSC_Basic directory
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / TestLifeCycleCORBA.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 #from TestLifeCycleCORBA import *
23 #
24 import os
25 import Engines
26 import LifeCycleCORBA
27
28 import Utils_Identity
29 host  = Utils_Identity.getShortHostName()
30 #host = os.getenv( 'HOST' )
31
32 lcc = LifeCycleCORBA.LifeCycleCORBA()
33
34 try :
35     obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
36     comp=obj._narrow(Engines.TestComponent)
37     comp.Coucou(1)
38     param={}
39     #param['hostname']='cli76cc'
40     param['hostname']=host
41     param['container_name']='FactoryServer'
42     comp=lcc.FindOrLoad_Component(param,'SalomeTestComponent')
43     engine=lcc.FindComponent(param,'SalomeTestComponent')
44     engine.Coucou(1)
45 except :
46     print 'lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") failed'
47
48 import sys
49 import CORBA
50 import CosNaming
51 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
52 obj = orb.resolve_initial_references("NameService")
53 rootContext = obj._narrow(CosNaming.NamingContext)
54 context_name=[]
55 context_name.append(CosNaming.NameComponent( 'ContainerManager' , 'object' ) )
56 ContainerManager = rootContext.resolve( context_name )
57
58 try :
59     myContainerparamsCPP = Engines.MachineParameters( 'myContainer' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
60     computerlistCPP = [host]
61     containerCPP = ContainerManager.FindOrStartContainer( myContainerparamsCPP , computerlistCPP )
62     containerCPP.ping()
63     ComponentparamsCPP={}
64     ComponentparamsCPP['hostname']=host
65     ComponentparamsCPP['container_name']='myContainer'
66     compCPP=lcc.FindOrLoad_Component(ComponentparamsCPP,'SalomeTestComponent')
67     compCPP.Coucou(1)
68     engineCPP=lcc.FindComponent(ComponentparamsCPP,'SalomeTestComponent')
69     engineCPP.Coucou(1)
70 except :
71     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) C++ failed'
72
73 try :
74     myContainerparamsPy = Engines.MachineParameters( 'myContainerPy' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
75     computerlistPy = [host]
76     containerPy = ContainerManager.FindOrStartContainer( myContainerparamsPy , computerlistPy )
77     containerPy.ping()
78     ComponentparamsPy={}
79     ComponentparamsPy['hostname']=host
80     ComponentparamsPy['container_name']='myContainerPy'
81     compPy=lcc.FindOrLoad_Component(ComponentparamsPy,'SALOME_TestComponentPy')
82     compPy.Coucou(1)
83     enginePy=lcc.FindComponent(ComponentparamsPy,'SALOME_TestComponentPy')
84     enginePy.Coucou(1)
85 except :
86     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) Python failed'
87