Version: 7.8.0
NamingServiceTest.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 #ifndef _NAMINGSERVICETEST_HXX_
24 #define _NAMINGSERVICETEST_HXX_
25 
26 #include <cppunit/extensions/HelperMacros.h>
27 #include "SALOME_NamingService.hxx"
28 
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(nstest)
31 
32 #ifdef WIN32
33 # if defined NAMINGSERVICETEST_EXPORTS || defined NamingServiceTest_EXPORTS
34 # define NAMINGSERVICETEST_EXPORT __declspec( dllexport )
35 # else
36 # define NAMINGSERVICETEST_EXPORT __declspec( dllimport )
37 # endif
38 #else
39 # define NAMINGSERVICETEST_EXPORT
40 #endif
41 
42 class NAMINGSERVICETEST_EXPORT NSTEST_echo_i : public virtual POA_NSTEST::echo,
43  public virtual PortableServer::ServantBase
44 {
45 public:
46  NSTEST_echo_i();
47  NSTEST_echo_i(CORBA::Long num);
48  ~NSTEST_echo_i();
49  CORBA::Long getId();
50 private:
51  int _num;
52 };
53 
54 class NSTEST_aFactory_i : public virtual POA_NSTEST::aFactory,
55  public virtual PortableServer::ServantBase
56 {
57 public:
60  NSTEST::echo_ptr createInstance();
61 private:
62  int _num;
63 };
64 
65 class NAMINGSERVICETEST_EXPORT NamingServiceTest : public CppUnit::TestFixture
66 {
67  CPPUNIT_TEST_SUITE( NamingServiceTest );
68  CPPUNIT_TEST( testConstructorDefault );
69  CPPUNIT_TEST( testConstructorOrb );
70  CPPUNIT_TEST( testRegisterResolveAbsNoPath );
71  CPPUNIT_TEST( testRegisterResolveRelativeNoPath );
72  CPPUNIT_TEST( testRegisterResolveAbsWithPath );
73  CPPUNIT_TEST( testRegisterResolveRelativeWithPath );
74  CPPUNIT_TEST( testResolveBadName );
75  CPPUNIT_TEST( testResolveBadNameRelative );
76  CPPUNIT_TEST( testResolveFirst );
77  CPPUNIT_TEST( testResolveFirstRelative );
78  CPPUNIT_TEST( testResolveFirstUnknown );
79  CPPUNIT_TEST( testResolveFirstUnknownRelative );
80  CPPUNIT_TEST( testResolveComponentOK );
81  CPPUNIT_TEST( testResolveComponentEmptyHostname );
82  CPPUNIT_TEST( testResolveComponentUnknownHostname );
83  CPPUNIT_TEST( testResolveComponentEmptyContainerName );
84  CPPUNIT_TEST( testResolveComponentUnknownContainerName );
85  CPPUNIT_TEST( testResolveComponentEmptyComponentName );
86  CPPUNIT_TEST( testResolveComponentUnknownComponentName );
87  CPPUNIT_TEST( testResolveComponentFalseNbproc );
88  CPPUNIT_TEST( testContainerName );
89  CPPUNIT_TEST( testContainerNameParams );
90  CPPUNIT_TEST( testBuildContainerNameForNS );
91  CPPUNIT_TEST( testBuildContainerNameForNSParams );
92  CPPUNIT_TEST( testFind );
93  CPPUNIT_TEST( testCreateDirectory );
94  CPPUNIT_TEST( testChangeDirectory );
95  CPPUNIT_TEST( testCurrentDirectory );
96  CPPUNIT_TEST( testList );
97  CPPUNIT_TEST( testListDirectory );
98  CPPUNIT_TEST( testListDirectoryRecurs );
99  CPPUNIT_TEST( testListSubdirs );
100  CPPUNIT_TEST( testDestroyName );
101  CPPUNIT_TEST( testDestroyDirectory );
102  CPPUNIT_TEST( testDestroyFullDirectory );
103  CPPUNIT_TEST( testGetIorAddr );
104 // CPPUNIT_TEST( );
105 // CPPUNIT_TEST( );
106 // CPPUNIT_TEST( );
107 
108  CPPUNIT_TEST_SUITE_END();
109 
110 public:
111 
112  void setUp();
113  void tearDown();
114 
115  void testConstructorDefault();
116  void testConstructorOrb();
117  void testRegisterResolveAbsNoPath();
118  void testRegisterResolveRelativeNoPath();
119  void testRegisterResolveAbsWithPath();
120  void testRegisterResolveRelativeWithPath();
121  void testResolveBadName();
122  void testResolveBadNameRelative();
123  void testResolveFirst();
124  void testResolveFirstRelative();
125  void testResolveFirstUnknown();
126  void testResolveFirstUnknownRelative();
127  void testResolveComponentOK();
128  void testResolveComponentEmptyHostname();
129  void testResolveComponentUnknownHostname();
130  void testResolveComponentEmptyContainerName();
131  void testResolveComponentUnknownContainerName();
132  void testResolveComponentEmptyComponentName();
133  void testResolveComponentUnknownComponentName();
134  void testResolveComponentFalseNbproc();
135  void testContainerName();
136  void testContainerNameParams();
137  void testBuildContainerNameForNS();
138  void testBuildContainerNameForNSParams();
139  void testFind();
140  void testCreateDirectory();
141  void testChangeDirectory();
142  void testCurrentDirectory();
143  void testList();
144  void testListDirectory();
145  void testListDirectoryRecurs();
146  void testListSubdirs();
147  void testDestroyName();
148  void testDestroyDirectory();
149  void testDestroyFullDirectory();
150  void testGetIorAddr();
151 
152 protected:
153  void _destroyDirectoryRecurs(std::string path);
154 
155  CORBA::ORB_var _orb;
157 
158  PortableServer::POA_var _root_poa;
159  PortableServer::POAManager_var _pman;
160  PortableServer::ObjectId_var _myFactoryId;
162  CORBA::Object_var _factoryRef;
163 };
164 
165 #endif