1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 cm= salome.lcc.getContainerManager()
28 rm= salome.lcc.getResourcesManager()
30 class TestContainerManager(unittest.TestCase):
33 <!DOCTYPE ResourcesCatalog>
35 <machine hostname="claui2c6" >
37 <machine hostname="clt10br" >
42 self.container_name = "MyContainer-%s"%(os.getpid())
47 rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
48 p=LifeCycleCORBA.ContainerParameters(container_name=self.container_name,mode="start",resource_params=rp)
49 co=cm.GiveContainer( p )
50 host1=co.getHostName()
51 name1="/Containers/%s/%s" % (host1,self.container_name)
52 self.assertEqual(co._get_name(), name1)
53 co=cm.GiveContainer( p )
54 host2=co.getHostName()
55 name2="/Containers/%s/%s" % (host2,self.container_name)
56 self.assertEqual(co._get_name(), name2)
60 rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
61 p=LifeCycleCORBA.ContainerParameters(container_name=self.container_name,mode="get",resource_params=rp)
62 co=cm.GiveContainer( p )
63 host1=co.getHostName()
64 name1="/Containers/%s/%s" % (host1,self.container_name)
65 self.assertEqual(co._get_name(), name1)
66 co=cm.GiveContainer( p )
67 host2=co.getHostName()
68 name2="/Containers/%s/%s" % (host2,self.container_name)
69 self.assertEqual(co._get_name(), name2)
73 rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
74 p=LifeCycleCORBA.ContainerParameters(container_name=self.container_name,mode="getorstart",resource_params=rp)
75 co=cm.GiveContainer( p )
76 host1=co.getHostName()
77 name1="/Containers/%s/%s" % (host1,self.container_name)
78 self.assertEqual(co._get_name(), name1)
79 co=cm.GiveContainer( p )
80 host2=co.getHostName()
81 name2="/Containers/%s/%s" % (host2,self.container_name)
82 self.assertEqual(co._get_name(), name2)
85 if __name__ == '__main__':
86 #suite = unittest.TestLoader().loadTestsFromTestCase(TestContainerManager)
87 #unittest.TextTestRunner().run(suite)