]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: merge from BR_UT_V310a3 tag mergeto_trunk_06dec05
authorprascle <prascle>
Mon, 5 Dec 2005 11:16:00 +0000 (11:16 +0000)
committerprascle <prascle>
Mon, 5 Dec 2005 11:16:00 +0000 (11:16 +0000)
src/NamingService/SALOME_NamingService.cxx
src/NamingService/Test/NamingServiceTest.cxx
src/NamingService/Test/NamingServiceTest.hxx

index e0ad5fcd59e69d2487ca1d186878731643d8ce04..bce5f23380f99cd43714396c7f2400a235ebdcaa 100644 (file)
@@ -1293,7 +1293,7 @@ throw(ServiceUnreachable)
 void SALOME_NamingService::Destroy_Directory(const char* Path)
 throw(ServiceUnreachable)
 {
-  MESSAGE("BEGIN OF Destroy_Directory" << Path);
+  MESSAGE("BEGIN OF Destroy_Directory " << Path);
 
   Utils_Locker lock (&_myMutex);
 
@@ -1468,6 +1468,7 @@ throw(ServiceUnreachable)
 void SALOME_NamingService::Destroy_FullDirectory(const char* Path)
 throw(ServiceUnreachable)
 {
+  MESSAGE("begin of Destroy_FullDirectory " << Path);
   if( Change_Directory(Path) )
     {
       vector<string> contList = list_directory();
@@ -1476,8 +1477,6 @@ throw(ServiceUnreachable)
        Destroy_Name(contList[ind].c_str());
       
       Destroy_Directory(Path);
-      
-      Destroy_Name(Path);
     }
 }
 
index deedb2b6141ae49ade7df9a69a365b21c9cfaf02..dcad83bc789da2005c33062f5aa74240d53fbd56 100644 (file)
@@ -729,7 +729,7 @@ NamingServiceTest::testResolveComponentUnknownComponentName()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContaine:rName/theComponentName");
+              "/Containers/theHostName/theContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("theHostName",
                             "theContainerName",
@@ -1134,16 +1134,44 @@ NamingServiceTest::testDestroyDirectory()
 
 // ============================================================================
 /*!
- * Test 
+ * DestroyFullDirectory is not recursive
+ * Need Housekeeping of /Containers for further tests !
  */
 // ============================================================================
 
+void NamingServiceTest::_destroyDirectoryRecurs(string path)
+{
+  string current = path;
+  SCRUTE(path);
+  if (_NS.Change_Directory(path.c_str()))
+    {
+      vector<string> subdirs = _NS.list_subdirs();
+      for (int i=0; i<subdirs.size(); i++)
+       {
+         string subpath=path + "/" +subdirs[i];
+         _destroyDirectoryRecurs(subpath);
+       }
+      if (_NS.Change_Directory(path.c_str()))
+       {
+         _NS.Destroy_FullDirectory(path.c_str());
+       }
+    }
+}
+
 void
 NamingServiceTest::testDestroyFullDirectory()
 {
   _NS.Destroy_FullDirectory("/Containers");
+  CPPUNIT_ASSERT(_NS.Change_Directory("/Containers"));
+  vector<string> subdirs = _NS.list_subdirs();
+  CPPUNIT_ASSERT(subdirs.size() >0);
+  _NS.list_directory_recurs();
+  string path = "/Containers";
+  _destroyDirectoryRecurs(path);
+  CPPUNIT_ASSERT( ! _NS.Change_Directory("/Containers"));
   _NS.Change_Directory("/");
   _NS.list_subdirs();
+  _NS.list_directory_recurs();
 }
 
 // ============================================================================
index 3630c104327ccd5d63fc00ffbc29f66513bc42ea..52909c5d707ea21f8b73e539ee7bf3d2100e2bc8 100644 (file)
@@ -119,6 +119,8 @@ public:
   void testGetIorAddr();
 
 protected:
+  void _destroyDirectoryRecurs(std::string path);
+
   CORBA::ORB_var _orb;
   SALOME_NamingService _NS;