Salome HOME
Increment version number (prepare SALOME version 7.0.0)
[modules/kernel.git] / src / NamingService / Test / NamingServiceTest.hxx
1 // Copyright (C) 2007-2012  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 #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 class NSTEST_echo_i : public virtual POA_NSTEST::echo,
33                       public virtual PortableServer::ServantBase
34 {
35 public:
36   NSTEST_echo_i();
37   NSTEST_echo_i(CORBA::Long num);
38   ~NSTEST_echo_i();
39   CORBA::Long getId();
40 private:
41   int _num;
42 };
43
44 class NSTEST_aFactory_i : public virtual POA_NSTEST::aFactory,
45                           public virtual PortableServer::ServantBase
46 {
47 public:
48   NSTEST_aFactory_i();
49   ~NSTEST_aFactory_i();
50   NSTEST::echo_ptr createInstance();
51 private:
52   int _num;
53 };
54
55 class NamingServiceTest : public CppUnit::TestFixture
56 {
57   CPPUNIT_TEST_SUITE( NamingServiceTest );
58   CPPUNIT_TEST( testConstructorDefault );
59   CPPUNIT_TEST( testConstructorOrb );
60   CPPUNIT_TEST( testRegisterResolveAbsNoPath );
61   CPPUNIT_TEST( testRegisterResolveRelativeNoPath );
62   CPPUNIT_TEST( testRegisterResolveAbsWithPath );
63   CPPUNIT_TEST( testRegisterResolveRelativeWithPath );
64   CPPUNIT_TEST( testResolveBadName );
65   CPPUNIT_TEST( testResolveBadNameRelative );
66   CPPUNIT_TEST( testResolveFirst );
67   CPPUNIT_TEST( testResolveFirstRelative );
68   CPPUNIT_TEST( testResolveFirstUnknown );
69   CPPUNIT_TEST( testResolveFirstUnknownRelative );
70   CPPUNIT_TEST( testResolveComponentOK );
71   CPPUNIT_TEST( testResolveComponentEmptyHostname );
72   CPPUNIT_TEST( testResolveComponentUnknownHostname );
73   CPPUNIT_TEST( testResolveComponentEmptyContainerName );
74   CPPUNIT_TEST( testResolveComponentUnknownContainerName );
75   CPPUNIT_TEST( testResolveComponentEmptyComponentName );
76   CPPUNIT_TEST( testResolveComponentUnknownComponentName );
77   CPPUNIT_TEST( testResolveComponentFalseNbproc );
78   CPPUNIT_TEST( testContainerName );
79   CPPUNIT_TEST( testContainerNameParams );
80   CPPUNIT_TEST( testBuildContainerNameForNS );
81   CPPUNIT_TEST( testBuildContainerNameForNSParams );
82   CPPUNIT_TEST( testFind );
83   CPPUNIT_TEST( testCreateDirectory );
84   CPPUNIT_TEST( testChangeDirectory );
85   CPPUNIT_TEST( testCurrentDirectory );
86   CPPUNIT_TEST( testList );
87   CPPUNIT_TEST( testListDirectory );
88   CPPUNIT_TEST( testListDirectoryRecurs );
89   CPPUNIT_TEST( testListSubdirs );
90   CPPUNIT_TEST( testDestroyName );
91   CPPUNIT_TEST( testDestroyDirectory );
92   CPPUNIT_TEST( testDestroyFullDirectory );
93   CPPUNIT_TEST( testGetIorAddr );
94 //   CPPUNIT_TEST(  );
95 //   CPPUNIT_TEST(  );
96 //   CPPUNIT_TEST(  );
97
98   CPPUNIT_TEST_SUITE_END();
99
100 public:
101
102   void setUp();
103   void tearDown();
104
105   void testConstructorDefault();
106   void testConstructorOrb();
107   void testRegisterResolveAbsNoPath();
108   void testRegisterResolveRelativeNoPath();
109   void testRegisterResolveAbsWithPath();
110   void testRegisterResolveRelativeWithPath();
111   void testResolveBadName();
112   void testResolveBadNameRelative();
113   void testResolveFirst();
114   void testResolveFirstRelative();
115   void testResolveFirstUnknown();
116   void testResolveFirstUnknownRelative();
117   void testResolveComponentOK();
118   void testResolveComponentEmptyHostname();
119   void testResolveComponentUnknownHostname();
120   void testResolveComponentEmptyContainerName();
121   void testResolveComponentUnknownContainerName();
122   void testResolveComponentEmptyComponentName();
123   void testResolveComponentUnknownComponentName();
124   void testResolveComponentFalseNbproc();
125   void testContainerName();
126   void testContainerNameParams();
127   void testBuildContainerNameForNS();
128   void testBuildContainerNameForNSParams();
129   void testFind();
130   void testCreateDirectory();
131   void testChangeDirectory();
132   void testCurrentDirectory();
133   void testList();
134   void testListDirectory();
135   void testListDirectoryRecurs();
136   void testListSubdirs();
137   void testDestroyName();
138   void testDestroyDirectory();
139   void testDestroyFullDirectory();
140   void testGetIorAddr();
141
142 protected:
143   void _destroyDirectoryRecurs(std::string path);
144
145   CORBA::ORB_var _orb;
146   SALOME_NamingService _NS;
147
148   PortableServer::POA_var _root_poa;
149   PortableServer::POAManager_var _pman;
150   PortableServer::ObjectId_var _myFactoryId;
151   NSTEST_aFactory_i * _myFactory;
152   CORBA::Object_var _factoryRef;
153 };
154
155 #endif