From 5fa559ead9c26b1d20611fca74c48d93eef89c16 Mon Sep 17 00:00:00 2001
From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch>
Date: Sat, 22 Jun 2024 01:51:01 +0200
Subject: [PATCH] Fix safety tests

Until you build the GeoModel tree, the caches are not created yet; however, the low-level methods can access the DB directly. So, the existance of a table should be verified at the DB level, not at cache level; otherwise the test fails when calling methods before building the GeoModel tree.
---
 .../GeoModelDBManager/src/GMDBManager.cpp      | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp
index 84fca7585..0a785fa9c 100644
--- a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp
+++ b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp
@@ -525,9 +525,9 @@ std::vector<std::vector<std::string>> GMDBManager::getTableFromNodeType_String(
     else
     {
         // if (!checkTable(tableName))
-        if (!checkTableFromCache(tableName))
+        if (!checkTableFromDB(tableName))
         {
-            THROW_EXCEPTION("ERROR!!! Table name '" << tableName << "' does not exist in cache! (It has not been loaded from the DB)");
+            THROW_EXCEPTION("ERROR!!! Table name '" << tableName << "' does not exist in the DB!");
         }
         out = getTableRecords_String(tableName);
     }
@@ -555,9 +555,9 @@ DBRowsList GMDBManager::getTableFromNodeType_VecVecData(
     }
     else
     {
-        if (!checkTableFromCache(tableName))
+        if (!checkTableFromDB(tableName))
         {
-            THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in cache! (It has not been loaded from the DB)");
+            THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in the DB!");
         }
         out = getTableRecords_VecVecData(tableName);
     }
@@ -585,9 +585,9 @@ DBRowsList GMDBManager::getTableFromTableName_VecVecData(
     }
     else
     {
-        if (!checkTableFromCache(tableName))
+        if (!checkTableFromDB(tableName))
         {
-            THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in cache! (It has not been loaded from the DB)");
+            THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in the DB!");
         }
         out = getTableRecords_VecVecData(tableName);
     }
@@ -613,9 +613,9 @@ DBRowEntry GMDBManager::getTableFromTableName_VecData(
     }
     else
     {
-        if (!checkTableFromCache(tableName))
+        if (!checkTableFromDB(tableName))
         {
-            THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in cache! (It has not been loaded from the DB)");
+            THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in the DB!");
         }
         out = getTableRecords_VecData(tableName);
     }
@@ -1371,7 +1371,7 @@ DBRowsList GMDBManager::getPublishedFPVTable(
     }
     if (!checkTableFromCache(tableName))
     {
-        THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in cache! (It has not been loaded from the DB)");
+        THROW_EXCEPTION("ERROR!!! Table name '" + tableName + "' does not exist in the DB!");
     }
     return getTableRecords_VecVecData(tableName);
 }
-- 
GitLab