Salome HOME
New CMake procedure.
[modules/kernel.git] / src / SALOMEDS / Test / SALOMEDSTest.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "SALOMEDSTest.hxx"
24
25
26 #include "SALOMEDS_StudyManager_i.hxx"
27 #include "utilities.h"
28 #include "Utils_SINGLETON.hxx"
29 #include "Utils_ORB_INIT.hxx"
30 #include "SALOME_NamingService.hxx"
31 #include "SALOME_LifeCycleCORBA.hxx"
32
33 #include <iostream>
34 #include <fstream>
35 #include <string>
36 #include <vector>
37 #include <cstdlib>
38
39 #include "SALOMEDSClient.hxx"
40 #include "SALOMEDS_StudyManager_i.hxx"
41 #include "SALOMEDS_StudyManager.hxx"
42 #include "SALOMEDS_SObject.hxx"
43
44
45
46 // ============================================================================
47 /*!
48  * Set up the environment
49  */
50 // ============================================================================
51  
52 void SALOMEDSTest::setUp()
53 {  
54   int argc = 1;
55   char* argv[] = {(char*)""};
56
57   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
58   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
59   _orb = init(argc , argv ) ;
60   SALOME_NamingService NS(_orb);
61   CORBA::Object_var obj = NS.Resolve( "/myStudyManager" );
62   _sm = SALOMEDS::StudyManager::_narrow( obj );
63
64   CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); 
65 }
66
67 // ============================================================================
68 /*!
69  *  - delete trace classes
70  */
71 // ============================================================================
72
73 void SALOMEDSTest::tearDown()
74 {
75   _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) );
76   std::vector<std::string> v = sm->GetOpenStudies();
77   for(int i = 0; i<v.size(); i++) {
78     _PTR(Study) study = sm->GetStudyByName(v[i]);
79     if(study)
80       sm->Close(study);
81   }
82 }
83
84 #include "SALOMEDSTest_AttributeComment.cxx"
85 #include "SALOMEDSTest_AttributeDrawable.cxx"
86 #include "SALOMEDSTest_AttributeExpandable.cxx"
87 #include "SALOMEDSTest_AttributeExternalFileDef.cxx"
88 #include "SALOMEDSTest_AttributeFileType.cxx"
89 #include "SALOMEDSTest_AttributeFlags.cxx"
90 #include "SALOMEDSTest_AttributeGraphic.cxx"
91 #include "SALOMEDSTest_AttributeIOR.cxx"
92 #include "SALOMEDSTest_AttributeInteger.cxx"
93 #include "SALOMEDSTest_AttributeLocalID.cxx"
94 #include "SALOMEDSTest_AttributeName.cxx"
95 #include "SALOMEDSTest_AttributeOpened.cxx"
96 #include "SALOMEDSTest_AttributeParameter.cxx"
97 #include "SALOMEDSTest_AttributePersistentRef.cxx"
98 #include "SALOMEDSTest_AttributePixMap.cxx"
99 #include "SALOMEDSTest_AttributePythonObject.cxx"
100 #include "SALOMEDSTest_AttributeReal.cxx"
101 #include "SALOMEDSTest_AttributeSelectable.cxx"
102 #include "SALOMEDSTest_AttributeSequenceOfInteger.cxx"
103 #include "SALOMEDSTest_AttributeSequenceOfReal.cxx"
104 #include "SALOMEDSTest_AttributeStudyProperties.cxx"
105 #include "SALOMEDSTest_AttributeTableOfInteger.cxx"
106 #include "SALOMEDSTest_AttributeTableOfReal.cxx"
107 #include "SALOMEDSTest_AttributeTableOfString.cxx"
108 #include "SALOMEDSTest_AttributeTarget.cxx"
109 #include "SALOMEDSTest_AttributeTextColor.cxx"
110 #include "SALOMEDSTest_AttributeTextHighlightColor.cxx"
111 #include "SALOMEDSTest_AttributeTreeNode.cxx"
112 #include "SALOMEDSTest_AttributeUserID.cxx"
113 #include "SALOMEDSTest_ChildIterator.cxx"
114 #include "SALOMEDSTest_SComponent.cxx"
115 #include "SALOMEDSTest_SComponentIterator.cxx"
116 #include "SALOMEDSTest_SObject.cxx"
117 #include "SALOMEDSTest_Study.cxx"
118 #include "SALOMEDSTest_StudyBuilder.cxx"
119 #include "SALOMEDSTest_StudyManager.cxx"
120 #include "SALOMEDSTest_UseCase.cxx"
121
122
123 // ============================================================================
124 /*!
125  * Set up the environment
126  */
127 // ============================================================================
128  
129 void SALOMEDSTest_Embedded::setUp()
130 {  
131   int argc = 1;
132   char* argv[] = {(char*)""};
133
134   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
135   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
136   _orb = init(argc , argv ) ;
137   SALOME_NamingService NS(_orb);
138   CORBA::Object_var obj = NS.Resolve( "/myStudyManager_embedded" );
139   _sm = SALOMEDS::StudyManager::_narrow( obj );
140
141   CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); 
142 }