Salome HOME
#18963 Minimize compiler warnings
[modules/kernel.git] / src / NamingService / Test / NamingServiceTest.cxx
index dcad83bc789da2005c33062f5aa74240d53fbd56..79f168fad47c1546264a07131c63f218292db3b8 100644 (file)
@@ -1,7 +1,32 @@
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include "NamingServiceTest.hxx"
 #include "Utils_ORB_INIT.hxx"
 #include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "utilities.h"
 
 #include <iostream>
 #include <fstream>
@@ -9,7 +34,6 @@
 #include <cstdlib>
 #include <cstdio>
 
-using namespace std;
 
 // --- uncomment to have some traces on standard error
 //     (useful only when adding new tests...)
@@ -23,7 +47,9 @@ using namespace std;
 #define DEVTRACE(msg)
 #endif
 
-#define TRACEFILE "/tmp/traceUnitTest.log"
+#ifdef WIN32
+#define setenv Kernel_Utils::setenv
+#endif
 
 // ============================================================================
 /*!
@@ -70,12 +96,13 @@ NSTEST::echo_ptr NSTEST_aFactory_i::createInstance()
   NSTEST_echo_i * anEcho = new NSTEST_echo_i(_num);
   _num++;
   NSTEST::echo_var anEchoRef = anEcho->_this();
+  anEcho->_remove_ref();
   return anEchoRef._retn();
 }
 
 // ============================================================================
 /*!
- * Set Trace mecanism
+ * Set Trace mechanism
  * - delete preexisting trace classes if any
  * - set trace on file
  * Get or initialize the orb
@@ -83,7 +110,14 @@ NSTEST::echo_ptr NSTEST_aFactory_i::createInstance()
  */
 // ============================================================================
 
-void 
+std::string
+NamingServiceTest::_getTraceFileName()
+{
+  std::string dir = Kernel_Utils::GetTmpDir();
+  return dir + "traceUnitTest-NamingServiceTest.log";
+}
+
+void
 NamingServiceTest::setUp()
 {
   LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
@@ -91,17 +125,17 @@ NamingServiceTest::setUp()
   bp1->deleteInstance(bp1);
 
   // --- trace on file
-  char *theFileName = TRACEFILE;
+  std::string theFileName = _getTraceFileName();
 
-  string s = "file:";
+  std::string s = "file:";
   s += theFileName;
   //s="local";
   //s="with_logger";
   CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
 
-  ofstream traceFile;
+  std::ofstream traceFile;
   //  traceFile.open(theFileName, ios::out | ios::trunc);
-  traceFile.open(theFileName, ios::out | ios::app);
+  traceFile.open(theFileName.c_str(), std::ios::out | std::ios::app);
   CPPUNIT_ASSERT(traceFile); // file created empty, then closed
   traceFile.close();
 
@@ -111,7 +145,7 @@ NamingServiceTest::setUp()
   // --- Get or initialize the orb
 
   int _argc = 1;
-  char* _argv[] = {""};
+  char* _argv[] = {(char*)""};
   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
   _orb = init(_argc , _argv ) ;
@@ -130,7 +164,8 @@ NamingServiceTest::setUp()
   _myFactoryId = _root_poa->activate_object(_myFactory);
   _factoryRef = _myFactory->_this();
   _pman->activate();
-  
+  _myFactory->_remove_ref();
+
 }
 
 // ============================================================================
@@ -139,7 +174,7 @@ NamingServiceTest::setUp()
  */
 // ============================================================================
 
