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