Back to index

salome-kernel  6.5.0
SALOMEDSTest.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include "SALOMEDSTest.hxx"
00024 
00025 
00026 #include "SALOMEDS_StudyManager_i.hxx"
00027 #include "utilities.h"
00028 #include "Utils_SINGLETON.hxx"
00029 #include "Utils_ORB_INIT.hxx"
00030 #include "SALOME_NamingService.hxx"
00031 #include "SALOME_LifeCycleCORBA.hxx"
00032 
00033 #include <iostream>
00034 #include <fstream>
00035 #include <string>
00036 #include <vector>
00037 #include <cstdlib>
00038 
00039 #include "SALOMEDSClient.hxx"
00040 #include "SALOMEDS_StudyManager_i.hxx"
00041 #include "SALOMEDS_StudyManager.hxx"
00042 #include "SALOMEDS_SObject.hxx"
00043 
00044 
00045 
00046 // ============================================================================
00050 // ============================================================================
00051  
00052 void SALOMEDSTest::setUp()
00053 {  
00054   int argc = 1;
00055   char* argv[] = {(char*)""};
00056 
00057   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
00058   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
00059   _orb = init(argc , argv ) ;
00060   SALOME_NamingService NS(_orb);
00061   CORBA::Object_var obj = NS.Resolve( "/myStudyManager" );
00062   _sm = SALOMEDS::StudyManager::_narrow( obj );
00063 
00064   CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); 
00065 }
00066 
00067 // ============================================================================
00071 // ============================================================================
00072 
00073 void SALOMEDSTest::tearDown()
00074 {
00075   _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
00076   std::vector<std::string> v = sm->GetOpenStudies();
00077   for(int i = 0; i<v.size(); i++) {
00078     _PTR(Study) study = sm->GetStudyByName(v[i]);
00079     if(study)
00080       sm->Close(study);
00081   }
00082 }
00083 
00084 #include "SALOMEDSTest_AttributeComment.cxx"
00085 #include "SALOMEDSTest_AttributeDrawable.cxx"
00086 #include "SALOMEDSTest_AttributeExpandable.cxx"
00087 #include "SALOMEDSTest_AttributeExternalFileDef.cxx"
00088 #include "SALOMEDSTest_AttributeFileType.cxx"
00089 #include "SALOMEDSTest_AttributeFlags.cxx"
00090 #include "SALOMEDSTest_AttributeGraphic.cxx"
00091 #include "SALOMEDSTest_AttributeIOR.cxx"
00092 #include "SALOMEDSTest_AttributeInteger.cxx"
00093 #include "SALOMEDSTest_AttributeLocalID.cxx"
00094 #include "SALOMEDSTest_AttributeName.cxx"
00095 #include "SALOMEDSTest_AttributeOpened.cxx"
00096 #include "SALOMEDSTest_AttributeParameter.cxx"
00097 #include "SALOMEDSTest_AttributePersistentRef.cxx"
00098 #include "SALOMEDSTest_AttributePixMap.cxx"
00099 #include "SALOMEDSTest_AttributePythonObject.cxx"
00100 #include "SALOMEDSTest_AttributeReal.cxx"
00101 #include "SALOMEDSTest_AttributeSelectable.cxx"
00102 #include "SALOMEDSTest_AttributeSequenceOfInteger.cxx"
00103 #include "SALOMEDSTest_AttributeSequenceOfReal.cxx"
00104 #include "SALOMEDSTest_AttributeStudyProperties.cxx"
00105 #include "SALOMEDSTest_AttributeTableOfInteger.cxx"
00106 #include "SALOMEDSTest_AttributeTableOfReal.cxx"
00107 #include "SALOMEDSTest_AttributeTableOfString.cxx"
00108 #include "SALOMEDSTest_AttributeTarget.cxx"
00109 #include "SALOMEDSTest_AttributeTextColor.cxx"
00110 #include "SALOMEDSTest_AttributeTextHighlightColor.cxx"
00111 #include "SALOMEDSTest_AttributeTreeNode.cxx"
00112 #include "SALOMEDSTest_AttributeUserID.cxx"
00113 #include "SALOMEDSTest_ChildIterator.cxx"
00114 #include "SALOMEDSTest_SComponent.cxx"
00115 #include "SALOMEDSTest_SComponentIterator.cxx"
00116 #include "SALOMEDSTest_SObject.cxx"
00117 #include "SALOMEDSTest_Study.cxx"
00118 #include "SALOMEDSTest_StudyBuilder.cxx"
00119 #include "SALOMEDSTest_StudyManager.cxx"
00120 #include "SALOMEDSTest_UseCase.cxx"
00121 
00122 
00123 // ============================================================================
00127 // ============================================================================
00128  
00129 void SALOMEDSTest_Embedded::setUp()
00130 {  
00131   int argc = 1;
00132   char* argv[] = {(char*)""};
00133 
00134   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
00135   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
00136   _orb = init(argc , argv ) ;
00137   SALOME_NamingService NS(_orb);
00138   CORBA::Object_var obj = NS.Resolve( "/myStudyManager_embedded" );
00139   _sm = SALOMEDS::StudyManager::_narrow( obj );
00140 
00141   CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); 
00142 }