Salome HOME
updated copyright message
[modules/kernel.git] / src / KernelHelpers / Test / KernelHelpersUnitTests.cxx
index ee92ec1e6e05449e775df11ec4893fc6667d3c65..d099c82938af186c0a6ffe6dd227fa020a20b3c6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -24,6 +24,7 @@
 
 #include "SALOME_KernelServices.hxx"
 #include "Basics_Utils.hxx"
+#include "KernelBasis.hxx"
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_TestComponent)
@@ -36,6 +37,7 @@
 
 void KernelHelpersUnitTests::setUp()
 {
+  setSSLMode(false);
 }
 
 // ============================================================================
@@ -59,7 +61,7 @@ void KernelHelpersUnitTests::TEST_corba()
   CPPUNIT_ASSERT(!CORBA::is_nil(orb));
 
 
-  SALOME_NamingService *  ns  = KERNEL::getNamingService();
+  SALOME_NamingService_Abstract *  ns  = KERNEL::getNamingService();
   CPPUNIT_ASSERT(ns!=NULL);
 
   SALOME_LifeCycleCORBA * lcc = KERNEL::getLifeCycleCORBA();
@@ -77,36 +79,23 @@ void KernelHelpersUnitTests::TEST_getLifeCycleCORBA() {
   CPPUNIT_ASSERT( strcmp(coucou_res, coucou_ref) == 0 );
 }
 
-void KernelHelpersUnitTests::TEST_getStudyManager() {
-  SALOMEDS::StudyManager_var studyManager = KERNEL::getStudyManager();
-
-  #ifndef ALLOW_MULTI_STUDIES
-  SALOMEDS::ListOfOpenStudies_var _list_open_studies =  studyManager->GetOpenStudies();
-  for (unsigned int ind = 0; ind < _list_open_studies->length();ind++)
-    {
-      LOG("Close study : " << _list_open_studies[ind]);
-      SALOMEDS::Study_var study = studyManager->GetStudyByName(_list_open_studies[0]);
-      if(study)
-        studyManager->Close(study);
-    }
-  #endif
-
-  SALOMEDS::Study_ptr myTestStudy = studyManager->NewStudy(L"kerneltest");
+void KernelHelpersUnitTests::TEST_getStudy() {
+  SALOMEDS::Study_ptr myTestStudy = KERNEL::getStudyServant();
   CPPUNIT_ASSERT(!CORBA::is_nil(myTestStudy));
 
   // One can use the study to store some general properties
   myTestStudy->SetString("material","wood");
   myTestStudy->SetReal("volume",3.23);
 
-  // The study is characterized by an ID
-  int myTestStudyId = myTestStudy->StudyId();
-  LOG("TestComponentImpl::testkernel: study id = "<<myTestStudyId);
+  // The study with properties was opened
+  LOG("TestComponentImpl::testkernel: study with properties was opened");
 }
 
 void KernelHelpersUnitTests::TEST_getSalomeLauncher() {
   Engines::SalomeLauncher_var salomeLauncher = KERNEL::getSalomeLauncher();
   try {
     int pid = salomeLauncher->getPID();
+    SALOME_UNUSED(pid); // unused in release mode
     LOG("SALOME launcher PID = " << pid);
   }
   catch (const SALOME::SALOME_Exception & ex) {