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