00001 // Copyright (C) 2007-2011 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 00023 #ifndef _NAMINGSERVICETEST_HXX_ 00024 #define _NAMINGSERVICETEST_HXX_ 00025 00026 #include <cppunit/extensions/HelperMacros.h> 00027 #include "SALOME_NamingService.hxx" 00028 00029 #include <SALOMEconfig.h> 00030 #include CORBA_SERVER_HEADER(nstest) 00031 00032 class NSTEST_echo_i : public virtual POA_NSTEST::echo, 00033 public virtual PortableServer::ServantBase 00034 { 00035 public: 00036 NSTEST_echo_i(); 00037 NSTEST_echo_i(CORBA::Long num); 00038 ~NSTEST_echo_i(); 00039 CORBA::Long getId(); 00040 private: 00041 int _num; 00042 }; 00043 00044 class NSTEST_aFactory_i : public virtual POA_NSTEST::aFactory, 00045 public virtual PortableServer::ServantBase 00046 { 00047 public: 00048 NSTEST_aFactory_i(); 00049 ~NSTEST_aFactory_i(); 00050 NSTEST::echo_ptr createInstance(); 00051 private: 00052 int _num; 00053 }; 00054 00055 class NamingServiceTest : public CppUnit::TestFixture 00056 { 00057 CPPUNIT_TEST_SUITE( NamingServiceTest ); 00058 CPPUNIT_TEST( testConstructorDefault ); 00059 CPPUNIT_TEST( testConstructorOrb ); 00060 CPPUNIT_TEST( testRegisterResolveAbsNoPath ); 00061 CPPUNIT_TEST( testRegisterResolveRelativeNoPath ); 00062 CPPUNIT_TEST( testRegisterResolveAbsWithPath ); 00063 CPPUNIT_TEST( testRegisterResolveRelativeWithPath ); 00064 CPPUNIT_TEST( testResolveBadName ); 00065 CPPUNIT_TEST( testResolveBadNameRelative ); 00066 CPPUNIT_TEST( testResolveFirst ); 00067 CPPUNIT_TEST( testResolveFirstRelative ); 00068 CPPUNIT_TEST( testResolveFirstUnknown ); 00069 CPPUNIT_TEST( testResolveFirstUnknownRelative ); 00070 CPPUNIT_TEST( testResolveComponentOK ); 00071 CPPUNIT_TEST( testResolveComponentEmptyHostname ); 00072 CPPUNIT_TEST( testResolveComponentUnknownHostname ); 00073 CPPUNIT_TEST( testResolveComponentEmptyContainerName ); 00074 CPPUNIT_TEST( testResolveComponentUnknownContainerName ); 00075 CPPUNIT_TEST( testResolveComponentEmptyComponentName ); 00076 CPPUNIT_TEST( testResolveComponentUnknownComponentName ); 00077 CPPUNIT_TEST( testResolveComponentFalseNbproc ); 00078 CPPUNIT_TEST( testContainerName ); 00079 CPPUNIT_TEST( testContainerNameParams ); 00080 CPPUNIT_TEST( testBuildContainerNameForNS ); 00081 CPPUNIT_TEST( testBuildContainerNameForNSParams ); 00082 CPPUNIT_TEST( testFind ); 00083 CPPUNIT_TEST( testCreateDirectory ); 00084 CPPUNIT_TEST( testChangeDirectory ); 00085 CPPUNIT_TEST( testCurrentDirectory ); 00086 CPPUNIT_TEST( testList ); 00087 CPPUNIT_TEST( testListDirectory ); 00088 CPPUNIT_TEST( testListDirectoryRecurs ); 00089 CPPUNIT_TEST( testListSubdirs ); 00090 CPPUNIT_TEST( testDestroyName ); 00091 CPPUNIT_TEST( testDestroyDirectory ); 00092 CPPUNIT_TEST( testDestroyFullDirectory ); 00093 CPPUNIT_TEST( testGetIorAddr ); 00094 // CPPUNIT_TEST( ); 00095 // CPPUNIT_TEST( ); 00096 // CPPUNIT_TEST( ); 00097 00098 CPPUNIT_TEST_SUITE_END(); 00099 00100 public: 00101 00102 void setUp(); 00103 void tearDown(); 00104 00105 void testConstructorDefault(); 00106 void testConstructorOrb(); 00107 void testRegisterResolveAbsNoPath(); 00108 void testRegisterResolveRelativeNoPath(); 00109 void testRegisterResolveAbsWithPath(); 00110 void testRegisterResolveRelativeWithPath(); 00111 void testResolveBadName(); 00112 void testResolveBadNameRelative(); 00113 void testResolveFirst(); 00114 void testResolveFirstRelative(); 00115 void testResolveFirstUnknown(); 00116 void testResolveFirstUnknownRelative(); 00117 void testResolveComponentOK(); 00118 void testResolveComponentEmptyHostname(); 00119 void testResolveComponentUnknownHostname(); 00120 void testResolveComponentEmptyContainerName(); 00121 void testResolveComponentUnknownContainerName(); 00122 void testResolveComponentEmptyComponentName(); 00123 void testResolveComponentUnknownComponentName(); 00124 void testResolveComponentFalseNbproc(); 00125 void testContainerName(); 00126 void testContainerNameParams(); 00127 void testBuildContainerNameForNS(); 00128 void testBuildContainerNameForNSParams(); 00129 void testFind(); 00130 void testCreateDirectory(); 00131 void testChangeDirectory(); 00132 void testCurrentDirectory(); 00133 void testList(); 00134 void testListDirectory(); 00135 void testListDirectoryRecurs(); 00136 void testListSubdirs(); 00137 void testDestroyName(); 00138 void testDestroyDirectory(); 00139 void testDestroyFullDirectory(); 00140 void testGetIorAddr(); 00141 00142 protected: 00143 void _destroyDirectoryRecurs(std::string path); 00144 00145 CORBA::ORB_var _orb; 00146 SALOME_NamingService _NS; 00147 00148 PortableServer::POA_var _root_poa; 00149 PortableServer::POAManager_var _pman; 00150 PortableServer::ObjectId_var _myFactoryId; 00151 NSTEST_aFactory_i * _myFactory; 00152 CORBA::Object_var _factoryRef; 00153 }; 00154 00155 #endif