Back to index

salome-kernel  6.5.0
testcontainermanager.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 # This library is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU Lesser General Public
00006 # License as published by the Free Software Foundation; either
00007 # version 2.1 of the License.
00008 #
00009 # This library is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 # Lesser General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU Lesser General Public
00015 # License along with this library; if not, write to the Free Software
00016 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 #
00018 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 #
00020 
00021 import unittest
00022 import salome
00023 import Engines
00024 import LifeCycleCORBA
00025 salome.salome_init()
00026 cm= salome.lcc.getContainerManager()
00027 rm= salome.lcc.getResourcesManager()
00028 
00029 class TestContainerManager(unittest.TestCase):
00030   """
00031 Test with catalog :
00032 <!DOCTYPE ResourcesCatalog>
00033 <resources>
00034    <machine hostname="claui2c6" >
00035    </machine>
00036    <machine hostname="clt10br" >
00037    </machine>
00038 </resources>
00039 """
00040   def setUp(self):
00041     pass
00042 
00043   def test0(self):
00044     """"""
00045     rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
00046     p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="start",resource_params=rp)
00047     co=cm.GiveContainer( p )
00048     self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer")
00049     co=cm.GiveContainer( p )
00050     self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer")
00051 
00052   def test1(self):
00053     """"""
00054     rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
00055     p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="get",resource_params=rp)
00056     co=cm.GiveContainer( p )
00057     self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer")
00058     co=cm.GiveContainer( p )
00059     self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer")
00060 
00061   def test2(self):
00062     """"""
00063     rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"])
00064     p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="getorstart",resource_params=rp)
00065     co=cm.GiveContainer( p )
00066     self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer")
00067     co=cm.GiveContainer( p )
00068     self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer")
00069 
00070 
00071 if __name__ == '__main__':
00072   suite = unittest.TestLoader().loadTestsFromTestCase(TestContainerManager)
00073   unittest.TextTestRunner().run(suite)
00074