Fix YacsLoaderTest::foreachs test

This commit is contained in:
Anthony Geay 2022-02-18 13:15:20 +01:00
parent 807a056cd8
commit f504886648
2 changed files with 63 additions and 9 deletions

View File

@ -23,6 +23,8 @@
#include "GEOM_Superv_i.hh" #include "GEOM_Superv_i.hh"
#include "SALOME_LifeCycleCORBA.hxx" #include "SALOME_LifeCycleCORBA.hxx"
#include "Utils_CorbaException.hxx" #include "Utils_CorbaException.hxx"
#include "SALOME_Fake_NamingService.hxx"
#include "SALOME_Container_i.hxx"
#include CORBA_SERVER_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOME_Session)
#include "SALOMEDSClient_ClientFactory.hxx" #include "SALOMEDSClient_ClientFactory.hxx"
@ -36,14 +38,13 @@ GEOM_Superv_i::GEOM_Superv_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId, PortableServer::ObjectId * contId,
const char *instanceName, const char *instanceName,
const char *interfaceName) : const char *interfaceName, bool withRegistry,
Engines_Component_i(orb, poa, contId, instanceName, interfaceName) SALOME_NamingService_Abstract *my_name_service):name_service(my_name_service),Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry)
{ {
MESSAGE("GEOM_Superv_i::GEOM_Superv_i"); MESSAGE("GEOM_Superv_i::GEOM_Superv_i");
_thisObj = this ; _thisObj = this ;
_id = _poa->activate_object(_thisObj); _id = _poa->activate_object(_thisObj);
name_service = new SALOME_NamingService(_orb);
//get RootPOA (the default) //get RootPOA (the default)
//myPOA = PortableServer::RefCountServantBase::_default_POA(); //myPOA = PortableServer::RefCountServantBase::_default_POA();
CORBA::Object_var anObj = _orb->resolve_initial_references("RootPOA"); CORBA::Object_var anObj = _orb->resolve_initial_references("RootPOA");
@ -3744,6 +3745,22 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSmoothingSurface (GEOM::GEOM_List_ptr t
/*@@ insert new functions before this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
GEOM_Superv_i_With_Session::GEOM_Superv_i_With_Session(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName):GEOM_Superv_i(orb,poa,contId,instanceName,interfaceName,true,new SALOME_NamingService(orb))
{
}
GEOM_Superv_i_Without_Session::GEOM_Superv_i_Without_Session(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName, SALOME_NamingService_Abstract *my_name_service):GEOM_Superv_i(orb,poa,contId,instanceName,interfaceName,false, my_name_service)
{
}
//===================================================================================== //=====================================================================================
// EXPORTED METHODS // EXPORTED METHODS
//===================================================================================== //=====================================================================================
@ -3758,9 +3775,23 @@ extern "C"
const char *instanceName, const char *instanceName,
const char * interfaceName) const char * interfaceName)
{ {
GEOM_Superv_i * myGEOM_Superv_i = new GEOM_Superv_i(orb, poa, contId, instanceName, interfaceName); CORBA::Object_var o = poa->id_to_reference(*contId);
//Don't understand the reason why this component is registered ??? Engines::Container_var cont = Engines::Container::_narrow(o);
// myGEOM_Superv_i->register_name("/myGEOM_Superv"); GEOM_Superv_i *myGEOM_Superv_i(nullptr);
return myGEOM_Superv_i->getId() ; if(cont->is_SSL_mode())
{
PortableServer::ServantBase *contPtr = poa->reference_to_servant(cont);
Abstract_Engines_Container_i *contPtrEff = dynamic_cast<Abstract_Engines_Container_i *>(contPtr);
SALOME_NamingService_Abstract *decoNS = new SALOME_NamingService_Abstract_Decorator(contPtrEff->getNS());
myGEOM_Superv_i = new GEOM_Superv_i_Without_Session(orb, poa, contId, instanceName, interfaceName,decoNS);
//Don't understand the reason why this component is registered ???
// myGEOM_Superv_i->register_name("/myGEOM_Superv");
return myGEOM_Superv_i->getId() ;
}
else
{
myGEOM_Superv_i = new GEOM_Superv_i_With_Session(orb, poa, contId, instanceName, interfaceName);
return myGEOM_Superv_i->getId() ;
}
} }
} }

View File

@ -52,7 +52,8 @@ public:
PortableServer::POA_ptr poa, PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId, PortableServer::ObjectId * contId,
const char *instanceName, const char *instanceName,
const char *interfaceName); const char *interfaceName, bool withRegistry,
SALOME_NamingService_Abstract *my_name_service);
~GEOM_Superv_i(); ~GEOM_Superv_i();
// generic method to be put in a super class // generic method to be put in a super class
@ -781,8 +782,9 @@ public:
GEOM::GEOM_Object_ptr MakeSmoothingSurface (GEOM::GEOM_List_ptr thelPoints); GEOM::GEOM_Object_ptr MakeSmoothingSurface (GEOM::GEOM_List_ptr thelPoints);
/*@@ insert new functions before this line @@ do not remove this line @@*/ /*@@ insert new functions before this line @@ do not remove this line @@*/
protected:
SALOME_NamingService_Abstract * name_service = nullptr;
private: private:
SALOME_NamingService * name_service;
GEOM::GEOM_Gen_var myGeomEngine; GEOM::GEOM_Gen_var myGeomEngine;
PortableServer::POA_var myPOA; PortableServer::POA_var myPOA;
@ -807,4 +809,25 @@ private:
#endif #endif
}; };
class GEOM_I_SUPERV_EXPORT GEOM_Superv_i_With_Session : public GEOM_Superv_i
{
public:
GEOM_Superv_i_With_Session(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName);
};
class GEOM_I_SUPERV_EXPORT GEOM_Superv_i_Without_Session : public GEOM_Superv_i
{
public:
GEOM_Superv_i_Without_Session(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName,
SALOME_NamingService_Abstract *my_name_service);
};
#endif #endif