]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: clean Naming service directory /containers after tests
authorprascle <prascle>
Mon, 5 Dec 2005 11:06:47 +0000 (11:06 +0000)
committerprascle <prascle>
Mon, 5 Dec 2005 11:06:47 +0000 (11:06 +0000)
src/NamingService/Test/NamingServiceTest.cxx
src/NamingService/Test/NamingServiceTest.hxx

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;