-void 
+void
 NamingServiceTest::tearDown()
 {
 
@@ -161,7 +196,7 @@ NamingServiceTest::testConstructorDefault()
   //CPPUNIT_ASSERT_THROW(NS.getIORaddr(),CORBA::Exception);
   NS.init_orb(_orb);
 
-  char *root = NS.getIORaddr();
+  CORBA::String_var root = NS.getIORaddr();
   CORBA::Object_var obj = _orb->string_to_object(root);
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
 
@@ -180,7 +215,7 @@ void
 NamingServiceTest::testConstructorOrb()
 {
   SALOME_NamingService  NS(_orb);
-  char *root = NS.getIORaddr();
+  CORBA::String_var root = NS.getIORaddr();
   CORBA::Object_var obj = _orb->string_to_object(root);
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
 
@@ -394,7 +429,7 @@ NamingServiceTest::testResolveFirst()
     {
       NSTEST::echo_var anEchoRef = myFactory->createInstance();
       ref[i] = anEchoRef->getId();
-      string name = "/nstestfirst/echo_";
+      std::string name = "/nstestfirst/echo_";
       char anum[10];
       sprintf(anum,"%d",ref[i]);
       name += anum;
@@ -403,7 +438,7 @@ NamingServiceTest::testResolveFirst()
 
   for (int i=0; i<NB_OBJS; i++)
     {
-      string name = "/nstestfirst/echo_";
+      std::string name = "/nstestfirst/echo_";
       char anum[10];
       sprintf(anum,"%d",ref[i]);
       name += anum;
@@ -414,7 +449,7 @@ NamingServiceTest::testResolveFirst()
       CPPUNIT_ASSERT(anEchoRef->getId() == ref[i]);
     }
 
-  string name = "/nstestfirst/echo";
+  std::string name = "/nstestfirst/echo";
   obj = _NS.ResolveFirst(name.c_str());
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
   NSTEST::echo_var anEchoRef = NSTEST::echo::_narrow(obj);
@@ -427,7 +462,7 @@ NamingServiceTest::testResolveFirst()
  * Test register and resolve multiple objects, test resolveFirst, relative path
  * Register a few objects in /nstestfirstrel/echo_n where n is the object id.
  * Resolve all the objects.
- * ResolveFirst echo with a relative path /nstestfirstrel must give 
+ * ResolveFirst echo with a relative path /nstestfirstrel must give
  * /nstestfirst/echo_i, corresponding to the first object.
  */
 // ============================================================================
@@ -446,7 +481,7 @@ NamingServiceTest::testResolveFirstRelative()
     {
       NSTEST::echo_var anEchoRef = myFactory->createInstance();
       ref[i] = anEchoRef->getId();
-      string name = "/nstestfirstrel/echo_";
+      std::string name = "/nstestfirstrel/echo_";
       char anum[10];
       sprintf(anum,"%d",ref[i]);
       name += anum;
@@ -456,7 +491,7 @@ NamingServiceTest::testResolveFirstRelative()
   for (int i=0; i<NB_OBJS; i++)
     {
       _NS.Change_Directory("/nstestfirstrel");
-      string name = "echo_";
+      std::string name = "echo_";
       char anum[10];
       sprintf(anum,"%d",ref[i]);
       name += anum;
@@ -468,7 +503,7 @@ NamingServiceTest::testResolveFirstRelative()
     }
 
   _NS.Change_Directory("/nstestfirstrel");
-  string name = "echo";
+  std::string name = "echo";
   obj = _NS.ResolveFirst(name.c_str());
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
 }
@@ -482,7 +517,7 @@ NamingServiceTest::testResolveFirstRelative()
 void
 NamingServiceTest::testResolveFirstUnknown()
 {
-  string name = "/notYeyRegistered";
+  std::string name = "/notYeyRegistered";
   CORBA::Object_var obj= _NS.ResolveFirst(name.c_str());
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 
@@ -507,7 +542,7 @@ NamingServiceTest::testResolveFirstUnknownRelative()
   _NS.Create_Directory("/myContext");
   _NS.Change_Directory("/myContext");
 
-  string name = "RelnotYeyRegistered";
+  std::string name = "RelnotYeyRegistered";
   CORBA::Object_var obj = _NS.ResolveFirst(name.c_str());
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 
@@ -536,11 +571,11 @@ NamingServiceTest::testResolveComponentOK()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("theHostName",
-                            "theContainerName",
-                            "theComponentName");
+                             "theContainerName",
+                             "theComponentName");
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
   NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
   CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
@@ -549,12 +584,12 @@ NamingServiceTest::testResolveComponentOK()
 
   NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
   _NS.Register(anEchoRef2,
-              "/Containers/theHostName/theContainerName_2/theComponentName");
+               "/Containers/theHostName/theContainerName_2/theComponentName");
 
   obj = _NS.ResolveComponent("theHostName",
-                            "theContainerName",
-                            "theComponentName",
-                            2);
+                             "theContainerName",
+                             "theComponentName",
+                             2);
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
   NSTEST::echo_var anEchoRefb = NSTEST::echo::_narrow(obj);
   CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefb));
@@ -577,11 +612,11 @@ NamingServiceTest::testResolveComponentEmptyHostname()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("",
-                            "theContainerName",
-                            "theComponentName");
+                             "theContainerName",
+                             "theComponentName");
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 }
 
