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);
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();
Destroy_Name(contList[ind].c_str());
Destroy_Directory(Path);
-
- Destroy_Name(Path);
}
}
NSTEST::echo_var anEchoRef = myFactory->createInstance();
_NS.Register(anEchoRef,
- "/Containers/theHostName/theContaine:rName/theComponentName");
+ "/Containers/theHostName/theContainerName/theComponentName");
obj = _NS.ResolveComponent("theHostName",
"theContainerName",
// ============================================================================
/*!
- * 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();
}
// ============================================================================