From 0f51fb65f0bb9dba3b9b686ed5bd7cc5a0e22229 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 2 Sep 2021 08:51:53 +0200 Subject: [PATCH] in session_attached mode synchronize local NS with content of salome.[cm,rm,esm,dsm] --- src/KERNEL_PY/__init__.py | 18 ++++++++++++++---- src/Launcher/Test/TestSSLAttached.py | 26 ++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index d6820e89c..79dede599 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -262,11 +262,21 @@ def salome_init_without_session_attached(path=None, embedded=False): 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): """ diff --git a/src/Launcher/Test/TestSSLAttached.py b/src/Launcher/Test/TestSSLAttached.py index 69fbbe8ba..86cabad6c 100644 --- a/src/Launcher/Test/TestSSLAttached.py +++ b/src/Launcher/Test/TestSSLAttached.py @@ -61,7 +61,12 @@ pyscript.execute([],pickle.dumps(([],{}))) 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()) @@ -70,7 +75,12 @@ pyscript4.execute([],pickle.dumps(([],{}))) 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) @@ -78,7 +88,11 @@ pyscript2 = cont_prov.createPyScriptNode("testDSM","""import salome\nsalome.salo 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) @@ -86,7 +100,11 @@ pyscript3 = cont_prov.createPyScriptNode("testESM","""import salome\nsalome.salo 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() -- 2.39.2