@@ -601,11 +636,11 @@ NamingServiceTest::testResolveComponentUnknownHostname()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("anUnknownHostName",
-                            "theContainerName",
-                            "theComponentName");
+                             "theContainerName",
+                             "theComponentName");
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 }
 
@@ -629,24 +664,24 @@ NamingServiceTest::testResolveComponentEmptyContainerName()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
   _NS.Register(anEchoRef2,
-              "/Containers/theHostName/aContainerName/aComponentName");
+               "/Containers/theHostName/aContainerName/aComponentName");
 
   NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
   _NS.Register(anEchoRef3,
-              "/Containers/theHostName/otherContainerName/theComponentName");
+               "/Containers/theHostName/otherContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("anUnknownHostName",
-                            "",
-                            "theComponentName");
+                             "",
+                             "theComponentName");
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 
   obj = _NS.ResolveComponent("theHostName",
-                            "",
-                            "theComponentName");
+                             "",
+                             "theComponentName");
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
   NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
   CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
@@ -655,7 +690,7 @@ NamingServiceTest::testResolveComponentEmptyContainerName()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -669,25 +704,25 @@ NamingServiceTest::testResolveComponentUnknownContainerName()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
   _NS.Register(anEchoRef2,
-              "/Containers/theHostName/aContainerName/aComponentName");
+               "/Containers/theHostName/aContainerName/aComponentName");
 
   NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
   _NS.Register(anEchoRef3,
-              "/Containers/theHostName/otherContainerName/theComponentName");
+               "/Containers/theHostName/otherContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("theHostName",
-                            "anUnknownContainerName",
-                            "theComponentName");
+                             "anUnknownContainerName",
+                             "theComponentName");
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 }
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -701,21 +736,21 @@ NamingServiceTest::testResolveComponentEmptyComponentName()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
   _NS.Register(anEchoRef2,
-              "/Containers/theHostName/EmptyContainerName/");
+               "/Containers/theHostName/EmptyContainerName/");
 
   obj = _NS.ResolveComponent("theHostName",
-                            "EmptyContainerName",
-                            "");
+                             "EmptyContainerName",
+                             "");
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 }
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -729,17 +764,17 @@ NamingServiceTest::testResolveComponentUnknownComponentName()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("theHostName",
-                            "theContainerName",
-                            "anUnknownComponentName");
+                             "theContainerName",
+                             "anUnknownComponentName");
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 }
 
 // ============================================================================
 /*!
- * Test with a false number nbproc. 
+ * Test with a false number nbproc.
  * A positive number not corresponding to a registered component gives nil ref.
  * A negative number is not taken into account and may give a non nil ref.
  */
