From: imn Date: Fri, 23 Sep 2016 13:24:07 +0000 (+0300) Subject: 0023299: [CEA] Finalize multi-study removal X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00c131c284baf59abdcde7a724183a0d5308df86;p=modules%2Fyacs.git 0023299: [CEA] Finalize multi-study removal - remove "study manager" and "study id" in tests --- diff --git a/src/KernelHelpers/KernelHelpersUseCases.cxx b/src/KernelHelpers/KernelHelpersUseCases.cxx index 7feaf8a2d..f408555f2 100644 --- a/src/KernelHelpers/KernelHelpersUseCases.cxx +++ b/src/KernelHelpers/KernelHelpersUseCases.cxx @@ -60,8 +60,8 @@ bool TEST_getLifeCycleCORBA() { 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; } @@ -70,9 +70,8 @@ bool TEST_getStudyManager() { 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 = "<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 = "< #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" @@ -85,17 +85,14 @@ static void DumpStudy (SALOMEDS::Study_ptr Study) { * 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; @@ -195,53 +192,34 @@ static void Test(SALOMEDS::StudyManager_ptr myStudyMgr ) 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 "< ComponentDataType is "<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 "< ComponentDataType is "<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")) { @@ -254,7 +232,7 @@ static void Test(SALOMEDS::StudyManager_ptr myStudyMgr ) } // 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")) { @@ -265,7 +243,7 @@ static void Test(SALOMEDS::StudyManager_ptr myStudyMgr ) else { MESSAGE("-> Name is not found"); } - //DumpStudy(myStudy1); + //DumpStudy(myStudy); } catch(HDFexception) { @@ -291,9 +269,9 @@ int main(int argc, char** argv) 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. @@ -301,7 +279,7 @@ int main(int argc, char** argv) pman->activate(); // Test basic services - Test(myStudyMgr); + Test(myStudy); orb->run(); orb->destroy(); diff --git a/src/SALOMEDS/Test/CMakeLists.txt b/src/SALOMEDS/Test/CMakeLists.txt index 67615795f..d464ab393 100755 --- a/src/SALOMEDS/Test/CMakeLists.txt +++ b/src/SALOMEDS/Test/CMakeLists.txt @@ -40,6 +40,7 @@ INCLUDE_DIRECTORIES( ${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 ) @@ -62,6 +63,7 @@ SET(COMMON_LIBS SalomeDSImpl SalomeDSClient SalomeDS + SalomeGenericObj SalomeIDLKernel ) diff --git a/src/SALOMEDS/Test/SALOMEDSTest.cxx b/src/SALOMEDS/Test/SALOMEDSTest.cxx index e9ddc40b6..173ef8425 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.cxx @@ -22,8 +22,6 @@ #include "SALOMEDSTest.hxx" - -#include "SALOMEDS_StudyManager_i.hxx" #include "utilities.h" #include "Utils_SINGLETON.hxx" #include "Utils_ORB_INIT.hxx" @@ -37,8 +35,7 @@ #include #include "SALOMEDSClient.hxx" -#include "SALOMEDS_StudyManager_i.hxx" -#include "SALOMEDS_StudyManager.hxx" +#include "SALOMEDS_Study.hxx" #include "SALOMEDS_SObject.hxx" @@ -58,10 +55,10 @@ void SALOMEDSTest::setUp() ASSERT(SINGLETON_::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) ); } // ============================================================================ @@ -72,13 +69,9 @@ void SALOMEDSTest::setUp() void SALOMEDSTest::tearDown() { - _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); - std::vector v = sm->GetOpenStudies(); - for(int i = 0; iGetStudyByName(v[i]); - if(study) - sm->Close(study); - } + _PTR(Study) study ( new SALOMEDS_Study(_study) ); + if(study) + study->Clear(); } #include "SALOMEDSTest_AttributeComment.cxx" @@ -116,7 +109,6 @@ void SALOMEDSTest::tearDown() #include "SALOMEDSTest_SObject.cxx" #include "SALOMEDSTest_Study.cxx" #include "SALOMEDSTest_StudyBuilder.cxx" -#include "SALOMEDSTest_StudyManager.cxx" #include "SALOMEDSTest_UseCase.cxx" @@ -135,8 +127,8 @@ void SALOMEDSTest_Embedded::setUp() ASSERT(SINGLETON_::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) ); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx index c51ecf4e0..ac6207baf 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.hxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.hxx @@ -79,7 +79,6 @@ class SALOMEDSTEST_EXPORT SALOMEDSTest : public CppUnit::TestFixture CPPUNIT_TEST( testSObject ); CPPUNIT_TEST( testStudy ); CPPUNIT_TEST( testStudyBuilder ); - CPPUNIT_TEST( testStudyManager ); CPPUNIT_TEST( testUseCase ); @@ -128,13 +127,12 @@ public: 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; }; @@ -182,7 +180,6 @@ class SALOMEDSTEST_EXPORT SALOMEDSTest_Embedded : public SALOMEDSTest CPPUNIT_TEST( testStudy ); CPPUNIT_TEST( testStudyBuilder ); CPPUNIT_TEST( testChildIterator ); - CPPUNIT_TEST( testStudyManager ); CPPUNIT_TEST( testUseCase ); CPPUNIT_TEST_SUITE_END(); diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx index 6c93cd649..455bde6b1 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx @@ -27,18 +27,8 @@ 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 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); @@ -73,8 +63,7 @@ void SALOMEDSTest::testAttributeComment() _attr->SetValue(""); CPPUNIT_ASSERT(_attr->Value() == ""); - - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx index 0292fec20..8fd7230f1 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx @@ -27,13 +27,8 @@ 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); @@ -67,7 +62,7 @@ void SALOMEDSTest::testAttributeDrawable() CPPUNIT_ASSERT(!_attr->IsDrawable()); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx index a36edbaf6..85158e9d8 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx @@ -26,13 +26,8 @@ */ 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); @@ -66,7 +61,7 @@ void SALOMEDSTest::testAttributeExpandable() CPPUNIT_ASSERT(_attr->IsExpandable()); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx index 3da5e7e8e..2800f9a82 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx @@ -26,13 +26,8 @@ */ 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); @@ -68,8 +63,7 @@ void SALOMEDSTest::testAttributeExternalFileDef() _attr->SetValue(""); CPPUNIT_ASSERT(_attr->Value() == ""); - - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx index 31babb73b..1860a9ceb 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx @@ -26,13 +26,8 @@ */ 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); @@ -68,8 +63,7 @@ void SALOMEDSTest::testAttributeFileType() _attr->SetValue(""); CPPUNIT_ASSERT(_attr->Value() == ""); - - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx index 7f0533854..cb20fb1dc 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx @@ -26,13 +26,8 @@ */ 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); @@ -71,7 +66,7 @@ void SALOMEDSTest::testAttributeFlags() CPPUNIT_ASSERT(!_attr->Get(4)); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx index 79c09769f..279a9198f 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx @@ -26,13 +26,8 @@ */ 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); @@ -68,7 +63,7 @@ void SALOMEDSTest::testAttributeGraphic() _attr->SetVisibility(-1, true); CPPUNIT_ASSERT(_attr->GetVisibility(-1)); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx index 25660a648..101af8f73 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx @@ -26,13 +26,8 @@ */ 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); @@ -57,14 +52,14 @@ void SALOMEDSTest::testAttributeIOR() 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(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx index b5bb2d72e..5c79a1586 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx @@ -26,13 +26,8 @@ */ 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); @@ -60,7 +55,7 @@ void SALOMEDSTest::testAttributeInteger() //Check method Value CPPUNIT_ASSERT(_attr->Value() == value); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx index 44757f2d2..aa57ad4d7 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx @@ -26,13 +26,8 @@ */ 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); @@ -60,7 +55,7 @@ void SALOMEDSTest::testAttributeLocalID() //Check method Value CPPUNIT_ASSERT(_attr->Value() == value); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx index 4b1fb4a94..257d10a95 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx @@ -26,13 +26,8 @@ */ 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); @@ -68,7 +63,7 @@ void SALOMEDSTest::testAttributeName() _attr->SetValue(""); CPPUNIT_ASSERT(_attr->Value() == ""); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx index 722ce80d6..79f6abe41 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx @@ -26,13 +26,8 @@ */ 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); @@ -66,7 +61,7 @@ void SALOMEDSTest::testAttributeOpened() CPPUNIT_ASSERT(!_attr->IsOpened()); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx index b54547251..5c10a0872 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx @@ -34,13 +34,8 @@ */ 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); @@ -141,7 +136,7 @@ void SALOMEDSTest::testAttributeParameter() CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[1] == "world"); */ - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx index a915c4713..3a8ddd9fd 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx @@ -26,13 +26,8 @@ */ 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); @@ -68,7 +63,7 @@ void SALOMEDSTest::testAttributePersistentRef() _attr->SetValue(""); CPPUNIT_ASSERT(_attr->Value() == ""); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx index abce9ee84..076bdb70f 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx @@ -26,13 +26,8 @@ */ 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); @@ -68,8 +63,7 @@ void SALOMEDSTest::testAttributePixMap() _attr->SetPixMap(""); CPPUNIT_ASSERT(_attr->GetPixMap() == ""); - - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx index 774aa09ab..1e8bbed75 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx @@ -26,13 +26,8 @@ */ 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); @@ -69,7 +64,7 @@ void SALOMEDSTest::testAttributePythonObject() _attr->SetObject("", true); CPPUNIT_ASSERT(_attr->GetObject() == "" && _attr->IsScript()); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx index 991f922d1..8061ced5c 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx @@ -26,13 +26,8 @@ */ 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); @@ -60,7 +55,7 @@ void SALOMEDSTest::testAttributeReal() //Check method Value CPPUNIT_ASSERT(_attr->Value() == value); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx index adcf52d6f..ebf0ec2b1 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx @@ -26,13 +26,8 @@ */ 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); @@ -66,7 +61,7 @@ void SALOMEDSTest::testAttributeSelectable() CPPUNIT_ASSERT(_attr->IsSelectable()); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx index 62f714515..e2c3e7744 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx @@ -26,13 +26,8 @@ */ 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); @@ -122,7 +117,7 @@ void SALOMEDSTest::testAttributeSequenceOfInteger() } CPPUNIT_ASSERT(isRaised); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx index 2772a71bd..851e4da2b 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx @@ -26,13 +26,8 @@ */ 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); @@ -116,7 +111,7 @@ void SALOMEDSTest::testAttributeSequenceOfReal() } CPPUNIT_ASSERT(isRaised); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx index 2f06bd76c..00dd040db 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx @@ -26,13 +26,8 @@ */ 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); @@ -108,7 +103,7 @@ void SALOMEDSTest::testAttributeStudyProperties() _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(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx index e3acb4407..c87408238 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx @@ -26,13 +26,8 @@ */ 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); @@ -185,7 +180,7 @@ void SALOMEDSTest::testAttributeTableOfInteger() CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx index 5a20a4aa1..6c9905d47 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx @@ -26,13 +26,8 @@ */ 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); @@ -184,7 +179,7 @@ void SALOMEDSTest::testAttributeTableOfReal() CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11.11 && data2[1] == -22.22 && data2[2] == -33.33); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx index 172323cbc..5a3baea4f 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx @@ -26,13 +26,8 @@ */ 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); @@ -185,7 +180,7 @@ void SALOMEDSTest::testAttributeTableOfString() CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == "11" && data2[1] == "-22" && data2[2] == "-33"); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx index 251e9baca..15cea2b79 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx @@ -26,13 +26,8 @@ */ 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); @@ -84,7 +79,7 @@ void SALOMEDSTest::testAttributeTarget() CPPUNIT_ASSERT(v[0]->GetID() == "0:1:3"); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx index 3886947fc..a86a6d011 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx @@ -26,13 +26,8 @@ */ 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); @@ -69,7 +64,7 @@ void SALOMEDSTest::testAttributeTextColor() CPPUNIT_ASSERT(color.B == color2.B); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx index 418a0a3a4..d7068e542 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx @@ -26,13 +26,8 @@ */ 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); @@ -69,7 +64,7 @@ void SALOMEDSTest::testAttributeTextHighlightColor() CPPUNIT_ASSERT(color.B == color2.B); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx index a2258b8cf..d8a8affb7 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx @@ -27,13 +27,8 @@ #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); @@ -190,7 +185,7 @@ void SALOMEDSTest::testAttributeTreeNode() _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 diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx index cb7e40214..be68164b0 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx @@ -26,13 +26,8 @@ */ 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); @@ -65,7 +60,7 @@ void SALOMEDSTest::testAttributeUserID() _PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value); CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx index d4c2bdf5d..55d9a224f 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx @@ -26,13 +26,8 @@ */ 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); @@ -74,7 +69,7 @@ void SALOMEDSTest::testChildIterator() //Check that there are two SObject under so CPPUNIT_ASSERT(count == 2); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx index 8bd02ae35..bba4bd906 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx @@ -26,13 +26,8 @@ */ 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); @@ -54,7 +49,7 @@ void SALOMEDSTest::testSComponent() //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; @@ -65,7 +60,7 @@ void SALOMEDSTest::testSComponent() //Check method ComponentDataType CPPUNIT_ASSERT(sco->ComponentDataType() == "Test"); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx index cba69b2f4..76224f211 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx @@ -26,13 +26,8 @@ */ 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); @@ -60,7 +55,7 @@ void SALOMEDSTest::testSComponentIterator() CPPUNIT_ASSERT(ci->Value()->ComponentDataType() == v[i]); } - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx index 542a6865d..2899ce038 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx @@ -27,13 +27,8 @@ 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); @@ -71,7 +66,7 @@ void SALOMEDSTest::testSObject() _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"); @@ -93,7 +88,7 @@ void SALOMEDSTest::testSObject() 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"); @@ -120,7 +115,7 @@ void SALOMEDSTest::testSObject() CORBA::Object_var obj = dynamic_cast(so.get())->GetObject(); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); - sm->Close(study); + study->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx index f7fe1bd72..4089fcc47 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx @@ -27,13 +27,8 @@ 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); @@ -50,15 +45,6 @@ void SALOMEDSTest::testStudy() //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() == ""); @@ -122,7 +108,7 @@ void SALOMEDSTest::testStudy() _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); @@ -212,12 +198,6 @@ void SALOMEDSTest::testStudy() 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); @@ -337,10 +317,10 @@ void SALOMEDSTest::testStudy() 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; diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx index a116d70a1..d1c6e9036 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx @@ -27,13 +27,8 @@ 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); @@ -48,7 +43,7 @@ void SALOMEDSTest::testStudyBuilder() 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); @@ -165,10 +160,10 @@ void SALOMEDSTest::testStudyBuilder() 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"); @@ -185,10 +180,11 @@ void SALOMEDSTest::testStudyBuilder() 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); @@ -207,7 +203,6 @@ void SALOMEDSTest::testStudyBuilder() isRaised = true; } - CPPUNIT_ASSERT(!isRaised); ior = ""; @@ -248,5 +243,5 @@ void SALOMEDSTest::testStudyBuilder() } CPPUNIT_ASSERT(isRaised); - sm->Close(study3); + study3->Clear(); } diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx deleted file mode 100755 index 1e4ce4eef..000000000 --- a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx +++ /dev/null @@ -1,148 +0,0 @@ -// 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 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. -} - - - diff --git a/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx b/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx index 7db8cd109..30455b5ca 100755 --- a/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx @@ -29,12 +29,9 @@ 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 @@ -148,7 +145,7 @@ void SALOMEDSTest::testUseCase() CPPUNIT_ASSERT(it->More()); CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); - sm->Close(study); + study->Clear(); } #undef SALOMEDS_ALL_TESTS diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 759cd63fe..0bbe58c1f 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -51,7 +51,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); #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 @@ -75,13 +75,13 @@ int main(int argc, char* argv[]) 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; @@ -96,10 +96,11 @@ int main(int argc, char* argv[]) 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. diff --git a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx index 1ae14790c..bd943823d 100644 --- a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx +++ b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.cxx @@ -30,7 +30,6 @@ #include "utilities.h" #include "SALOMEDSImpl_AttributeParameter.hxx" -#include "SALOMEDSImpl_StudyManager.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_StudyBuilder.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" @@ -64,8 +63,7 @@ SALOMEDSImplTest::tearDown() // ============================================================================ 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); diff --git a/src/SALOMEDSImpl/testDS.cxx b/src/SALOMEDSImpl/testDS.cxx index 640089457..429da3f01 100644 --- a/src/SALOMEDSImpl/testDS.cxx +++ b/src/SALOMEDSImpl/testDS.cxx @@ -34,7 +34,6 @@ #include "DF_ChildIterator.hxx" #include "SALOMEDSImpl_Attributes.hxx" -#include "SALOMEDSImpl_StudyManager.hxx" #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_StudyBuilder.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -49,10 +48,8 @@ int main (int argc, char * argv[]) { 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"); diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index 4deb36b37..c31f16092 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -72,7 +72,7 @@ Engines::TestComponent_ptr create_instance(Engines::Container_ptr iGenFact, 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());