import KernelBasis
nsAbroad = orb.string_to_object( KernelBasis.getIOROfEmbeddedNS() )
import SALOME
- cm = orb.string_to_object( nsAbroad.Resolve("/ContainerManager").decode() )
- rm = orb.string_to_object( nsAbroad.Resolve("/ResourcesManager").decode() )
+ CM_NAME_IN_NS = "/ContainerManager"
+ cm = orb.string_to_object( nsAbroad.Resolve(CM_NAME_IN_NS).decode() )
+ naming_service.Register(cm,CM_NAME_IN_NS)
+ RM_NAME_IN_NS = "/ResourcesManager"
+ rm = orb.string_to_object( nsAbroad.Resolve(RM_NAME_IN_NS).decode() )
+ naming_service.Register(rm,RM_NAME_IN_NS)
+ #
+ DSM_NAME_IN_NS = "/DataServerManager"
lcc = StandAloneLifecyle(cm,rm)
- dsm = orb.string_to_object( nsAbroad.Resolve("/DataServerManager").decode() )
- esm = orb.string_to_object( nsAbroad.Resolve("/ExternalServers").decode() )
+ dsm = orb.string_to_object( nsAbroad.Resolve(DSM_NAME_IN_NS).decode() )
+ naming_service.Register(dsm,DSM_NAME_IN_NS)
+ #
+ ESM_NAME_IN_NS = "/ExternalServers"
+ esm = orb.string_to_object( nsAbroad.Resolve(ESM_NAME_IN_NS).decode() )
+ naming_service.Register(esm,ESM_NAME_IN_NS)
def salome_init_with_session(path=None, embedded=False):
"""
cm_to_test = orb.object_to_string(pickle.loads(pyscript.execute(["the_cm"],pickle.dumps(([],{}))))[0])
if cm_to_test!=ref_cm:
raise AssertionError("The ContainerManager of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
-del pyscript,ref_cm,cm_to_test
+pyscriptt = cont_prov.createPyScriptNode("testCM2","""import salome\nsalome.salome_init()\nthe_cm=salome.naming_service.Resolve("/ContainerManager")""")
+pyscriptt.execute([],pickle.dumps(([],{})))
+cm_to_testt = orb.object_to_string(pickle.loads(pyscriptt.execute(["the_cm"],pickle.dumps(([],{}))))[0])
+if cm_to_testt!=ref_cm:
+ raise AssertionError("The ContainerManager of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
+del pyscript,pyscriptt,ref_cm,cm_to_test,cm_to_testt
# Testing for RM
ref_rm = orb.object_to_string(salome.lcc.getResourcesManager())
rm_to_test = orb.object_to_string(pickle.loads(pyscript4.execute(["the_rm"],pickle.dumps(([],{}))))[0])
if rm_to_test!=ref_rm:
raise AssertionError("The ResourcesManager of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
-del pyscript4,ref_rm,rm_to_test
+pyscript44 = cont_prov.createPyScriptNode("testRM2","""import salome\nsalome.salome_init()\nthe_rm=salome.naming_service.Resolve("/ResourcesManager")""")
+pyscript44.execute([],pickle.dumps(([],{})))
+rm_to_testt = orb.object_to_string(pickle.loads(pyscript44.execute(["the_rm"],pickle.dumps(([],{}))))[0])
+if rm_to_testt!=ref_rm:
+ raise AssertionError("The ResourcesManager of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
+del pyscript4,pyscript44,ref_rm,rm_to_test,rm_to_testt
# Testing for DSM
ref_dsm = orb.object_to_string(salome.dsm)
dsm_to_test = orb.object_to_string(pickle.loads(pyscript2.execute(["the_dsm"],pickle.dumps(([],{}))))[0])
if dsm_to_test!=ref_dsm:
raise AssertionError("The DataServerManager of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
-del pyscript2,ref_dsm,dsm_to_test
+pyscript22 = cont_prov.createPyScriptNode("testDSM","""import salome\nsalome.salome_init()\nthe_dsm=salome.naming_service.Resolve("/DataServerManager")""")
+dsm_to_test_2 = orb.object_to_string(pickle.loads(pyscript22.execute(["the_dsm"],pickle.dumps(([],{}))))[0])
+if dsm_to_test_2!=ref_dsm:
+ raise AssertionError("The DataServerManager of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
+del pyscript2,pyscript22,ref_dsm,dsm_to_test,dsm_to_test_2
# Testing for ESM
ref_esm = orb.object_to_string(salome.esm)
esm_to_test = orb.object_to_string(pickle.loads(pyscript3.execute(["the_esm"],pickle.dumps(([],{}))))[0])
if esm_to_test!=ref_esm:
raise AssertionError("The ExternalServerLauncher of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
-del pyscript3,ref_esm,esm_to_test
+pyscript33 = cont_prov.createPyScriptNode("testDSM","""import salome\nsalome.salome_init()\nthe_esm=salome.naming_service.Resolve("/ExternalServers")""")
+esm_to_test_2 = orb.object_to_string(pickle.loads(pyscript33.execute(["the_esm"],pickle.dumps(([],{}))))[0])
+if esm_to_test_2!=ref_esm:
+ raise AssertionError("The ExternalServerLauncher of salome_init launched in SALOME_Container_No_NS_Serv is not those in current process !")
+del pyscript3,pyscript33,ref_esm,esm_to_test,esm_to_test_2
# End of test
cont_prov.Shutdown()