@@ -755,32 +790,32 @@ NamingServiceTest::testResolveComponentFalseNbproc()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   obj = _NS.ResolveComponent("theHostName",
-                            "theContainerName",
-                            "theComponentName",
-                            25);
+                             "theContainerName",
+                             "theComponentName",
+                             25);
   CPPUNIT_ASSERT(CORBA::is_nil(obj));
 
   obj = _NS.ResolveComponent("theHostName",
-                            "theContainerName",
-                            "theComponentName",
-                            -25);
+                             "theContainerName",
+                             "theComponentName",
+                             -25);
   CPPUNIT_ASSERT(! CORBA::is_nil(obj));
 }
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
 void
 NamingServiceTest::testContainerName()
 {
-  string ref0 = "FactoryServer";
-  string ret = _NS.ContainerName("");
+  std::string ref0 = "FactoryServer";
+  std::string ret = _NS.ContainerName("");
   CPPUNIT_ASSERT(ret == ref0);
 
   ref0 = "MyContainerName";
@@ -790,25 +825,18 @@ NamingServiceTest::testContainerName()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
 void
 NamingServiceTest::testContainerNameParams()
 {
-  Engines::MachineParameters params;
-  params.container_name = "";
-  params.hostname = "";
-  params.OS = "";
-  params.mem_mb = 0;
-  params.cpu_clock = 0;
-  params.nb_proc_per_node = 0;
-  params.nb_node = 0;
-  params.isMPI = false;
-
-  string ref0 = "FactoryServer";
-  string ret = _NS.ContainerName(params);
+  Engines::ContainerParameters params;
+  SALOME_LifeCycleCORBA::preSet(params);
+
+  std::string ref0 = "FactoryServer";
+  std::string ret = _NS.ContainerName(params);
   CPPUNIT_ASSERT(ret == ref0);
 
   ref0 = "MyContainerName";
@@ -819,15 +847,15 @@ NamingServiceTest::testContainerNameParams()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
 void
 NamingServiceTest::testBuildContainerNameForNS()
 {
-  string ref0 = "/Containers/theHostName/theContainerName";
-  string ret = _NS.BuildContainerNameForNS("theContainerName","theHostName");
+  std::string ref0 = "/Containers/theHostName/theContainerName";
+  std::string ret = _NS.BuildContainerNameForNS("theContainerName","theHostName");
   CPPUNIT_ASSERT(ret == ref0);
 
   ref0 = "/Containers/theHostName/FactoryServer";
@@ -837,26 +865,19 @@ NamingServiceTest::testBuildContainerNameForNS()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
 void
 NamingServiceTest::testBuildContainerNameForNSParams()
 {
-  Engines::MachineParameters params;
-  params.container_name = "";
-  params.hostname = "";
-  params.OS = "";
-  params.mem_mb = 0;
-  params.cpu_clock = 0;
-  params.nb_proc_per_node = 0;
-  params.nb_node = 0;
-  params.isMPI = false;
+  Engines::ContainerParameters params;
+  SALOME_LifeCycleCORBA::preSet(params);
 
   params.container_name = "theContainerName";
-  string ref0 = "/Containers/theHostName/theContainerName";
-  string ret = _NS.BuildContainerNameForNS(params,"theHostName");
+  std::string ref0 = "/Containers/theHostName/theContainerName";
+  std::string ret = _NS.BuildContainerNameForNS(params,"theHostName");
   CPPUNIT_ASSERT(ret == ref0);
 
   params.container_name = "";
@@ -867,7 +888,7 @@ NamingServiceTest::testBuildContainerNameForNSParams()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -881,19 +902,19 @@ NamingServiceTest::testFind()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
   _NS.Register(anEchoRef2,
-              "/Containers/theHostName/aContainerName/aComponentName");
+               "/Containers/theHostName/aContainerName/aComponentName");
 
   NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
   _NS.Register(anEchoRef3,
-              "/Containers/theHostName/otherContainerName/theComponentName");
+               "/Containers/theHostName/otherContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef4 = myFactory->createInstance();
   _NS.Register(anEchoRef4,
-              "/Containers/anHostName/oneContainerName/theComponentName");
+               "/Containers/anHostName/oneContainerName/theComponentName");
 
   _NS.Change_Directory("/Containers");
   int occ= _NS.Find("theComponentName");
@@ -910,7 +931,7 @@ NamingServiceTest::testFind()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -928,13 +949,13 @@ NamingServiceTest::testCreateDirectory()
   _NS.Change_Directory("/aaa/bbb/ccc/ddd/eee");
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   int val = anEchoRef->getId();
-  string name = "echo_";
+  std::string name = "echo_";
   char anum[10];
   sprintf(anum,"%d",val);
   name += anum;
   _NS.Register(anEchoRef,name.c_str());
 
-  string dirname = "/aaa/bbb/ccc/ddd/eee/";
+  std::string dirname = "/aaa/bbb/ccc/ddd/eee/";
   dirname += name;
   obj = _NS.Resolve(dirname.c_str());
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
@@ -957,7 +978,7 @@ NamingServiceTest::testCreateDirectory()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -971,24 +992,24 @@ NamingServiceTest::testChangeDirectory()
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef,
-              "/Containers/theHostName/theContainerName/theComponentName");
+               "/Containers/theHostName/theContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef2 = myFactory->createInstance();
   _NS.Register(anEchoRef2,
-              "/Containers/theHostName/aContainerName/aComponentName");
+               "/Containers/theHostName/aContainerName/aComponentName");
 
   NSTEST::echo_var anEchoRef3 = myFactory->createInstance();
   _NS.Register(anEchoRef3,
-              "/Containers/theHostName/otherContainerName/theComponentName");
+               "/Containers/theHostName/otherContainerName/theComponentName");
 
   NSTEST::echo_var anEchoRef4 = myFactory->createInstance();
   _NS.Register(anEchoRef4,
-              "/Containers/anHostName/oneContainerName/theComponentName");
-  
+               "/Containers/anHostName/oneContainerName/theComponentName");
+
   _NS.Change_Directory("/Containers/theHostName/otherContainerName");
   obj = _NS.Resolve("theComponentName");
   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
