1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2016 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
26 cm= salome.lcc.getContainerManager()
27 rm= salome.lcc.getResourcesManager()
29 class TestContainerManager(unittest.TestCase):
32 <!DOCTYPE ResourcesCatalog>
34 <machine hostname="claui2c6" >
36 <machine hostname="clt10br" >
45 rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
46 p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="start",resource_params=rp)
47 co=cm.GiveContainer( p )
48 host1=co.getHostName()
49 name1="/Containers/%s/MyContainer" % host1
50 self.assertEqual(co._get_name(), name1)
51 co=cm.GiveContainer( p )
52 host2=co.getHostName()
53 name2="/Containers/%s/MyContainer" % host2
54 self.assertEqual(co._get_name(), name2)
58 rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
59 p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="get",resource_params=rp)
60 co=cm.GiveContainer( p )
61 host1=co.getHostName()
62 name1="/Containers/%s/MyContainer" % host1
63 self.assertEqual(co._get_name(), name1)
64 co=cm.GiveContainer( p )
65 host2=co.getHostName()
66 name2="/Containers/%s/MyContainer" % host2
67 self.assertEqual(co._get_name(), name2)
71 rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
72 p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="getorstart",resource_params=rp)
73 co=cm.GiveContainer( p )
74 host1=co.getHostName()
75 name1="/Containers/%s/MyContainer" % host1
76 self.assertEqual(co._get_name(), name1)
77 co=cm.GiveContainer( p )
78 host2=co.getHostName()
79 name2="/Containers/%s/MyContainer" % host2
80 self.assertEqual(co._get_name(), name2)
83 if __name__ == '__main__':
84 #suite = unittest.TestLoader().loadTestsFromTestCase(TestContainerManager)
85 #unittest.TextTestRunner().run(suite)