changeset 110:aa56dcf599b9

fix unit tests
author Alain Mazy <am@osimis.io>
date Tue, 22 Aug 2023 17:50:01 +0200
parents 7381a7674b36
children 2b1a95c7d263
files Plugin/ResourceHierarchyCache.cpp Plugin/ResourceHierarchyCache.h UnitTestsSources/UnitTestsMain.cpp
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/ResourceHierarchyCache.cpp	Fri Aug 18 12:08:49 2023 +0200
+++ b/Plugin/ResourceHierarchyCache.cpp	Tue Aug 22 17:50:01 2023 +0200
@@ -250,6 +250,14 @@
   {
     cache_->Store(ComputeKey(childLevel, childOrthancId), parentOrthancId, 0 /* no expiration */);
   }
+
+  void ResourceHierarchyCache::AddLabels(Orthanc::ResourceType level,
+                                         const std::string& orthancId,
+                                         const std::string& serializedLabels)
+  {
+    labels_->Store(ComputeKey(level, orthancId), serializedLabels, 0 /* no expiration */);
+  }
+
 #endif
 
 }
--- a/Plugin/ResourceHierarchyCache.h	Fri Aug 18 12:08:49 2023 +0200
+++ b/Plugin/ResourceHierarchyCache.h	Tue Aug 22 17:50:01 2023 +0200
@@ -107,6 +107,10 @@
     void AddParentLink(Orthanc::ResourceType childLevel,
                        const std::string& childOrthancId,
                        const std::string& parentOrthancId);
+
+    void AddLabels(Orthanc::ResourceType level,
+                   const std::string& orthancId,
+                   const std::string& serializedLabels);
 #endif
   };
 }
--- a/UnitTestsSources/UnitTestsMain.cpp	Fri Aug 18 12:08:49 2023 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Tue Aug 22 17:50:01 2023 +0200
@@ -74,6 +74,11 @@
   cache->AddParentLink(Orthanc::ResourceType_Series, seriesOrthancId, studyOrthancId);
   cache->AddParentLink(Orthanc::ResourceType_Study, studyOrthancId, patientOrthancId);
 
+  cache->AddLabels(Orthanc::ResourceType_Series, seriesOrthancId, "series-label");
+  cache->AddLabels(Orthanc::ResourceType_Study, studyOrthancId, "study-label");
+  cache->AddLabels(Orthanc::ResourceType_Instance, instanceOrthancId, "instance-label");
+  cache->AddLabels(Orthanc::ResourceType_Patient, patientOrthancId, "patient-label");
+
   IAuthorizationParser::AccessedResources accesses;
   AssociativeArray noGetArguments(0, NULL, NULL, false);