#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#include "utilities.h"
#include <iostream>
#endif
#ifdef WIN32
#define setenv Kernel_Utils::setenv
-#endif
+#endif
-#define TRACEFILE "/tmp/traceUnitTest.log"
+std::string
+LifeCycleCORBATest::_getTraceFileName()
+{
+ std::string dir = Kernel_Utils::GetTmpDir();
+ return dir + "traceUnitTest-LifeCycleCORBATest.log";
+}
// ============================================================================
/*!
*/
// ============================================================================
-void
+void
LifeCycleCORBATest::setUp()
{
LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
bp1->deleteInstance(bp1);
// --- trace on file
- const char *theFileName = TRACEFILE;
+ std::string theFileName = _getTraceFileName();
std::string s = "file:";
s += theFileName;
std::ofstream traceFile;
// traceFile.open(theFileName, std::ios::out | std::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();
*/
// ============================================================================
-void
+void
LifeCycleCORBATest::tearDown()
{
/*!
* Check FindOrLoad_Component with a component name not in catalog.
* See list of catalog given to module catalog server.
- * Here, we work with KERNEL_SRC/resources/KERNELCatalog.xml that contains
+ * Here, we work with KERNEL_SRC/resources/KERNELCatalog.xml that contains
* only KERNEL, SalomeTestComponent and SALOME_TestComponentPy
*/
// ============================================================================
// ============================================================================
/*!
- * Check FindOrLoad_Component params = local container
+ * Check FindOrLoad_Component params = local container
*/
// ============================================================================
// ============================================================================
/*!
* Check FindOrLoad_Component with params on remote computer
- * params empty except hostname
+ * params empty except hostname
*/
// ============================================================================
std::string remoteHost = GetRemoteHost();
Engines::ContainerParameters params;
- _LCC.preSet(params);
+ _LCC.preSet(params);
params.resource_params.hostname = remoteHost.c_str();
Engines::EngineComponent_var mycompo1 =
std::string remoteHost = GetRemoteHost();
Engines::ContainerParameters params;
- _LCC.preSet(params);
+ _LCC.preSet(params);
params.resource_params.hostname = remoteHost.c_str();
params.container_name = "anotherContainer";
#define _LIFECYCLECORBATEST_HXX_
#include <cppunit/extensions/HelperMacros.h>
+#include <string>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_Component)
// void testFindOrLoad_Component_();
// void testFindOrLoad_Component_();
+ private:
+ std::string _getTraceFileName();
+
protected:
std::string GetRemoteHost();
CORBA::ORB_var _orb;
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "utilities.h"
#ifdef WIN32
#define setenv Kernel_Utils::setenv
-#endif
-
-#define TRACEFILE "/tmp/traceUnitTest.log"
+#endif
// ============================================================================
/*!
*/
// ============================================================================
-void
+std::string
+NamingServiceTest::_getTraceFileName()
+{
+ std::string dir = Kernel_Utils::GetTmpDir();
+ return dir + "traceUnitTest-NamingServiceTest.log";
+}
+
+void
NamingServiceTest::setUp()
{
LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
bp1->deleteInstance(bp1);
// --- trace on file
- const char *theFileName = TRACEFILE;
+ std::string theFileName = _getTraceFileName();
std::string s = "file:";
s += theFileName;
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();
_factoryRef = _myFactory->_this();
_pman->activate();
_myFactory->_remove_ref();
-
+
}
// ============================================================================
*/
// ============================================================================
-void
+void
NamingServiceTest::tearDown()
{
* 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.
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * 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.
*/
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
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));
-
+
NSTEST::echo_var anEchoRefa = NSTEST::echo::_narrow(obj);
CPPUNIT_ASSERT(!CORBA::is_nil(anEchoRefa));
CPPUNIT_ASSERT(anEchoRefa->getId() == anEchoRef3->getId());
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
}
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
{
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
*/
// ============================================================================
#include <cppunit/extensions/HelperMacros.h>
#include "SALOME_NamingService.hxx"
+#include <string>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(nstest)
void testDestroyFullDirectory();
void testGetIorAddr();
+ private:
+ std::string _getTraceFileName();
+
protected:
void _destroyDirectoryRecurs(std::string path);
#include <fstream>
#include <string>
#include <cstdlib>
+#include <cstdio>
#include "LocalTraceBufferPool.hxx"
#include "utilities.h"
#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#ifdef WIN32
#define setenv Kernel_Utils::setenv
-#endif
+#endif
// ============================================================================
/*!
*/
// ============================================================================
-void
+void
SALOMELocalTraceTest::setUp()
{
}
*/
// ============================================================================
-void
+void
SALOMELocalTraceTest::tearDown()
{
}
-#define TRACEFILE "/tmp/traceUnitTest.log"
+std::string
+SALOMELocalTraceTest::_getTraceFileName()
+{
+ std::string dir = Kernel_Utils::GetTmpDir();
+ return dir + "traceUnitTest-SALOMELocalTraceTest.log";
+}
// ============================================================================
/*!
*/
// ============================================================================
-void
+void
SALOMELocalTraceTest::testSingletonBufferPool()
{
// --- trace on file
- const char *theFileName = TRACEFILE;
+ std::string theFileName = _getTraceFileName();
std::string s = "file:";
s += theFileName;
CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
std::ofstream traceFile;
- 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();
*/
// ============================================================================
-void
+void
SALOMELocalTraceTest::testLoadBufferPoolLocal()
{
std::string s = "local";
*/
// ============================================================================
-void
+void
SALOMELocalTraceTest::testLoadBufferPoolFile()
{
- const char *theFileName = TRACEFILE;
+ std::string theFileName = _getTraceFileName();
std::string s = "file:";
s += theFileName;
CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
std::ofstream traceFile;
- traceFile.open(theFileName, std::ios::out | std::ios::trunc);
+ traceFile.open(theFileName.c_str(), std::ios::out | std::ios::trunc);
CPPUNIT_ASSERT(traceFile); // file created empty, then closed
traceFile.close();
#if defined(_DEBUG_) || defined(_DEBUG)
long id_thread = (long)threadid;
for (int i=0; i<NUM_MESSAGES;i++)
- MESSAGE("Hello World! This is a trace test : " << id_thread
+ MESSAGE("Hello World! This is a trace test : " << id_thread
<< " - iter " << i);
#endif
pthread_exit(NULL);
#define _SALOMELOCALTRACETEST_HXX_
#include <cppunit/extensions/HelperMacros.h>
+#include <string>
#ifdef WIN32
# if defined SALOMELOCALTRACETEST_EXPORTS || defined SALOMELocalTraceTest_EXPORTS
void testSingletonBufferPool();
void testLoadBufferPoolLocal();
void testLoadBufferPoolFile();
+
+ private:
+ std::string _getTraceFileName();
};
#endif
#include <cstdlib>
#include "Utils_SALOME_Exception.hxx"
#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#include "utilities.h"
#ifdef WIN32
#define setenv Kernel_Utils::setenv
-#endif
-
-#define TRACEFILE "/tmp/traceUnitTest.log"
+#endif
// ============================================================================
/*!
*/
// ============================================================================
-void
+std::string
+UtilsTest::_getTraceFileName()
+{
+ std::string dir = Kernel_Utils::GetTmpDir();
+ return dir + "traceUnitTest-UtilsTest.log";
+}
+
+void
UtilsTest::setUp()
{
LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
bp1->deleteInstance(bp1);
// --- trace on file
- const char *theFileName = TRACEFILE;
+ std::string theFileName = _getTraceFileName();
std::string s = "file:";
s += theFileName;
CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
std::ofstream traceFile;
- 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();
*/
// ============================================================================
-void
+void
UtilsTest::tearDown()
{
LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
#define _UTILSTEST_HXX_
#include <cppunit/extensions/HelperMacros.h>
+#include <string>
#ifdef WIN32
# if defined UTILSTEST_EXPORTS || defined UtilsTest_EXPORTS
void testSALOME_ExceptionThrow();
void testSALOME_ExceptionMessage();
+
+ private:
+ std::string _getTraceFileName();
};
#endif