Salome HOME
Compilation under Windows: add missing header
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / Test / LifeCycleCORBA_SWIGTest.py
index 347524308b40ad0891da4b7b3a98dec08264e0f2..75282fb74731553a5ac8b01c9325668b37d0442b 100644 (file)
@@ -1,35 +1,34 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 #
-#  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-# 
-#  This library is free software; you can redistribute it and/or 
-#  modify it under the terms of the GNU Lesser General Public 
-#  License as published by the Free Software Foundation; either 
-#  version 2.1 of the License. 
-# 
-#  This library is distributed in the hope that it will be useful, 
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-#  Lesser General Public License for more details. 
-# 
-#  You should have received a copy of the GNU Lesser General Public 
-#  License along with this library; if not, write to the Free Software 
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-# 
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
 #
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
 #
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
 #  File   : LifeCycleCORBA_SWIGTest.py
 #  Author : Paul RASCLE, EDF
 #  Module : SALOME
 #  $Header$
-
+#
 import sys
 import unittest
 from omniORB import CORBA
-import PYHELLO_ORB
-import HELLO_ORB
 import Utils_Identity
 import Engines
 
@@ -41,12 +40,12 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
 
     def tearDown(self):
         pass
-    
+
     def test001_FindOrLoad_Component_LaunchContainer(self):
         """
         get a local container (no hostname given),
         load an engine, check that the CORBA object is not null.
-        check narrow        
+        check narrow
         """
         containerName = "swMyContainer"
         comp=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent")
@@ -59,7 +58,7 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         """
         Check FindOrLoad_Component.
         Call 2 times FindOrLoad_Component with the same parameters,
-        check if we get the same engine      
+        check if we get the same engine
         """
         containerName = "swMyContainer"
         cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent")
@@ -86,7 +85,7 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         self.assertNotEqual(cp1,None)
         m1=cp1._narrow(Engines.TestComponent)
         self.assertNotEqual(m1,None)
-        pass        
+        pass
 
     def test004_FindOrLoad_Component_PythonSameInstance(self):
         """
@@ -112,7 +111,7 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         """
         Check FindOrLoad_Component with a component name not in catalog.
         See list of catalog given to module catalog server.
-        Here, we work with KERNEL_SRC/resources/KERNELCatalog.xml that contains 
+        Here, we work with KERNEL_SRC/resources/KERNELCatalog.xml that contains
         only KERNEL, SalomeTestComponent and SALOME_TestComponentPy
         """
         containerName = "swMyContainer"
@@ -166,9 +165,9 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         self.assertEqual(hostname1,hostname2)
         pidc1=c1.getPID()
         pidc2=c2.getPID()
-        self.assertEqual(pidc1,pidc2)        
+        self.assertEqual(pidc1,pidc2)
         pass
-    
+
     def test008_FindOrLoad_Component_UnknownMachine(self):
         """
         Check FindOrLoad_Component: check behaviour when ask for an unknown
@@ -176,10 +175,13 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         """
         containerName = "aFarAwayContainer"
         containerName += "/swTheContainer"
-        cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent")
+        try:
+            cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent")
+        except RuntimeError as ex :
+            self.assertEqual(ex.args[0],'unknown host')
         pass
-       
-    
+
+
 def suite():
     return unittest.makeSuite(LifeCycleCORBA_SWIGTest,'test')
 
@@ -187,6 +189,5 @@ def main():
     return unittest.TextTestRunner().run(suite())
 
 if __name__ == '__main__':
-    unittest.TextTestRunner(verbosity=2).run(suite())
-    pass
-
+    #unittest.TextTestRunner(verbosity=2).run(suite())
+    unittest.main()