return true;
}
-bool TEST_getStudyManager() {
- SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudyManager()->NewStudy("kerneltest");
+bool TEST_getStudy() {
+ SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudy();
if ( CORBA::is_nil(myTestStudy) ) {
return false;
}
myTestStudy->SetString("material","wood");
myTestStudy->SetReal("volume",3.23);
- // The study is characterized by an ID
- int myTestStudyId = myTestStudy->StudyId();
- LOG("TestComponentImpl::testkernel: study id = "<<myTestStudyId);
+ // The study with properties was opened
+ LOG("TestComponentImpl::testkernel: study with properties was opened");
return true;
}
int main (int argc, char * argv[]) {
TEST_corba();
TEST_getLifeCycleCORBA();
- TEST_getStudyManager();
+ TEST_getStudy();
TEST_getSalomeLauncher();
return 0;
}
CPPUNIT_ASSERT( strcmp(coucou_res, coucou_ref) == 0 );
}
-void KernelHelpersUnitTests::TEST_getStudyManager() {
- SALOMEDS::StudyManager_var studyManager = KERNEL::getStudyManager();
-
- #ifndef ALLOW_MULTI_STUDIES
- SALOMEDS::ListOfOpenStudies_var _list_open_studies = studyManager->GetOpenStudies();
- for (unsigned int ind = 0; ind < _list_open_studies->length();ind++)
- {
- LOG("Close study : " << _list_open_studies[ind]);
- SALOMEDS::Study_var study = studyManager->GetStudyByName(_list_open_studies[0]);
- if(study)
- studyManager->Close(study);
- }
- #endif
-
- SALOMEDS::Study_ptr myTestStudy = studyManager->NewStudy("kerneltest");
+void KernelHelpersUnitTests::TEST_getStudy() {
+ SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudy();
CPPUNIT_ASSERT(!CORBA::is_nil(myTestStudy));
// One can use the study to store some general properties
myTestStudy->SetString("material","wood");
myTestStudy->SetReal("volume",3.23);
- // The study is characterized by an ID
- int myTestStudyId = myTestStudy->StudyId();
- LOG("TestComponentImpl::testkernel: study id = "<<myTestStudyId);
+ // The study with properties was opened
+ LOG("TestComponentImpl::testkernel: study with properties was opened");
}
void KernelHelpersUnitTests::TEST_getSalomeLauncher() {
CPPUNIT_TEST_SUITE( KernelHelpersUnitTests );
CPPUNIT_TEST( TEST_corba );
CPPUNIT_TEST( TEST_getLifeCycleCORBA );
- CPPUNIT_TEST( TEST_getStudyManager );
+ CPPUNIT_TEST( TEST_getStudy );
CPPUNIT_TEST( TEST_getSalomeLauncher );
CPPUNIT_TEST_SUITE_END();
void TEST_corba();
void TEST_getLifeCycleCORBA();
- void TEST_getStudyManager();
+ void TEST_getStudy();
void TEST_getSalomeLauncher();
};
//
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
-#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS_AttributeName_i.hxx"
+#include "SALOME_NamingService.hxx"
#include "utilities.h"
#include "HDFOI.hxx"
* Purpose :
*/
//============================================================================
-static void Test(SALOMEDS::StudyManager_ptr myStudyMgr )
+static void Test(SALOMEDS::Study_ptr myStudy)
{
try {
char* name;
- MESSAGE("Create New Study Study1");
- SALOMEDS::Study_var myStudy = myStudyMgr->NewStudy("Study1");
-
+
MESSAGE("Create Builder ");
SALOMEDS::StudyBuilder_var StudyBuild = myStudy->NewBuilder();
-
// Create new components
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var Name;
StudyBuild->Undo();
// Study should have no trace of object mesh_cylinder
DumpStudy(myStudy);
-
-
- //myStudyMgr->Open ((char*)name);
- //MESSAGE("Name " << name);
-
- // GetOpenStudies
- MESSAGE("GetOpenStudies list");
- SALOMEDS::ListOfOpenStudies_var _list_open_studies = myStudyMgr->GetOpenStudies();
-
- for (unsigned int ind = 0; ind < _list_open_studies->length();ind++)
- {
- MESSAGE("Open studies list : " << _list_open_studies[ind]);
- }
-
-
- // GetStudyByName
- SALOMEDS::Study_var myStudy1 =myStudyMgr->GetStudyByName(_list_open_studies[0]);
- MESSAGE("GetStudyByName done");
// Save as
- myStudyMgr->SaveAs("/home/edeville/Study1.hdf",myStudy1, false);
+ myStudy->SaveAs("/home/edeville/Study1.hdf", false);
// Get Persistent Reference of the study test
- name = myStudy1->GetPersistentReference();
+ name = myStudy->GetPersistentReference();
MESSAGE("Persitent Reference of the study " << name);
// Get Transient Reference of the study test
- name = myStudy1->GetTransientReference();
+ name = myStudy->GetTransientReference();
MESSAGE("Transient Reference of the study " << name);
// FindComponent Test
- SALOMEDS::SComponent_var compo = myStudy1->FindComponent("GEOM");
+ SALOMEDS::SComponent_var compo = myStudy->FindComponent("GEOM");
// Get ComponentDataType test
MESSAGE("Find ComponentDataType of compo");
name = compo->ComponentDataType();
- MESSAGE("-> ComponentDataType is "<<name);
+ MESSAGE("-> ComponentDataType is "<<name);
-
// FindComponentID Test
- SALOMEDS::SComponent_var compo1 = myStudy1->FindComponentID("0:1:2");
+ SALOMEDS::SComponent_var compo1 = myStudy->FindComponentID("0:1:2");
// Get ComponentDataType test
MESSAGE("Find ComponentDataType of compo1");
name = compo1->ComponentDataType();
- MESSAGE("-> ComponentDataType is "<<name);
-
+ MESSAGE("-> ComponentDataType is "<<name);
+
// FindObject Test
- SALOMEDS::SObject_var objn = myStudy1->FindObject("cylinder_0");
+ SALOMEDS::SObject_var objn = myStudy->FindObject("cylinder_0");
// Test FindAttribute function : get AttributeName attribute
MESSAGE("Find Name in object objn");
if (objn->FindAttribute(anAttr, "AttributeName")) {
}
// FindObjectID Test
- SALOMEDS::SObject_var obj = myStudy1->FindObjectID("0:1:2:1:1");
+ SALOMEDS::SObject_var obj = myStudy->FindObjectID("0:1:2:1:1");
// Test FindAttribute function : get AttributeName attribute
MESSAGE("Find Name in object obj");
if (obj->FindAttribute(anAttr, "AttributeName")) {
else {
MESSAGE("-> Name is not found");
}
- //DumpStudy(myStudy1);
+ //DumpStudy(myStudy);
}
catch(HDFexception)
{
SALOME_NamingService * salomens = new SALOME_NamingService(orb);
- MESSAGE("Find StudyManager ");
- CORBA::Object_ptr obj2 = salomens->Resolve("myStudyManager");
- SALOMEDS::StudyManager_var myStudyMgr = SALOMEDS::StudyManager::_narrow(obj2);
+ MESSAGE("Create New Study ");
+ CORBA::Object_ptr obj2 = salomens->Resolve("Study");
+ SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj2);
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
pman->activate();
// Test basic services
- Test(myStudyMgr);
+ Test(myStudy);
orb->run();
orb->destroy();
${CMAKE_CURRENT_SOURCE_DIR}/../../DF
${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDSImpl
${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDSImpl/Test
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../GenericObj
${PROJECT_BINARY_DIR}/idl
)
SalomeDSImpl
SalomeDSClient
SalomeDS
+ SalomeGenericObj
SalomeIDLKernel
)
#include "SALOMEDSTest.hxx"
-
-#include "SALOMEDS_StudyManager_i.hxx"
#include "utilities.h"
#include "Utils_SINGLETON.hxx"
#include "Utils_ORB_INIT.hxx"
#include <cstdlib>
#include "SALOMEDSClient.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
-#include "SALOMEDS_StudyManager.hxx"
+#include "SALOMEDS_Study.hxx"
#include "SALOMEDS_SObject.hxx"
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
_orb = init(argc , argv ) ;
SALOME_NamingService NS(_orb);
- CORBA::Object_var obj = NS.Resolve( "/myStudyManager" );
- _sm = SALOMEDS::StudyManager::_narrow( obj );
+ CORBA::Object_var obj = NS.Resolve( "/Study" );
+ _study = SALOMEDS::Study::_narrow( obj );
- CPPUNIT_ASSERT( !CORBA::is_nil(_sm) );
+ CPPUNIT_ASSERT( !CORBA::is_nil(_study) );
}
// ============================================================================
void SALOMEDSTest::tearDown()
{
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
- std::vector<std::string> v = sm->GetOpenStudies();
- for(int i = 0; i<v.size(); i++) {
- _PTR(Study) study = sm->GetStudyByName(v[i]);
- if(study)
- sm->Close(study);
- }
+ _PTR(Study) study ( new SALOMEDS_Study(_study) );
+ if(study)
+ study->Clear();
}
#include "SALOMEDSTest_AttributeComment.cxx"
#include "SALOMEDSTest_SObject.cxx"
#include "SALOMEDSTest_Study.cxx"
#include "SALOMEDSTest_StudyBuilder.cxx"
-#include "SALOMEDSTest_StudyManager.cxx"
#include "SALOMEDSTest_UseCase.cxx"
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
_orb = init(argc , argv ) ;
SALOME_NamingService NS(_orb);
- CORBA::Object_var obj = NS.Resolve( "/myStudyManager_embedded" );
- _sm = SALOMEDS::StudyManager::_narrow( obj );
+ CORBA::Object_var obj = NS.Resolve( "/Study_embedded" );
+ _study = SALOMEDS::Study::_narrow( obj );
- CPPUNIT_ASSERT( !CORBA::is_nil(_sm) );
+ CPPUNIT_ASSERT( !CORBA::is_nil(_study) );
}
CPPUNIT_TEST( testSObject );
CPPUNIT_TEST( testStudy );
CPPUNIT_TEST( testStudyBuilder );
- CPPUNIT_TEST( testStudyManager );
CPPUNIT_TEST( testUseCase );
void testSObject();
void testStudy();
void testStudyBuilder();
- void testStudyManager();
void testUseCase();
protected:
-SALOMEDS::StudyManager_var _sm;
-CORBA::ORB_var _orb;
+SALOMEDS::Study_var _study;
+CORBA::ORB_var _orb;
};
CPPUNIT_TEST( testStudy );
CPPUNIT_TEST( testStudyBuilder );
CPPUNIT_TEST( testChildIterator );
- CPPUNIT_TEST( testStudyManager );
CPPUNIT_TEST( testUseCase );
CPPUNIT_TEST_SUITE_END();
void SALOMEDSTest::testAttributeComment()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm(new SALOMEDS_StudyManager(_sm));
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- std::vector<std::string> ost(sm->GetOpenStudies());
- _PTR(Study) study;
- if(ost.empty())
- study = sm->NewStudy("Test");
- else
- study = sm->GetStudyByName(ost[0]);
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- sm->Close(study);
+ study->Clear();
}
void SALOMEDSTest::testAttributeDrawable()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm(new SALOMEDS_StudyManager(_sm));
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(!_attr->IsDrawable());
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeExpandable()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(_attr->IsExpandable());
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeExternalFileDef()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeFileType()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
-
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeFlags()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(!_attr->Get(4));
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeGraphic()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetVisibility(-1, true);
CPPUNIT_ASSERT(_attr->GetVisibility(-1));
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeIOR()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(value.empty());
- std::string ior = _orb->object_to_string(_sm);
+ std::string ior = _orb->object_to_string(_study);
//Check method SetValue
_attr->SetValue(ior);
CPPUNIT_ASSERT(ior == _attr->Value());
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeInteger()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
//Check method Value
CPPUNIT_ASSERT(_attr->Value() == value);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeLocalID()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
//Check method Value
CPPUNIT_ASSERT(_attr->Value() == value);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeName()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeOpened()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(!_attr->IsOpened());
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeParameter()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[1] == "world");
*/
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributePersistentRef()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetValue("");
CPPUNIT_ASSERT(_attr->Value() == "");
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributePixMap()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetPixMap("");
CPPUNIT_ASSERT(_attr->GetPixMap() == "");
-
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributePythonObject()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->SetObject("", true);
CPPUNIT_ASSERT(_attr->GetObject() == "" && _attr->IsScript());
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeReal()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
//Check method Value
CPPUNIT_ASSERT(_attr->Value() == value);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeSelectable()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(_attr->IsSelectable());
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeSequenceOfInteger()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
}
CPPUNIT_ASSERT(isRaised);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeSequenceOfReal()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
}
CPPUNIT_ASSERT(isRaised);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeStudyProperties()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], true);
CPPUNIT_ASSERT(vs[0] == "srn" && vi[0][0] == 1 && vi[1][0] == 2 && vi[2][0] == 3 && vi[3][0] == 4 && vi[4][0] == 5);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeTableOfInteger()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeTableOfReal()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11.11 && data2[1] == -22.22 && data2[2] == -33.33);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeTableOfString()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == "11" && data2[1] == "-22" && data2[2] == "-33");
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeTarget()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(v[0]->GetID() == "0:1:3");
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeTextColor()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(color.B == color2.B);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testAttributeTextHighlightColor()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(color.B == color2.B);
- sm->Close(study);
+ study->Clear();
}
#define SALOMEDS_ALL_TESTS
void SALOMEDSTest::testAttributeTreeNode()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNodeGUID"+value);
CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value);
- sm->Close(study);
+ study->Clear();
}
#undef SALOMEDS_ALL_TESTS
*/
void SALOMEDSTest::testAttributeUserID()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value);
CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testChildIterator()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
//Check that there are two SObject under so
CPPUNIT_ASSERT(count == 2);
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testSComponent()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
//Check method ComponentIOR
- std::string ior = _orb->object_to_string(_sm);
+ std::string ior = _orb->object_to_string(_study);
_attr->SetValue(ior);
std::string new_ior;
//Check method ComponentDataType
CPPUNIT_ASSERT(sco->ComponentDataType() == "Test");
- sm->Close(study);
+ study->Clear();
}
*/
void SALOMEDSTest::testSComponentIterator()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(ci->Value()->ComponentDataType() == v[i]);
}
- sm->Close(study);
+ study->Clear();
}
void SALOMEDSTest::testSObject()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("TestSObject");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
_PTR(AttributeName) _attrName = studyBuilder->FindOrCreateAttribute(so, "AttributeName");
_PTR(AttributeComment) _attrComment = studyBuilder->FindOrCreateAttribute(so, "AttributeComment");
- std::string ior = _orb->object_to_string(_sm);
+ std::string ior = _orb->object_to_string(_study);
_attrIOR->SetValue(ior);
_attrName->SetValue("SO name");
_attrComment->SetValue("SO comment");
CPPUNIT_ASSERT(so2->GetID() == so1->GetID());
//Check method GetStudy
- CPPUNIT_ASSERT(so->GetStudy()->StudyId() == study->StudyId());
+ CPPUNIT_ASSERT(so->GetStudy() == study);
//Check methods Name
so->Name("test");
CORBA::Object_var obj = dynamic_cast<SALOMEDS_SObject*>(so.get())->GetObject();
CPPUNIT_ASSERT(!CORBA::is_nil(obj));
- sm->Close(study);
+ study->Clear();
}
void SALOMEDSTest::testStudy()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("Test");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
//Check the creation of the study
CPPUNIT_ASSERT(study);
//Check method GetTransientReference
CPPUNIT_ASSERT(!study->GetTransientReference().empty());
- //Check method StudyId
- CPPUNIT_ASSERT(study->StudyId() > 0);
-
- //Check method Name (get/set)
- CPPUNIT_ASSERT(study->Name() == "Test");
- study->Name("New name");
- CPPUNIT_ASSERT(study->Name() == "New name");
- study->Name("Test");
-
//Check method URL (get/set)
study->URL("");
CPPUNIT_ASSERT(study->URL() == "");
_PTR(AttributeIOR) ior_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeIOR");
CPPUNIT_ASSERT(ior_attr_so1);
- std::string ior = _orb->object_to_string(_sm);
+ std::string ior = _orb->object_to_string(_study);
ior_attr_so1->SetValue(ior);
_PTR(SObject) so2 = studyBuilder->NewObject(so1);
vs = study->GetFileNames("");
CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "filename1" && vs[1] == "filename2");
- //Check method StudyId (get/set)
- int id = study->StudyId();
- study->StudyId(-1);
- CPPUNIT_ASSERT(study->StudyId() == -1);
- study->StudyId(id);
-
//Check method FindDependances
studyBuilder->Addreference(so2, so1);
studyBuilder->Addreference(sco1, so1);
system("rm -f SRN.py");
CPPUNIT_ASSERT(line.substr(0,50) == "### This file is generated automatically by SALOME");
- //Check method Close
+ //Check method Clear
bool isException = false;
try {
- sm->Close(study); //Close is called inside StudyManager::Close
+ study->Clear(); //Clear is called inside Study::Clear()
}
catch(...) {
isException = true;
void SALOMEDSTest::testStudyBuilder()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Create a new study
- _PTR(Study) study = sm->NewStudy("TestStudyBuilder");
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
CPPUNIT_ASSERT(study);
CPPUNIT_ASSERT(sco1 && sco1->ComponentDataType() == "Test");
//Check method DefineComponentInstance
- std::string ior = _orb->object_to_string(_sm);
+ std::string ior = _orb->object_to_string(_study);
studyBuilder->DefineComponentInstance(sco1, ior);
std::string newior;
sco1->ComponentIOR(newior);
studyBuilder->SetIOR(so1, ior);
CPPUNIT_ASSERT(so1->GetIOR() == ior);
- sm->Close(study);
+ study->Clear();
//Check method LoadWith
- _PTR(Study) study2 = sm->NewStudy("Study2");
+ _PTR(Study) study2(new SALOMEDS_Study(new SALOMEDSImpl_Study()));
SALOME_NamingService NS(_orb);
CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH");
ior = _orb->object_to_string(drv);
sb2->DefineComponentInstance(sco, ior);
- sm->SaveAs("srn_SALOMEDS_UnitTests.hdf", study2, false);
- sm->Close(study2);
+ study2->SaveAs("srn_SALOMEDS_UnitTests.hdf", false);
+ study2->Clear();
- _PTR(Study) study3 = sm->Open("srn_SALOMEDS_UnitTests.hdf");
+ _PTR(Study) study3(new SALOMEDS_Study(new SALOMEDSImpl_Study()));
+ study3->Open("srn_SALOMEDS_UnitTests.hdf");
_PTR(StudyBuilder) sb3 = study3->NewBuilder();
_PTR(SComponent) aComp = study3->FindComponent("SMESH");
CPPUNIT_ASSERT(aComp);
isRaised = true;
}
-
CPPUNIT_ASSERT(!isRaised);
ior = "";
}
CPPUNIT_ASSERT(isRaised);
- sm->Close(study3);
+ study3->Clear();
}
+++ /dev/null
-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-/*!
- * Check all methods of SALOMEDS_StudyManager
- * Use code of SALOMEDS_StudyManager.cxx
- */
-void SALOMEDSTest::testStudyManager()
-{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
-
- CPPUNIT_ASSERT(sm);
-
- //Check method NewStudy
- _PTR(Study) study1 = sm->NewStudy("Study1");
- CPPUNIT_ASSERT(study1);
-
- //Check method GetStudyByName
- _PTR(Study) study3 = sm->GetStudyByName("Study1");
- CPPUNIT_ASSERT(study3->StudyId() == study1->StudyId());
- CPPUNIT_ASSERT(study3->Name() == study1->Name());
-
- //Check method GetOpenStudies
- std::vector<std::string> v = sm->GetOpenStudies();
- CPPUNIT_ASSERT(v.size() == 1);
-
- //Check method GetStudyByID for invalid ID
- CPPUNIT_ASSERT(!sm->GetStudyByID(-1));
-
- //Check methods CanPaste, CanCopy, Copy, Paste
- _PTR(StudyBuilder) sb1 = study1->NewBuilder();
- _PTR(SComponent) sco1 = sb1->NewComponent("Test");
- _PTR(SObject) so1 = sb1->NewObject(sco1);
- _PTR(AttributeName) na1 = sb1->FindOrCreateAttribute(so1, "AttributeName");
- CPPUNIT_ASSERT(na1);
- na1->SetValue("Some name");
-
- CPPUNIT_ASSERT(!sm->CanCopy(so1)); //The father component has no IOR
-
- CPPUNIT_ASSERT(sm->Copy(so1));
-
- CPPUNIT_ASSERT(!sm->CanPaste(so1)); //The father component has no IOR
-
- _PTR(SObject) so1_2 = sb1->NewObject(sco1);
- _PTR(SObject) pasted_so = sm->Paste(so1_2);
- CPPUNIT_ASSERT(pasted_so);
-
- _PTR(AttributeName) na2 = sb1->FindOrCreateAttribute(pasted_so, "AttributeName");
- CPPUNIT_ASSERT(na2 && na2->Value() == "Some name");
-
-
- //Check method SaveAs
- sm->SaveAs("srn_UnitTest_Save.hdf", study1, false);
- std::string url = study1->URL();
- sm->Close(study1);
-
- //Check method Open
- _PTR(Study) study1_opened = sm->Open("srn_UnitTest_Save.hdf"); //Contains Test component
- system("rm -f srn_UnitTest_Save.hdf");
- url = study1_opened->URL();
- CPPUNIT_ASSERT(study1_opened);
- CPPUNIT_ASSERT(url == "srn_UnitTest_Save.hdf");
-
- //Check method Save
- _PTR(StudyBuilder) sb3 = study1_opened->NewBuilder();
- _PTR(SComponent) sco3 = study1_opened->FindComponent("Test");
- CPPUNIT_ASSERT(sco3);
- // Add a new SObject with AttributeName that contains "Saved study" string
- _PTR(SObject) so3 = sb3->NewObject(sco3);
- std::string soID = so3->GetID();
- _PTR(AttributeName) na3 = sb3->FindOrCreateAttribute(so3, "AttributeName");
- CPPUNIT_ASSERT(na3);
-
- na3->SetValue("Saved study");
-
- // Save and close the study
- sm->Save(study1_opened, false);
-
- sm->Close(study1_opened);
-
- // Open saved study and find the created SObject with AttributeName, then compare the stored string
- _PTR(Study) study2_opened = sm->Open("srn_UnitTest_Save.hdf");
-
- system("rm -f srn_UnitTest_Save.hdf");
-
- CPPUNIT_ASSERT(study2_opened);
-
- _PTR(SObject) so4 = study2_opened->CreateObjectID(soID);
- _PTR(StudyBuilder) sb4 = study2_opened->NewBuilder();
- _PTR(AttributeName) na4 = sb4->FindOrCreateAttribute(so4, "AttributeName");
- CPPUNIT_ASSERT(na4 && na4->Value() == "Saved study"); //Compare the value of restored attribute with string that has to be saved.
-
- //Check method SaveAsASCII
- sm->SaveAsASCII("srn_UnitTest_SaveASCII.hdf", study2_opened, false);
- url = study2_opened->URL();
- sm->Close(study2_opened);
-
- _PTR(Study) study3_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); //Contains Test component
- system("rm -f srn_UnitTest_SaveASCII.hdf");
- CPPUNIT_ASSERT(study3_opened);
- CPPUNIT_ASSERT(url == "srn_UnitTest_SaveASCII.hdf");
-
- //Check method SaveASCII
- _PTR(StudyBuilder) sb5 = study3_opened->NewBuilder();
- _PTR(SComponent) sco5 = study3_opened->FindComponent("Test");
- CPPUNIT_ASSERT(sco5);
- // Add a new SObject with AttributeName that contains "Saved study" string
- _PTR(SObject) so5 = sb5->NewObject(sco5);
- soID = so5->GetID();
- _PTR(AttributeName) na5 = sb5->FindOrCreateAttribute(so5, "AttributeName");
- CPPUNIT_ASSERT(na5);
- na5->SetValue("Saved study ASCII");
- // Save and close the study
- sm->Save(study3_opened, false);
- sm->Close(study3_opened);
-
- // Open saved study and find the created SObject with AttributeName, then compare the stored string
- _PTR(Study) study4_opened = sm->Open("srn_UnitTest_SaveASCII.hdf");
- system("rm -f srn_UnitTest_SaveASCII.hdf");
- CPPUNIT_ASSERT(study4_opened);
- _PTR(SObject) so6 = study4_opened->CreateObjectID(soID);
- _PTR(StudyBuilder) sb6 = study4_opened->NewBuilder();
- _PTR(AttributeName) na6 = sb6->FindOrCreateAttribute(so6, "AttributeName");
- CPPUNIT_ASSERT(na6 && na6->Value() == "Saved study ASCII"); //Compare the value of restored attribute with string that has to be saved.
-}
-
-
-
void SALOMEDSTest::testUseCase()
{
- //Create or find the Study manager
- _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
- CPPUNIT_ASSERT(sm);
+ //Create Study
+ _PTR(Study) study(new SALOMEDS_Study(_study));
- //Create a new study
- _PTR(Study) study = sm->NewStudy("TestSObject");
CPPUNIT_ASSERT(study);
//Create Study Builder
CPPUNIT_ASSERT(it->More());
CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID());
- sm->Close(study);
+ study->Clear();
}
#undef SALOMEDS_ALL_TESTS
#include "Basics_Utils.hxx"
#include "SALOME_NamingService.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
#ifdef WIN32
#include <winsock2.h>
SALOME_NamingService NS(orb);
if(host.empty())
- NamingService_WaitForServerReadiness(&NS, "/myStudyManager");
+ NamingService_WaitForServerReadiness(&NS, "/Study");
else {
std::string serverName = "/Containers/"+host+"/SuperVisionContainer";
NamingService_WaitForServerReadiness(&NS, serverName);
}
- CORBA::Object_var obj = NS.Resolve( "/myStudyManager" );
+ CORBA::Object_var obj = NS.Resolve( "/Study" );
if(CORBA::is_nil(obj)) {
system("killSalome.py");
return 1;
if(!CORBA::is_nil(poaObj)) {
PortableServer::POA_var poa = PortableServer::POA::_narrow(poaObj);
- SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, poa);
+ SALOMEDS_Study_i* aStudy_i = new SALOMEDS_Study_i(orb);
// Activate the objects. This tells the POA that the objects are ready to accept requests.
- PortableServer::ObjectId_var aStudyManager_iid = poa->activate_object(aStudyManager_i);
- aStudyManager_i->register_name("/myStudyManager_embedded");
+ PortableServer::ObjectId_var aStudy_iid = poa->activate_object(aStudy_i);
+ SALOMEDS::Study_var Study = aStudy_i->_this();
+ NS.Register(Study.in(), "/Study_embedded");
// Obtain a POAManager, and tell the POA to start accepting
// requests on its objects.
#include "utilities.h"
#include "SALOMEDSImpl_AttributeParameter.hxx"
-#include "SALOMEDSImpl_StudyManager.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_StudyBuilder.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
// ============================================================================
void SALOMEDSImplTest::testAttributeParameter()
{
- SALOMEDSImpl_StudyManager* sm = new SALOMEDSImpl_StudyManager();
- SALOMEDSImpl_Study* study = sm->NewStudy("Test");
+ SALOMEDSImpl_Study* study = new SALOMEDSImpl_Study();
SALOMEDSImpl_AttributeParameter* _ap = study->GetCommonParameters("TestComp", 0);
CPPUNIT_ASSERT(_ap);
#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
-#include "SALOMEDSImpl_StudyManager.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_StudyBuilder.hxx"
#include "SALOMEDSImpl_SObject.hxx"
{
std::cout << "Test started " << std::endl;
- SALOMEDSImpl_StudyManager* aSM = new SALOMEDSImpl_StudyManager();
- std::cout << "Manager is created " << std::endl;
- SALOMEDSImpl_Study* aStudy = aSM->NewStudy("SRN");
- std::cout << "Study with id = " << aStudy->StudyId() << " is created " << std::endl;
+ SALOMEDSImpl_Study* aStudy = new SALOMEDSImpl_Study();
+ std::cout << "Study is created" << std::endl;
std::cout << "Check the study lock, locking" << std::endl;
aStudy->SetStudyLock("SRN");
iGenFact->load_component_Library(componenttName.c_str(),reason);
#endif
CORBA::string_free(reason);
- CORBA::Object_var obj = iGenFact->create_component_instance(componenttName.c_str(), 0);
+ CORBA::Object_var obj = iGenFact->create_component_instance(componenttName.c_str());
Engines::TestComponent_var anInstance = Engines::TestComponent::_narrow(obj);
MESSAGE("create anInstance");
SCRUTE(anInstance->instanceName());