Salome HOME
projects
/
modules
/
kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master into V9_dev
[modules/kernel.git]
/
src
/
NamingService
/
Test
/
NamingServiceTest.cxx
diff --git
a/src/NamingService/Test/NamingServiceTest.cxx
b/src/NamingService/Test/NamingServiceTest.cxx
index 8f8cf52fc38eb0629458610c843c6af2687c8f04..9daff2e34f3c77b254b5c103a128ab96e986386e 100644
(file)
--- a/
src/NamingService/Test/NamingServiceTest.cxx
+++ b/
src/NamingService/Test/NamingServiceTest.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
6
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
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-24,7
+24,9
@@
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "Basics_Utils.hxx"
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
+#include "utilities.h"
#include <iostream>
#include <fstream>
#include <iostream>
#include <fstream>
@@
-47,9
+49,7
@@
#ifdef WIN32
#define setenv Kernel_Utils::setenv
#ifdef WIN32
#define setenv Kernel_Utils::setenv
-#endif
-
-#define TRACEFILE "/tmp/traceUnitTest.log"
+#endif
// ============================================================================
/*!
// ============================================================================
/*!
@@
-110,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();
NamingServiceTest::setUp()
{
LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
@@
-118,7
+125,7
@@
NamingServiceTest::setUp()
bp1->deleteInstance(bp1);
// --- trace on file
bp1->deleteInstance(bp1);
// --- trace on file
-
const char *theFileName = TRACEFILE
;
+
std::string theFileName = _getTraceFileName()
;
std::string s = "file:";
s += theFileName;
std::string s = "file:";
s += theFileName;
@@
-128,7
+135,7
@@
NamingServiceTest::setUp()
std::ofstream traceFile;
// traceFile.open(theFileName, ios::out | ios::trunc);
std::ofstream traceFile;
// traceFile.open(theFileName, ios::out | ios::trunc);
- traceFile.open(theFileName, std::ios::out | std::ios::app);
+ traceFile.open(theFileName
.c_str()
, std::ios::out | std::ios::app);
CPPUNIT_ASSERT(traceFile); // file created empty, then closed
traceFile.close();
CPPUNIT_ASSERT(traceFile); // file created empty, then closed
traceFile.close();
@@
-158,7
+165,7
@@
NamingServiceTest::setUp()
_factoryRef = _myFactory->_this();
_pman->activate();
_myFactory->_remove_ref();
_factoryRef = _myFactory->_this();
_pman->activate();
_myFactory->_remove_ref();
-
+
}
// ============================================================================
}
// ============================================================================
@@
-167,7
+174,7
@@
NamingServiceTest::setUp()
*/
// ============================================================================
*/
// ============================================================================
-void
+void
NamingServiceTest::tearDown()
{
NamingServiceTest::tearDown()
{
@@
-455,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.
* 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.
*/
// ============================================================================
* /nstestfirst/echo_i, corresponding to the first object.
*/
// ============================================================================
@@
-683,7
+690,7
@@
NamingServiceTest::testResolveComponentEmptyContainerName()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-715,7
+722,7
@@
NamingServiceTest::testResolveComponentUnknownContainerName()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-743,7
+750,7
@@
NamingServiceTest::testResolveComponentEmptyComponentName()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-767,7
+774,7
@@
NamingServiceTest::testResolveComponentUnknownComponentName()
// ============================================================================
/*!
// ============================================================================
/*!
- * 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.
*/
* 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.
*/
@@
-800,7
+807,7
@@
NamingServiceTest::testResolveComponentFalseNbproc()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-818,7
+825,7
@@
NamingServiceTest::testContainerName()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-840,7
+847,7
@@
NamingServiceTest::testContainerNameParams()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-858,7
+865,7
@@
NamingServiceTest::testBuildContainerNameForNS()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-881,7
+888,7
@@
NamingServiceTest::testBuildContainerNameForNSParams()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-924,7
+931,7
@@
NamingServiceTest::testFind()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-971,7
+978,7
@@
NamingServiceTest::testCreateDirectory()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-998,11
+1005,11
@@
NamingServiceTest::testChangeDirectory()
NSTEST::echo_var anEchoRef4 = myFactory->createInstance();
_NS.Register(anEchoRef4,
"/Containers/anHostName/oneContainerName/theComponentName");
NSTEST::echo_var anEchoRef4 = myFactory->createInstance();
_NS.Register(anEchoRef4,
"/Containers/anHostName/oneContainerName/theComponentName");
-
+
_NS.Change_Directory("/Containers/theHostName/otherContainerName");
obj = _NS.Resolve("theComponentName");
CPPUNIT_ASSERT(!CORBA::is_nil(obj));
_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());
NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
CPPUNIT_ASSERT(anEchoRefa->getId() == anEchoRef3->getId());
@@
-1010,7
+1017,7
@@
NamingServiceTest::testChangeDirectory()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1030,7
+1037,7
@@
NamingServiceTest::testCurrentDirectory()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1045,7
+1052,7
@@
NamingServiceTest::testList()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1060,7
+1067,7
@@
NamingServiceTest::testListDirectory()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1078,7
+1085,7
@@
NamingServiceTest::testListDirectoryRecurs()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1094,7
+1101,7
@@
NamingServiceTest::testListSubdirs()
}
// ============================================================================
/*!
}
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1121,7
+1128,7
@@
NamingServiceTest::testDestroyName()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1192,7
+1199,7
@@
NamingServiceTest::testDestroyFullDirectory()
// ============================================================================
/*!
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
*/
// ============================================================================
@@
-1201,12
+1208,12
@@
NamingServiceTest::testGetIorAddr()
{
CORBA::String_var root = _NS.getIORaddr();
CORBA::Object_var obj = _orb->string_to_object(root);
{
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
*/
// ============================================================================
*/
// ============================================================================