-  
+
   NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
   CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
   CPPUNIT_ASSERT(anEchoRefa->getId() == anEchoRef3->getId());
@@ -996,25 +1017,27 @@ NamingServiceTest::testChangeDirectory()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
 void
 NamingServiceTest::testCurrentDirectory()
 {
-  string path = "/aaa/bbb/ccc/ddd/eee";
+  std::string path = "/aaa/bbb/ccc/ddd/eee";
   bool ret = _NS.Create_Directory(path.c_str());
   CPPUNIT_ASSERT(ret);
 
   _NS.Change_Directory(path.c_str());
-  string curdir = _NS.Current_Directory();
+  char* acurdir = _NS.Current_Directory();
+  std::string curdir = acurdir;
+  free(acurdir);
   CPPUNIT_ASSERT(curdir == path);
 }
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -1029,7 +1052,7 @@ NamingServiceTest::testList()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -1044,7 +1067,7 @@ NamingServiceTest::testListDirectory()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -1062,7 +1085,7 @@ NamingServiceTest::testListDirectoryRecurs()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -1078,7 +1101,7 @@ NamingServiceTest::testListSubdirs()
 }
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -1090,7 +1113,7 @@ NamingServiceTest::testDestroyName()
   NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
   CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
 
-  string path = "/Containers/theHostName/theContainerName/theComponentName";
+  std::string path = "/Containers/theHostName/theContainerName/theComponentName";
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef, path.c_str());
@@ -1105,7 +1128,7 @@ NamingServiceTest::testDestroyName()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
@@ -1117,7 +1140,7 @@ NamingServiceTest::testDestroyDirectory()
   NSTEST::aFactory_var myFactory = NSTEST::aFactory::_narrow(obj);
   CPPUNIT_ASSERT(!CORBA::is_nil(myFactory));
 
-  string path = "/Containers/theHostName/theContainerName/theComponentName";
+  std::string path = "/Containers/theHostName/theContainerName/theComponentName";
 
   NSTEST::echo_var anEchoRef = myFactory->createInstance();
   _NS.Register(anEchoRef, path.c_str());
@@ -1139,22 +1162,22 @@ NamingServiceTest::testDestroyDirectory()
  */
 // ============================================================================
 
-void NamingServiceTest::_destroyDirectoryRecurs(string path)
+void NamingServiceTest::_destroyDirectoryRecurs(std::string path)
 {
-  string current = path;
+  std::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);
-       }
+      std::vector<std::string> subdirs = _NS.list_subdirs();
+      for (size_t i=0; i<subdirs.size(); i++)
+        {
+          std::string subpath=path + "/" +subdirs[i];
+          _destroyDirectoryRecurs(subpath);
+        }
       if (_NS.Change_Directory(path.c_str()))
-       {
-         _NS.Destroy_FullDirectory(path.c_str());
-       }
+        {
+          _NS.Destroy_FullDirectory(path.c_str());
+        }
     }
 }
 
@@ -1163,10 +1186,10 @@ NamingServiceTest::testDestroyFullDirectory()
 {
   _NS.Destroy_FullDirectory("/Containers");
   CPPUNIT_ASSERT(_NS.Change_Directory("/Containers"));
-  vector<string> subdirs = _NS.list_subdirs();
+  std::vector<std::string> subdirs = _NS.list_subdirs();
   CPPUNIT_ASSERT(subdirs.size() >0);
   _NS.list_directory_recurs();
-  string path = "/Containers";
+  std::string path = "/Containers";
   _destroyDirectoryRecurs(path);
   CPPUNIT_ASSERT( ! _NS.Change_Directory("/Containers"));
   _NS.Change_Directory("/");
@@ -1176,21 +1199,21 @@ NamingServiceTest::testDestroyFullDirectory()
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================
 
 void
 NamingServiceTest::testGetIorAddr()
 {
-  char *root = _NS.getIORaddr();
+  CORBA::String_var root = _NS.getIORaddr();
   CORBA::Object_var obj = _orb->string_to_object(root);
-  CPPUNIT_ASSERT(!CORBA::is_nil(obj)); 
+  CPPUNIT_ASSERT(!CORBA::is_nil(obj));
 }
 
 // ============================================================================
 /*!
- * Test 
+ * Test
  */
 // ============================================================================