changeset 6814:e496596c3e4c streaming

removed DicomCacheLocker from unit tests
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 19 May 2026 17:31:53 +0200
parents aa91aa473d3d
children f29bf471d4a5
files OrthancServer/UnitTestsSources/ServerIndexTests.cpp OrthancServer/UnitTestsSources/ServerJobsTests.cpp
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/UnitTestsSources/ServerIndexTests.cpp	Tue May 19 17:28:05 2026 +0200
+++ b/OrthancServer/UnitTestsSources/ServerIndexTests.cpp	Tue May 19 17:31:53 2026 +0200
@@ -1002,9 +1002,11 @@
     ASSERT_EQ("name", tmp["0010,0010"]["Value"].asString());
     
     {
-      ServerContext::DicomCacheLocker locker(context, id);
+      std::unique_ptr<DicomDataSource::Dicom> dicom(context.ReadParsedDicom(id, false));
+      DicomDataSource::Dicom::Lock lock(*dicom);
+
       std::string tmp;
-      locker.GetDicom().GetTagValue(tmp, DICOM_TAG_PATIENT_NAME);
+      lock.GetContent().GetTagValue(tmp, DICOM_TAG_PATIENT_NAME);
       ASSERT_EQ("name", tmp);
     }
 
@@ -1057,9 +1059,11 @@
       ASSERT_EQ("overwritten", tmp["0010,0010"]["Value"].asString());
     
       {
-        ServerContext::DicomCacheLocker locker(context, id);
+        std::unique_ptr<DicomDataSource::Dicom> dicom(context.ReadParsedDicom(id, false));
+        DicomDataSource::Dicom::Lock lock(*dicom);
+
         std::string tmp;
-        locker.GetDicom().GetTagValue(tmp, DICOM_TAG_PATIENT_NAME);
+        lock.GetContent().GetTagValue(tmp, DICOM_TAG_PATIENT_NAME);
         ASSERT_EQ("overwritten", tmp);
       }
     }
@@ -1074,9 +1078,11 @@
       ASSERT_EQ("name", tmp["0010,0010"]["Value"].asString());
     
       {
-        ServerContext::DicomCacheLocker locker(context, id);
+        std::unique_ptr<DicomDataSource::Dicom> dicom(context.ReadParsedDicom(id, false));
+        DicomDataSource::Dicom::Lock lock(*dicom);
+
         std::string tmp;
-        locker.GetDicom().GetTagValue(tmp, DICOM_TAG_PATIENT_NAME);
+        lock.GetContent().GetTagValue(tmp, DICOM_TAG_PATIENT_NAME);
         ASSERT_EQ("name", tmp);
       }
     }
--- a/OrthancServer/UnitTestsSources/ServerJobsTests.cpp	Tue May 19 17:28:05 2026 +0200
+++ b/OrthancServer/UnitTestsSources/ServerJobsTests.cpp	Tue May 19 17:31:53 2026 +0200
@@ -1021,9 +1021,11 @@
   std::string study, series;
 
   {
-    ServerContext::DicomCacheLocker lock(GetContext(), instance);
-    study = lock.GetDicom().GetHasher().HashStudy();
-    series = lock.GetDicom().GetHasher().HashSeries();
+    std::unique_ptr<DicomDataSource::Dicom> dicom(GetContext().ReadParsedDicom(instance, false));
+    DicomDataSource::Dicom::Lock lock(*dicom);
+
+    study = lock.GetContent().GetHasher().HashStudy();
+    series = lock.GetContent().GetHasher().HashSeries();
   }
 
   {