comparison OrthancServer/UnitTestsSources/ServerIndexTests.cpp @ 5809:023a99146dd0 attach-custom-data

merged find-refactoring -> attach-custom-data
author Alain Mazy <am@orthanc.team>
date Tue, 24 Sep 2024 12:53:43 +0200
parents 8279eaab0d1d b4e7a85cde80
children
comparison
equal deleted inserted replaced
5808:63c025cf6958 5809:023a99146dd0
165 assert(ServerToolbox::IsIdentifier(tag, level)); 165 assert(ServerToolbox::IsIdentifier(tag, level));
166 166
167 DicomTagConstraint c(tag, type, value, true, true); 167 DicomTagConstraint c(tag, type, value, true, true);
168 168
169 DatabaseConstraints lookup; 169 DatabaseConstraints lookup;
170 lookup.AddConstraint(c.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); 170 bool isEquivalent; // unused
171 lookup.AddConstraint(c.ConvertToDatabaseConstraint(isEquivalent, level, DicomTagType_Identifier));
171 172
172 std::set<std::string> noLabel; 173 std::set<std::string> noLabel;
173 transaction_->ApplyLookupResources(result, NULL, lookup, level, noLabel, LabelsConstraint_All, 0 /* no limit */); 174 transaction_->ApplyLookupResources(result, NULL, lookup, level, noLabel, LabelsConstraint_All, 0 /* no limit */);
174 } 175 }
175 176
185 186
186 DicomTagConstraint c1(tag, type1, value1, true, true); 187 DicomTagConstraint c1(tag, type1, value1, true, true);
187 DicomTagConstraint c2(tag, type2, value2, true, true); 188 DicomTagConstraint c2(tag, type2, value2, true, true);
188 189
189 DatabaseConstraints lookup; 190 DatabaseConstraints lookup;
190 lookup.AddConstraint(c1.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); 191 bool isEquivalent; // unused
191 lookup.AddConstraint(c2.ConvertToDatabaseConstraint(level, DicomTagType_Identifier)); 192 lookup.AddConstraint(c1.ConvertToDatabaseConstraint(isEquivalent, level, DicomTagType_Identifier));
193 lookup.AddConstraint(c2.ConvertToDatabaseConstraint(isEquivalent, level, DicomTagType_Identifier));
192 194
193 std::set<std::string> noLabel; 195 std::set<std::string> noLabel;
194 transaction_->ApplyLookupResources(result, NULL, lookup, level, noLabel, LabelsConstraint_All, 0 /* no limit */); 196 transaction_->ApplyLookupResources(result, NULL, lookup, level, noLabel, LabelsConstraint_All, 0 /* no limit */);
195 } 197 }
196 }; 198 };
616 618
617 SystemToolbox::RemoveFile(path + "/index"); 619 SystemToolbox::RemoveFile(path + "/index");
618 FilesystemStorage storage(path); 620 FilesystemStorage storage(path);
619 SQLiteDatabaseWrapper db; // The SQLite DB is in memory 621 SQLiteDatabaseWrapper db; // The SQLite DB is in memory
620 db.Open(); 622 db.Open();
621 ServerContext context(db, storage, true /* running unit tests */, 10); 623 ServerContext context(db, storage, true /* running unit tests */, 10, false /* readonly */);
622 context.SetupJobsEngine(true, false); 624 context.SetupJobsEngine(true, false);
623 625
624 ServerIndex& index = context.GetIndex(); 626 ServerIndex& index = context.GetIndex();
625 627
626 ASSERT_EQ(1u, index.IncrementGlobalSequence(GlobalProperty_AnonymizationSequence, true)); 628 ASSERT_EQ(1u, index.IncrementGlobalSequence(GlobalProperty_AnonymizationSequence, true));
698 700
699 SystemToolbox::RemoveFile(path + "/index"); 701 SystemToolbox::RemoveFile(path + "/index");
700 FilesystemStorage storage(path); 702 FilesystemStorage storage(path);
701 SQLiteDatabaseWrapper db; // The SQLite DB is in memory 703 SQLiteDatabaseWrapper db; // The SQLite DB is in memory
702 db.Open(); 704 db.Open();
703 ServerContext context(db, storage, true /* running unit tests */, 10); 705 ServerContext context(db, storage, true /* running unit tests */, 10, false /* readonly */);
704 context.SetupJobsEngine(true, false); 706 context.SetupJobsEngine(true, false);
705 ServerIndex& index = context.GetIndex(); 707 ServerIndex& index = context.GetIndex();
706 708
707 index.SetMaximumStorageSize(10); 709 index.SetMaximumStorageSize(10);
708 710
815 bool overwrite = (i == 0); 817 bool overwrite = (i == 0);
816 818
817 MemoryStorageArea storage; 819 MemoryStorageArea storage;
818 SQLiteDatabaseWrapper db; // The SQLite DB is in memory 820 SQLiteDatabaseWrapper db; // The SQLite DB is in memory
819 db.Open(); 821 db.Open();
820 ServerContext context(db, storage, true /* running unit tests */, 10); 822 ServerContext context(db, storage, true /* running unit tests */, 10, false /* readonly */);
821 context.SetupJobsEngine(true, false); 823 context.SetupJobsEngine(true, false);
822 context.SetCompressionEnabled(true); 824 context.SetCompressionEnabled(true);
823 825
824 DicomMap instance; 826 DicomMap instance;
825 instance.SetValue(DICOM_TAG_PATIENT_ID, "patient", false); 827 instance.SetValue(DICOM_TAG_PATIENT_ID, "patient", false);
980 const bool compression = (i == 0); 982 const bool compression = (i == 0);
981 983
982 MemoryStorageArea storage; 984 MemoryStorageArea storage;
983 SQLiteDatabaseWrapper db; // The SQLite DB is in memory 985 SQLiteDatabaseWrapper db; // The SQLite DB is in memory
984 db.Open(); 986 db.Open();
985 ServerContext context(db, storage, true /* running unit tests */, 10); 987 ServerContext context(db, storage, true /* running unit tests */, 10, false /* readonly */);
986 context.SetupJobsEngine(true, false); 988 context.SetupJobsEngine(true, false);
987 context.SetCompressionEnabled(compression); 989 context.SetCompressionEnabled(compression);
988 990
989 for (unsigned int j = 0; j < 2; j++) 991 for (unsigned int j = 0; j < 2; j++)
990 { 992 {