-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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.
+// 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
#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>
#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
*/
// ============================================================================
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;
+ Engines::ContainerParameters params;
+ SALOME_LifeCycleCORBA::preSet(params);
std::string ref0 = "FactoryServer";
std::string ret = _NS.ContainerName(params);
// ============================================================================
/*!
- * Test
+ * Test
*/
// ============================================================================
// ============================================================================
/*!
- * 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";
std::string ref0 = "/Containers/theHostName/theContainerName";
// ============================================================================
/*!
- * 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
*/
// ============================================================================