3 # SALOME TestContainer : test of container creation and its life cycle
5 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 # File : TestComponentPy.py
27 # Author : Paul RASCLE, EDF
34 from omniORB import CORBA
37 from Utils_Identity import getShortHostName
41 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
43 #obtain a reference to the root naming context
44 obj = orb.resolve_initial_references("NameService")
45 rootContext = obj._narrow(CosNaming.NamingContext)
47 if rootContext is None:
48 print "Name Service Reference is invalid"
51 #resolve the name /Containers.dir/FactoryServerPy.object
52 machineName=getShortHostName()
53 containerName = "FactoryServerPy"
54 name = [CosNaming.NameComponent("Containers","dir"),
55 CosNaming.NameComponent(machineName,"dir"),
56 CosNaming.NameComponent(containerName,"object")]
59 obj = rootContext.resolve(name)
60 except CosNaming.NamingContext.NotFound, ex:
61 print containerName , " not found in Naming Service"
64 container = obj._narrow(Engines.Container)
65 print container.getHostName()
66 comp = container.load_impl("SALOME_TestComponentPy","SALOME_TestComponentPy")
67 print comp._get_instanceName()
69 comptest = comp._narrow(Engines.TestComponent)
72 print comptest.Coucou(1)