Back to index

salome-kernel  6.5.0
LifeCycleCORBATest.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include "LifeCycleCORBATest.hxx"
00024 #include "SALOME_LifeCycleCORBA.hxx"
00025 #include "SALOME_FileTransferCORBA.hxx"
00026 #include "Utils_ORB_INIT.hxx"
00027 #include "Utils_SINGLETON.hxx"
00028 #include "Basics_Utils.hxx"
00029 
00030 #include <iostream>
00031 #include <fstream>
00032 #include <string>
00033 #include <cstdlib>
00034 
00035 
00036 // --- uncomment to have some traces on standard error
00037 //     (useful only when adding new tests...)
00038 //#define _DEVDEBUG_
00039 
00040 #ifdef _DEVDEBUG_
00041 #define MYDEVTRACE {std::cerr << __FILE__ << " [" << __LINE__ << "] : ";}
00042 #define DEVTRACE(msg) {MYDEVTRACE; std::cerr<<msg<<std::endl<<std::flush;}
00043 #else
00044 #define MYDEVTRACE
00045 #define DEVTRACE(msg)
00046 #endif
00047 
00048 #define TRACEFILE "/tmp/traceUnitTest.log"
00049 
00050 // ============================================================================
00058 // ============================================================================
00059 
00060 void 
00061 LifeCycleCORBATest::setUp()
00062 {
00063   LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
00064   CPPUNIT_ASSERT(bp1);
00065   bp1->deleteInstance(bp1);
00066 
00067   // --- trace on file
00068   const char *theFileName = TRACEFILE;
00069 
00070   std::string s = "file:";
00071   s += theFileName;
00072   //s="local";
00073   //s="with_logger";
00074   CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
00075 
00076   std::ofstream traceFile;
00077   //  traceFile.open(theFileName, std::ios::out | std::ios::trunc);
00078   traceFile.open(theFileName, std::ios::out | std::ios::app);
00079   CPPUNIT_ASSERT(traceFile); // file created empty, then closed
00080   traceFile.close();
00081 
00082   bp1 = LocalTraceBufferPool::instance();
00083   CPPUNIT_ASSERT(bp1);
00084 
00085   // --- Get or initialize the orb
00086 
00087   int _argc = 1;
00088   char* _argv[] = {(char*)""};
00089   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
00090   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
00091   _orb = init(_argc , _argv ) ;
00092 
00093   // --- Create a SALOME_NamingService instance
00094 
00095   _NS.init_orb(_orb) ;
00096 }
00097 
00098 // ============================================================================
00102 // ============================================================================
00103 
00104 void 
00105 LifeCycleCORBATest::tearDown()
00106 {
00107 
00108   LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
00109   CPPUNIT_ASSERT(bp1);
00110   bp1->deleteInstance(bp1);
00111 }
00112 
00113 // ============================================================================
00120 // ============================================================================
00121 
00122 void
00123 LifeCycleCORBATest::testFindOrLoad_Component_LaunchContainer()
00124 {
00125   SALOME_LifeCycleCORBA _LCC(&_NS);
00126 
00127   // --- get a local container,
00128   //     load an engine, check that the CORBA object is not null
00129 
00130   std::string containerName = "myContainer";
00131   Engines::EngineComponent_var mycompo =
00132     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00133   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
00134 
00135   // --- check narrow
00136 
00137   Engines::TestComponent_var m1;
00138   m1 = Engines::TestComponent::_narrow(mycompo);
00139   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00140 }
00141 
00142 // ============================================================================
00148 // ============================================================================
00149 
00150 void
00151 LifeCycleCORBATest::testFindOrLoad_Component_SameInstance()
00152 {
00153   SALOME_LifeCycleCORBA _LCC(&_NS);
00154 
00155   // --- get a local container,
00156   //     load an engine, check that the CORBA object is not null
00157 
00158   std::string containerName = "myContainer";
00159 
00160   Engines::EngineComponent_var mycompo1 =
00161     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00162   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
00163 
00164   Engines::EngineComponent_var mycompo2 =
00165     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00166   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo2));
00167 
00168   // --- check narrow
00169 
00170   Engines::TestComponent_var m1;
00171   m1 = Engines::TestComponent::_narrow(mycompo1);
00172   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00173 
00174   Engines::TestComponent_var m2;
00175   m2 = Engines::TestComponent::_narrow(mycompo2);
00176   CPPUNIT_ASSERT(!CORBA::is_nil(m2));
00177 
00178   // --- check equality of instance names
00179 
00180   std::string name1 = m1->instanceName();
00181   std::string name2 = m2->instanceName();
00182   CPPUNIT_ASSERT_EQUAL(name1, name2);
00183 }
00184 
00185 // ============================================================================
00191 // ============================================================================
00192 
00193 void
00194 LifeCycleCORBATest::testFindOrLoad_Component_PythonInCppContainer()
00195 {
00196   SALOME_LifeCycleCORBA _LCC(&_NS);
00197 
00198   // --- get a local container,
00199   //     load an engine, check that the CORBA object is not null
00200 
00201   std::string containerName = "myContainer";
00202 
00203   Engines::EngineComponent_var mycompo1 =
00204     _LCC.FindOrLoad_Component(containerName.c_str(),"SALOME_TestComponentPy");
00205   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
00206 
00207   // --- check narrow
00208 
00209   Engines::TestComponent_var m1;
00210   m1 = Engines::TestComponent::_narrow(mycompo1);
00211   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00212 }
00213 
00214 // ============================================================================
00220 // ============================================================================
00221 
00222 void
00223 LifeCycleCORBATest::testFindOrLoad_Component_PythonSameInstance()
00224 {
00225   SALOME_LifeCycleCORBA _LCC(&_NS);
00226 
00227   // --- get a local container (with a name based on local hostname),
00228   //     load an engine, check that the CORBA object is not null
00229 
00230   std::string containerName = "myContainer";
00231 
00232   Engines::EngineComponent_var mycompo1 =
00233     _LCC.FindOrLoad_Component(containerName.c_str(),"SALOME_TestComponentPy");
00234   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
00235 
00236   Engines::EngineComponent_var mycompo2 =
00237     _LCC.FindOrLoad_Component(containerName.c_str(),"SALOME_TestComponentPy");
00238   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo2));
00239 
00240   // --- check narrow
00241 
00242   Engines::TestComponent_var m1;
00243   m1 = Engines::TestComponent::_narrow(mycompo1);
00244   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00245 
00246   Engines::TestComponent_var m2;
00247   m2 = Engines::TestComponent::_narrow(mycompo2);
00248   CPPUNIT_ASSERT(!CORBA::is_nil(m2));
00249 
00250   // --- check equality of instance names
00251 
00252   std::string name1 = m1->instanceName();
00253   std::string name2 = m2->instanceName();
00254   CPPUNIT_ASSERT_EQUAL(name1, name2);
00255 }
00256 
00257 // ============================================================================
00264 // ============================================================================
00265 
00266 void
00267 LifeCycleCORBATest::testFindOrLoad_Component_UnknownInCatalog()
00268 {
00269   SALOME_LifeCycleCORBA _LCC(&_NS);
00270 
00271   // --- get a local container (with a name based on local hostname),
00272   //     load an engine, check that the CORBA object is not null
00273 
00274   std::string containerName = "myContainer";
00275 
00276   Engines::EngineComponent_var mycompo1 =
00277     _LCC.FindOrLoad_Component(containerName.c_str(),"MyNewComponent");
00278   CPPUNIT_ASSERT(CORBA::is_nil(mycompo1));
00279 }
00280 
00281 // ============================================================================
00288 // ============================================================================
00289 
00290 void
00291 LifeCycleCORBATest::testFindOrLoad_Component_LaunchContainerHostname()
00292 {
00293   SALOME_LifeCycleCORBA _LCC(&_NS);
00294 
00295   // --- get a local container (with a name based on local hostname),
00296   //     load an engine, check that the CORBA object is not null
00297 
00298   std::string containerName = Kernel_Utils::GetHostname();
00299   containerName += "/theContainer";
00300   DEVTRACE("containerName = " << containerName);
00301   Engines::EngineComponent_var mycompo =
00302     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00303   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
00304 
00305   // --- check narrow
00306 
00307   Engines::TestComponent_var m1;
00308   m1 = Engines::TestComponent::_narrow(mycompo);
00309   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00310 }
00311 
00312 // ============================================================================
00317 // ============================================================================
00318 
00319 void
00320 LifeCycleCORBATest::testFindOrLoad_Component_SameContainer()
00321 {
00322   SALOME_LifeCycleCORBA _LCC(&_NS);
00323 
00324   // --- get a local container (with a name based on local hostname),
00325   //     load an engine, check that the CORBA object is not null
00326 
00327   std::string containerName = "aContainer";
00328 
00329   Engines::EngineComponent_var mycompo1 =
00330     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00331   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
00332 
00333   containerName = Kernel_Utils::GetHostname();
00334   containerName += "/aContainer";
00335   DEVTRACE("containerName = " << containerName);
00336   Engines::EngineComponent_var mycompo2 =
00337     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00338   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo2));
00339 
00340   // --- check narrow
00341 
00342   Engines::TestComponent_var m1;
00343   m1 = Engines::TestComponent::_narrow(mycompo1);
00344   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00345 
00346   Engines::TestComponent_var m2;
00347   m2 = Engines::TestComponent::_narrow(mycompo2);
00348   CPPUNIT_ASSERT(!CORBA::is_nil(m2));
00349 
00350   // --- check equality of instance names
00351 
00352   std::string name1 = m1->instanceName();
00353   std::string name2 = m2->instanceName();
00354   CPPUNIT_ASSERT_EQUAL(name1, name2);
00355 
00356   // --- check containers are the same servant (same container name+hostname)
00357 
00358   Engines::Container_var c1 = m1->GetContainerRef();
00359   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00360   Engines::Container_var c2 = m2->GetContainerRef();
00361   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00362   std::string cname1 = c1->name();
00363   std::string cname2 = c2->name();
00364   CPPUNIT_ASSERT_EQUAL(cname1, cname2);
00365   std::string hostname1 = c1->getHostName();
00366   std::string hostname2 = c2->getHostName();
00367   CPPUNIT_ASSERT_EQUAL(hostname1, hostname2);
00368   CORBA::Long pidc1 = c1->getPID();
00369   CORBA::Long pidc2 = c2->getPID();
00370   CPPUNIT_ASSERT_EQUAL(pidc1, pidc2);
00371 }
00372 
00373 // ============================================================================
00378 // ============================================================================
00379 
00380 void
00381 LifeCycleCORBATest::testFindOrLoad_Component_UnknownMachine()
00382 {
00383   SALOME_LifeCycleCORBA _LCC(&_NS);
00384 
00385   // --- try to get a distant container on an unknown machine (not existing)
00386   //     check that the CORBA object is null
00387 
00388   std::string containerName = "aFarAwayComputer";
00389   containerName += "/theContainer";
00390 //   CPPUNIT_ASSERT_THROW(Engines::Component_var mycompo =
00391 //                     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");,SALOME::SALOME_Exception);
00392   try
00393     {
00394       Engines::EngineComponent_var mycompo =
00395         _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00396     }
00397   catch(const SALOME::SALOME_Exception &ex)
00398     {
00399       CPPUNIT_ASSERT(true);
00400 //       std::string expectedMessage = "BAD PARAM";
00401 //       std::ostream os;
00402 //       os << ex;
00403 //       std::string actualMessage = os.str();
00404 //       DEVTRACE("actual Exception Message = " << actualMessage);
00405 //       CPPUNIT_ASSERT(actualMessage.find(expectedMessage) != std::string::npos);
00406     }
00407 }
00408 
00409 // ============================================================================
00413 // ============================================================================
00414 
00415 void
00416 LifeCycleCORBATest::testFindOrLoad_Component_ParamsEmpty()
00417 {
00418   SALOME_LifeCycleCORBA _LCC(&_NS);
00419 
00420   Engines::MachineParameters params;
00421   _LCC.preSet(params);
00422   Engines::EngineComponent_var mycompo =
00423     _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
00424   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
00425 
00426   // --- check narrow
00427 
00428   Engines::TestComponent_var m1;
00429   m1 = Engines::TestComponent::_narrow(mycompo);
00430 }
00431 
00432 // ============================================================================
00436 // ============================================================================
00437 
00438 void
00439 LifeCycleCORBATest::testFindOrLoad_Component_ParamsLocalContainer()
00440 {
00441   SALOME_LifeCycleCORBA _LCC(&_NS);
00442 
00443   Engines::MachineParameters params;
00444   _LCC.preSet(params);
00445   std::string hostname=Kernel_Utils::GetHostname();
00446   params.hostname=hostname.c_str();
00447   Engines::EngineComponent_var mycompo =
00448     _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
00449   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
00450 
00451   // --- check narrow
00452 
00453   Engines::TestComponent_var m1;
00454   m1 = Engines::TestComponent::_narrow(mycompo);
00455 
00456   // --- check that container is on local computer
00457 
00458   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00459   Engines::Container_var c1 = m1->GetContainerRef();
00460   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00461   std::string hostname1 = c1->getHostName();
00462   CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
00463 }
00464 
00465 
00466 // ============================================================================
00470 // ============================================================================
00471 
00472 void
00473 LifeCycleCORBATest::testFindOrLoad_Component_ParamsContainerName()
00474 {
00475   SALOME_LifeCycleCORBA _LCC(&_NS);
00476 
00477   Engines::MachineParameters params;
00478   _LCC.preSet(params);
00479   std::string containerName = "myContainer";
00480   params.container_name = containerName.c_str();
00481   Engines::EngineComponent_var mycompo =
00482     _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
00483   CPPUNIT_ASSERT(!CORBA::is_nil(mycompo));
00484 
00485   // --- check narrow
00486 
00487   Engines::TestComponent_var m1;
00488   m1 = Engines::TestComponent::_narrow(mycompo);
00489 
00490   // --- check that container has good name
00491 
00492   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00493   Engines::Container_var c1 = m1->GetContainerRef();
00494   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00495   std::string hostname1 = c1->getHostName();
00496   CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
00497   std::string cname1 = c1->name();
00498   CPPUNIT_ASSERT(cname1.find(containerName) != std::string::npos);
00499 }
00500 
00501 // ============================================================================
00505 // ============================================================================
00506 
00507 void
00508 LifeCycleCORBATest::testFindOrLoad_Component_RemoteComputer()
00509 {
00510   SALOME_LifeCycleCORBA _LCC(&_NS);
00511 
00512   std::string remoteHost = GetRemoteHost();
00513 
00514   std::string containerName = remoteHost;
00515   containerName += "/aContainer";
00516   DEVTRACE("containerName = " << containerName);
00517   Engines::EngineComponent_var mycompo1 =
00518     _LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
00519   CPPUNIT_ASSERT_MESSAGE("Test validity requires connection to remote "\
00520                          "computers from ResourcesCatalog",
00521                          !CORBA::is_nil(mycompo1));
00522 
00523   // --- check narrow
00524 
00525   Engines::TestComponent_var m1;
00526   m1 = Engines::TestComponent::_narrow(mycompo1);
00527 
00528   // --- check that container is on good computer
00529 
00530   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00531   Engines::Container_var c1 = m1->GetContainerRef();
00532   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00533   std::string hostname1 = c1->getHostName();
00534   CPPUNIT_ASSERT_EQUAL(hostname1, remoteHost);
00535 }
00536 
00537 // ============================================================================
00542 // ============================================================================
00543 
00544 void
00545 LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer()
00546 {
00547   SALOME_LifeCycleCORBA _LCC(&_NS);
00548 
00549   std::string remoteHost = GetRemoteHost();
00550 
00551   Engines::MachineParameters params;
00552   _LCC.preSet(params); 
00553   params.hostname = remoteHost.c_str();
00554 
00555   Engines::EngineComponent_var mycompo1 =
00556     _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
00557   CPPUNIT_ASSERT_MESSAGE("Test validity requires connection to remote "\
00558                          "computers from ResourcesCatalog",
00559                          !CORBA::is_nil(mycompo1));
00560 
00561   // --- check narrow
00562 
00563   Engines::TestComponent_var m1;
00564   m1 = Engines::TestComponent::_narrow(mycompo1);
00565 
00566   // --- check that container is on good computer
00567 
00568   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00569   Engines::Container_var c1 = m1->GetContainerRef();
00570   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00571   std::string hostname1 = c1->getHostName();
00572   CPPUNIT_ASSERT_EQUAL(hostname1, remoteHost);
00573 }
00574 
00575 // ============================================================================
00580 // ============================================================================
00581 
00582 void
00583 LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer2()
00584 {
00585   SALOME_LifeCycleCORBA _LCC(&_NS);
00586 
00587   std::string remoteHost = GetRemoteHost();
00588 
00589   Engines::MachineParameters params;
00590   _LCC.preSet(params); 
00591   params.hostname = remoteHost.c_str();
00592   params.container_name = "anotherContainer";
00593 
00594   Engines::EngineComponent_var mycompo1 =
00595     _LCC.FindOrLoad_Component(params,"SalomeTestComponent");
00596   CPPUNIT_ASSERT_MESSAGE("Test validity requires connection to remote "\
00597                          "computers from ResourcesCatalog",
00598                          !CORBA::is_nil(mycompo1));
00599 
00600   // --- check narrow
00601 
00602   Engines::TestComponent_var m1;
00603   m1 = Engines::TestComponent::_narrow(mycompo1);
00604 
00605   // --- check that container is on good computer
00606 
00607   CPPUNIT_ASSERT(!CORBA::is_nil(m1));
00608   Engines::Container_var c1 = m1->GetContainerRef();
00609   CPPUNIT_ASSERT(!CORBA::is_nil(c1));
00610   std::string hostname1 = c1->getHostName();
00611   CPPUNIT_ASSERT_EQUAL(hostname1, remoteHost);
00612 }
00613 
00614 // ============================================================================
00618 // ============================================================================
00619 
00620 void  LifeCycleCORBATest::testgetLocalFile_localComputer()
00621 {
00622   SALOME_LifeCycleCORBA _LCC(&_NS);
00623   std::string origFileName = getenv("KERNEL_ROOT_DIR");
00624   origFileName += "/lib/salome/libSalomeLifeCycleCORBA.so.0.0.0";
00625   SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
00626                                      origFileName);
00627   std::string local = transfer.getLocalFile();
00628   CPPUNIT_ASSERT(!local.empty());
00629   CPPUNIT_ASSERT_EQUAL(local, origFileName);
00630 }
00631 
00632 // ============================================================================
00636 // ============================================================================
00637 
00638 void  LifeCycleCORBATest::testgetLocalFile_remoteComputer()
00639 {
00640   SALOME_LifeCycleCORBA _LCC(&_NS);
00641   std::string origFileName = getenv("KERNEL_ROOT_DIR");
00642   origFileName += "/lib/salome/libSalomeContainer.so.0.0.0";
00643   SALOME_FileTransferCORBA transfer( GetRemoteHost(),
00644                                      origFileName);
00645   std::string local = transfer.getLocalFile();
00646   CPPUNIT_ASSERT(!local.empty());
00647   std::string local2 = transfer.getLocalFile();
00648   CPPUNIT_ASSERT(!local2.empty());
00649   CPPUNIT_ASSERT_EQUAL(local, local2);
00650 }
00651 
00652 // ============================================================================
00656 // ============================================================================
00657 
00658 // void
00659 // LifeCycleCORBATest::testFindOrLoad_Component_()
00660 // {
00661 // }
00662 
00663 
00664 
00665 
00666 // ============================================================================
00670 // ============================================================================
00671 
00672 std::string LifeCycleCORBATest::GetRemoteHost()
00673 {
00674   SALOME_LifeCycleCORBA _LCC(&_NS);
00675 
00676   CORBA::Object_var obj = _NS.Resolve("/ResourcesManager");
00677   CPPUNIT_ASSERT(!CORBA::is_nil(obj));
00678   Engines::ResourcesManager_var resourcesManager =
00679     Engines::ResourcesManager::_narrow(obj);
00680   CPPUNIT_ASSERT(!CORBA::is_nil(resourcesManager));
00681 
00682   Engines::ContainerParameters params;
00683   _LCC.preSet(params);               // empty params to get all the machines
00684   params.resource_params.componentList.length(1);
00685   params.resource_params.componentList[0]="SalomeTestComponent";
00686 
00687   Engines::ResourceList_var hostList = resourcesManager->GetFittingResources(params.resource_params);
00688   CPPUNIT_ASSERT(hostList->length() > 1);
00689 
00690   std::string localHost = Kernel_Utils::GetHostname();
00691   std::string remoteHost;
00692   for (unsigned int i=0; i < hostList->length(); i++)
00693     {
00694       const char* aMachine = hostList[i];
00695       Engines::ResourceDefinition_var resource_definition = resourcesManager->GetResourceDefinition(aMachine);
00696       std::string machine(resource_definition->hostname.in());
00697       if (machine != localHost)
00698         {
00699           remoteHost = machine;
00700           break;
00701         }
00702     }
00703   CPPUNIT_ASSERT(remoteHost != "");
00704   return remoteHost;
00705 }