Salome HOME
SWP12966 - MutiFile is not saved correctly
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / TestLifeCycleCORBA.py
1 # Copyright (C) 2005  OPEN CASCADE, CEA, EDF R&D, LEG
2 #           PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either 
6 # version 2.1 of the License.
7
8 # This library is distributed in the hope that it will be useful 
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 # Lesser General Public License for more details.
12
13 # You should have received a copy of the GNU Lesser General Public  
14 # License along with this library; if not, write to the Free Software 
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
19
20 #from TestLifeCycleCORBA import *
21
22 import os
23 import Engines
24 import LifeCycleCORBA
25
26 import Utils_Identity
27 host  = Utils_Identity.getShortHostName()
28 #host = os.getenv( 'HOST' )
29
30 lcc = LifeCycleCORBA.LifeCycleCORBA()
31
32 try :
33     obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
34     comp=obj._narrow(Engines.TestComponent)
35     comp.Coucou(1)
36     param={}
37     #param['hostname']='cli76cc'
38     param['hostname']=host
39     param['container_name']='FactoryServer'
40     comp=lcc.FindOrLoad_Component(param,'SalomeTestComponent')
41     engine=lcc.FindComponent(param,'SalomeTestComponent')
42     engine.Coucou(1)
43 except :
44     print 'lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") failed'
45
46 import sys
47 import CORBA
48 import CosNaming
49 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
50 obj = orb.resolve_initial_references("NameService")
51 rootContext = obj._narrow(CosNaming.NamingContext)
52 context_name=[]
53 context_name.append(CosNaming.NameComponent( 'ContainerManager' , 'object' ) )
54 ContainerManager = rootContext.resolve( context_name )
55
56 try :
57     myContainerparamsCPP = Engines.MachineParameters( 'myContainer' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
58     computerlistCPP = [host]
59     containerCPP = ContainerManager.FindOrStartContainer( myContainerparamsCPP , computerlistCPP )
60     containerCPP.ping()
61     ComponentparamsCPP={}
62     ComponentparamsCPP['hostname']=host
63     ComponentparamsCPP['container_name']='myContainer'
64     compCPP=lcc.FindOrLoad_Component(ComponentparamsCPP,'SalomeTestComponent')
65     compCPP.Coucou(1)
66     engineCPP=lcc.FindComponent(ComponentparamsCPP,'SalomeTestComponent')
67     engineCPP.Coucou(1)
68 except :
69     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) C++ failed'
70
71 try :
72     myContainerparamsPy = Engines.MachineParameters( 'myContainerPy' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
73     computerlistPy = [host]
74     containerPy = ContainerManager.FindOrStartContainer( myContainerparamsPy , computerlistPy )
75     containerPy.ping()
76     ComponentparamsPy={}
77     ComponentparamsPy['hostname']=host
78     ComponentparamsPy['container_name']='myContainerPy'
79     compPy=lcc.FindOrLoad_Component(ComponentparamsPy,'SALOME_TestComponentPy')
80     compPy.Coucou(1)
81     enginePy=lcc.FindComponent(ComponentparamsPy,'SALOME_TestComponentPy')
82     enginePy.Coucou(1)
83 except :
84     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) Python failed'
85