Salome HOME
3d71bf21b4de2853a98d33ed6c1b146f21d1d7c1
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / TestLifeCycleCORBA.py
1
2 #from TestLifeCycleCORBA import *
3
4 import os
5 import Engines
6 import LifeCycleCORBA
7
8 import Utils_Identity
9 host  = Utils_Identity.getShortHostName()
10 #host = os.getenv( 'HOST' )
11
12 lcc = LifeCycleCORBA.LifeCycleCORBA()
13
14 try :
15     obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
16     comp=obj._narrow(Engines.TestComponent)
17     comp.Coucou(1)
18     param={}
19     #param['hostname']='cli76cc'
20     param['hostname']=host
21     param['container_name']='FactoryServer'
22     comp=lcc.FindOrLoad_Component(param,'SalomeTestComponent')
23     engine=lcc.FindComponent(param,'SalomeTestComponent')
24     engine.Coucou(1)
25 except :
26     print 'lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") failed'
27
28 import sys
29 import CORBA
30 import CosNaming
31 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
32 obj = orb.resolve_initial_references("NameService")
33 rootContext = obj._narrow(CosNaming.NamingContext)
34 context_name=[]
35 context_name.append(CosNaming.NameComponent( 'ContainerManager' , 'object' ) )
36 ContainerManager = rootContext.resolve( context_name )
37
38 try :
39     myContainerparamsCPP = Engines.MachineParameters( 'myContainer' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
40     computerlistCPP = [host]
41     containerCPP = ContainerManager.FindOrStartContainer( myContainerparamsCPP , computerlistCPP )
42     containerCPP.ping()
43     ComponentparamsCPP={}
44     ComponentparamsCPP['hostname']=host
45     ComponentparamsCPP['container_name']='myContainer'
46     compCPP=lcc.FindOrLoad_Component(ComponentparamsCPP,'SalomeTestComponent')
47     compCPP.Coucou(1)
48     engineCPP=lcc.FindComponent(ComponentparamsCPP,'SalomeTestComponent')
49     engineCPP.Coucou(1)
50 except :
51     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) C++ failed'
52
53 try :
54     myContainerparamsPy = Engines.MachineParameters( 'myContainerPy' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
55     computerlistPy = [host]
56     containerPy = ContainerManager.FindOrStartContainer( myContainerparamsPy , computerlistPy )
57     containerPy.ping()
58     ComponentparamsPy={}
59     ComponentparamsPy['hostname']=host
60     ComponentparamsPy['container_name']='myContainerPy'
61     compPy=lcc.FindOrLoad_Component(ComponentparamsPy,'SALOME_TestComponentPy')
62     compPy.Coucou(1)
63     enginePy=lcc.FindComponent(ComponentparamsPy,'SALOME_TestComponentPy')
64     enginePy.Coucou(1)
65 except :
66     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) Python failed'
67