Back to index

salome-kernel  6.5.0
TestLifeCycleCORBA.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 #from TestLifeCycleCORBA import *
00025 #
00026 import os
00027 import Engines
00028 import LifeCycleCORBA
00029 
00030 import Utils_Identity
00031 host  = Utils_Identity.getShortHostName()
00032 #host = os.getenv( 'HOST' )
00033 
00034 lcc = LifeCycleCORBA.LifeCycleCORBA()
00035 
00036 try :
00037     obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
00038     comp=obj._narrow(Engines.TestComponent)
00039     comp.Coucou(1)
00040     param={}
00041     #param['hostname']='cli76cc'
00042     param['hostname']=host
00043     param['container_name']='FactoryServer'
00044     comp=lcc.FindOrLoad_Component(param,'SalomeTestComponent')
00045     engine=lcc.FindComponent(param,'SalomeTestComponent')
00046     engine.Coucou(1)
00047 except :
00048     print 'lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") failed'
00049 
00050 import sys
00051 import CORBA
00052 import CosNaming
00053 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
00054 obj = orb.resolve_initial_references("NameService")
00055 rootContext = obj._narrow(CosNaming.NamingContext)
00056 context_name=[]
00057 context_name.append(CosNaming.NameComponent( 'ContainerManager' , 'object' ) )
00058 ContainerManager = rootContext.resolve( context_name )
00059 
00060 try :
00061     myContainerparamsCPP = Engines.MachineParameters( 'myContainer' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
00062     computerlistCPP = [host]
00063     containerCPP = ContainerManager.FindOrStartContainer( myContainerparamsCPP , computerlistCPP )
00064     containerCPP.ping()
00065     ComponentparamsCPP={}
00066     ComponentparamsCPP['hostname']=host
00067     ComponentparamsCPP['container_name']='myContainer'
00068     compCPP=lcc.FindOrLoad_Component(ComponentparamsCPP,'SalomeTestComponent')
00069     compCPP.Coucou(1)
00070     engineCPP=lcc.FindComponent(ComponentparamsCPP,'SalomeTestComponent')
00071     engineCPP.Coucou(1)
00072 except :
00073     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) C++ failed'
00074 
00075 try :
00076     myContainerparamsPy = Engines.MachineParameters( 'myContainerPy' , host , 'osf' , 0 , 0 , 0 , 0 , 0 )
00077     computerlistPy = [host]
00078     containerPy = ContainerManager.FindOrStartContainer( myContainerparamsPy , computerlistPy )
00079     containerPy.ping()
00080     ComponentparamsPy={}
00081     ComponentparamsPy['hostname']=host
00082     ComponentparamsPy['container_name']='myContainerPy'
00083     compPy=lcc.FindOrLoad_Component(ComponentparamsPy,'SALOME_TestComponentPy')
00084     compPy.Coucou(1)
00085     enginePy=lcc.FindComponent(ComponentparamsPy,'SALOME_TestComponentPy')
00086     enginePy.Coucou(1)
00087 except :
00088     print 'ContainerManager.FindOrStartContainer( myContainerparams , computerlist ) Python failed'
00089