00001 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00021 // 00022 #ifndef _NAMINGSERVICETEST_HXX_ 00023 #define _NAMINGSERVICETEST_HXX_ 00024 00025 #include <cppunit/extensions/HelperMacros.h> 00026 #include "SALOME_NamingService.hxx" 00027 00028 #include <SALOMEconfig.h> 00029 #include CORBA_SERVER_HEADER(nstest) 00030 00031 class NSTEST_echo_i : public virtual POA_NSTEST::echo, 00032 public virtual PortableServer::ServantBase 00033 { 00034 public: 00035 NSTEST_echo_i(); 00036 NSTEST_echo_i(CORBA::Long num); 00037 ~NSTEST_echo_i(); 00038 CORBA::Long getId(); 00039 private: 00040 int _num; 00041 }; 00042 00043 class NSTEST_aFactory_i : public virtual POA_NSTEST::aFactory, 00044 public virtual PortableServer::ServantBase 00045 { 00046 public: 00047 NSTEST_aFactory_i(); 00048 ~NSTEST_aFactory_i(); 00049 NSTEST::echo_ptr createInstance(); 00050 private: 00051 int _num; 00052 }; 00053 00054 class NamingServiceTest : public CppUnit::TestFixture 00055 { 00056 CPPUNIT_TEST_SUITE( NamingServiceTest ); 00057 CPPUNIT_TEST( testConstructorDefault ); 00058 CPPUNIT_TEST( testConstructorOrb ); 00059 CPPUNIT_TEST( testRegisterResolveAbsNoPath ); 00060 CPPUNIT_TEST( testRegisterResolveRelativeNoPath ); 00061 CPPUNIT_TEST( testRegisterResolveAbsWithPath ); 00062 CPPUNIT_TEST( testRegisterResolveRelativeWithPath ); 00063 CPPUNIT_TEST( testResolveBadName ); 00064 CPPUNIT_TEST( testResolveBadNameRelative ); 00065 CPPUNIT_TEST( testResolveFirst ); 00066 CPPUNIT_TEST( testResolveFirstRelative ); 00067 CPPUNIT_TEST( testResolveFirstUnknown ); 00068 CPPUNIT_TEST( testResolveFirstUnknownRelative ); 00069 CPPUNIT_TEST( testResolveComponentOK ); 00070 CPPUNIT_TEST( testResolveComponentEmptyHostname ); 00071 CPPUNIT_TEST( testResolveComponentUnknownHostname ); 00072 CPPUNIT_TEST( testResolveComponentEmptyContainerName ); 00073 CPPUNIT_TEST( testResolveComponentUnknownContainerName ); 00074 CPPUNIT_TEST( testResolveComponentEmptyComponentName ); 00075 CPPUNIT_TEST( testResolveComponentUnknownComponentName ); 00076 CPPUNIT_TEST( testResolveComponentFalseNbproc ); 00077 CPPUNIT_TEST( testContainerName ); 00078 CPPUNIT_TEST( testContainerNameParams ); 00079 CPPUNIT_TEST( testBuildContainerNameForNS ); 00080 CPPUNIT_TEST( testBuildContainerNameForNSParams ); 00081 CPPUNIT_TEST( testFind ); 00082 CPPUNIT_TEST( testCreateDirectory ); 00083 CPPUNIT_TEST( testChangeDirectory ); 00084 CPPUNIT_TEST( testCurrentDirectory ); 00085 CPPUNIT_TEST( testList ); 00086 CPPUNIT_TEST( testListDirectory ); 00087 CPPUNIT_TEST( testListDirectoryRecurs ); 00088 CPPUNIT_TEST( testListSubdirs ); 00089 CPPUNIT_TEST( testDestroyName ); 00090 CPPUNIT_TEST( testDestroyDirectory ); 00091 CPPUNIT_TEST( testDestroyFullDirectory ); 00092 CPPUNIT_TEST( testGetIorAddr ); 00093 // CPPUNIT_TEST( ); 00094 // CPPUNIT_TEST( ); 00095 // CPPUNIT_TEST( ); 00096 00097 CPPUNIT_TEST_SUITE_END(); 00098 00099 public: 00100 00101 void setUp(); 00102 void tearDown(); 00103 00104 void testConstructorDefault(); 00105 void testConstructorOrb(); 00106 void testRegisterResolveAbsNoPath(); 00107 void testRegisterResolveRelativeNoPath(); 00108 void testRegisterResolveAbsWithPath(); 00109 void testRegisterResolveRelativeWithPath(); 00110 void testResolveBadName(); 00111 void testResolveBadNameRelative(); 00112 void testResolveFirst(); 00113 void testResolveFirstRelative(); 00114 void testResolveFirstUnknown(); 00115 void testResolveFirstUnknownRelative(); 00116 void testResolveComponentOK(); 00117 void testResolveComponentEmptyHostname(); 00118 void testResolveComponentUnknownHostname(); 00119 void testResolveComponentEmptyContainerName(); 00120 void testResolveComponentUnknownContainerName(); 00121 void testResolveComponentEmptyComponentName(); 00122 void testResolveComponentUnknownComponentName(); 00123 void testResolveComponentFalseNbproc(); 00124 void testContainerName(); 00125 void testContainerNameParams(); 00126 void testBuildContainerNameForNS(); 00127 void testBuildContainerNameForNSParams(); 00128 void testFind(); 00129 void testCreateDirectory(); 00130 void testChangeDirectory(); 00131 void testCurrentDirectory(); 00132 void testList(); 00133 void testListDirectory(); 00134 void testListDirectoryRecurs(); 00135 void testListSubdirs(); 00136 void testDestroyName(); 00137 void testDestroyDirectory(); 00138 void testDestroyFullDirectory(); 00139 void testGetIorAddr(); 00140 00141 protected: 00142 void _destroyDirectoryRecurs(std::string path); 00143 00144 CORBA::ORB_var _orb; 00145 SALOME_NamingService _NS; 00146 00147 PortableServer::POA_var _root_poa; 00148 PortableServer::POAManager_var _pman; 00149 PortableServer::ObjectId_var _myFactoryId; 00150 NSTEST_aFactory_i * _myFactory; 00151 CORBA::Object_var _factoryRef; 00152 }; 00153 00154 #endif