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;