Mercurial > hg > orthanc
comparison UnitTestsSources/ServerIndex.cpp @ 693:01d8611c4a60
md5 for attached files
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Feb 2014 17:52:51 +0100 |
parents | 17815b9d4280 |
children | 4c1860179cc5 |
comparison
equal
deleted
inserted
replaced
692:1a3f9d90a2dd | 693:01d8611c4a60 |
---|---|
138 | 138 |
139 std::list<MetadataType> md; | 139 std::list<MetadataType> md; |
140 index.ListAvailableMetadata(md, a[4]); | 140 index.ListAvailableMetadata(md, a[4]); |
141 ASSERT_EQ(0u, md.size()); | 141 ASSERT_EQ(0u, md.size()); |
142 | 142 |
143 index.AddAttachment(a[4], FileInfo("my json file", FileContentType_Json, 42, CompressionType_Zlib, 21)); | 143 index.AddAttachment(a[4], FileInfo("my json file", FileContentType_Json, 42, "md5", |
144 index.AddAttachment(a[4], FileInfo("my dicom file", FileContentType_Dicom, 42)); | 144 CompressionType_Zlib, 21, "compressedMD5")); |
145 index.AddAttachment(a[6], FileInfo("world", FileContentType_Dicom, 44)); | 145 index.AddAttachment(a[4], FileInfo("my dicom file", FileContentType_Dicom, 42, "md5")); |
146 index.AddAttachment(a[6], FileInfo("world", FileContentType_Dicom, 44, "md5")); | |
146 index.SetMetadata(a[4], MetadataType_Instance_RemoteAet, "PINNACLE"); | 147 index.SetMetadata(a[4], MetadataType_Instance_RemoteAet, "PINNACLE"); |
147 | 148 |
148 index.ListAvailableMetadata(md, a[4]); | 149 index.ListAvailableMetadata(md, a[4]); |
149 ASSERT_EQ(1u, md.size()); | 150 ASSERT_EQ(1u, md.size()); |
150 ASSERT_EQ(MetadataType_Instance_RemoteAet, md.front()); | 151 ASSERT_EQ(MetadataType_Instance_RemoteAet, md.front()); |
183 | 184 |
184 FileInfo att; | 185 FileInfo att; |
185 ASSERT_TRUE(index.LookupAttachment(att, a[4], FileContentType_Json)); | 186 ASSERT_TRUE(index.LookupAttachment(att, a[4], FileContentType_Json)); |
186 ASSERT_EQ("my json file", att.GetUuid()); | 187 ASSERT_EQ("my json file", att.GetUuid()); |
187 ASSERT_EQ(21u, att.GetCompressedSize()); | 188 ASSERT_EQ(21u, att.GetCompressedSize()); |
189 ASSERT_EQ("md5", att.GetUncompressedMD5()); | |
190 ASSERT_EQ("compressedMD5", att.GetCompressedMD5()); | |
188 ASSERT_EQ(42u, att.GetUncompressedSize()); | 191 ASSERT_EQ(42u, att.GetUncompressedSize()); |
189 ASSERT_EQ(CompressionType_Zlib, att.GetCompressionType()); | 192 ASSERT_EQ(CompressionType_Zlib, att.GetCompressionType()); |
193 | |
194 ASSERT_TRUE(index.LookupAttachment(att, a[6], FileContentType_Dicom)); | |
195 ASSERT_EQ("world", att.GetUuid()); | |
196 ASSERT_EQ(44u, att.GetCompressedSize()); | |
197 ASSERT_EQ("md5", att.GetUncompressedMD5()); | |
198 ASSERT_EQ("md5", att.GetCompressedMD5()); | |
199 ASSERT_EQ(44u, att.GetUncompressedSize()); | |
200 ASSERT_EQ(CompressionType_None, att.GetCompressionType()); | |
190 | 201 |
191 ASSERT_EQ(0u, listener.deletedFiles_.size()); | 202 ASSERT_EQ(0u, listener.deletedFiles_.size()); |
192 ASSERT_EQ(7u, index.GetTableRecordCount("Resources")); | 203 ASSERT_EQ(7u, index.GetTableRecordCount("Resources")); |
193 ASSERT_EQ(3u, index.GetTableRecordCount("AttachedFiles")); | 204 ASSERT_EQ(3u, index.GetTableRecordCount("AttachedFiles")); |
194 ASSERT_EQ(1u, index.GetTableRecordCount("Metadata")); | 205 ASSERT_EQ(1u, index.GetTableRecordCount("Metadata")); |
298 std::vector<int64_t> patients; | 309 std::vector<int64_t> patients; |
299 for (int i = 0; i < 10; i++) | 310 for (int i = 0; i < 10; i++) |
300 { | 311 { |
301 std::string p = "Patient " + boost::lexical_cast<std::string>(i); | 312 std::string p = "Patient " + boost::lexical_cast<std::string>(i); |
302 patients.push_back(index.CreateResource(p, ResourceType_Patient)); | 313 patients.push_back(index.CreateResource(p, ResourceType_Patient)); |
303 index.AddAttachment(patients[i], FileInfo(p, FileContentType_Dicom, i + 10)); | 314 index.AddAttachment(patients[i], FileInfo(p, FileContentType_Dicom, i + 10, |
315 "md5-" + boost::lexical_cast<std::string>(i))); | |
304 ASSERT_FALSE(index.IsProtectedPatient(patients[i])); | 316 ASSERT_FALSE(index.IsProtectedPatient(patients[i])); |
305 } | 317 } |
306 | 318 |
307 ASSERT_EQ(10u, index.GetTableRecordCount("Resources")); | 319 ASSERT_EQ(10u, index.GetTableRecordCount("Resources")); |
308 ASSERT_EQ(10u, index.GetTableRecordCount("PatientRecyclingOrder")); | 320 ASSERT_EQ(10u, index.GetTableRecordCount("PatientRecyclingOrder")); |
350 std::vector<int64_t> patients; | 362 std::vector<int64_t> patients; |
351 for (int i = 0; i < 5; i++) | 363 for (int i = 0; i < 5; i++) |
352 { | 364 { |
353 std::string p = "Patient " + boost::lexical_cast<std::string>(i); | 365 std::string p = "Patient " + boost::lexical_cast<std::string>(i); |
354 patients.push_back(index.CreateResource(p, ResourceType_Patient)); | 366 patients.push_back(index.CreateResource(p, ResourceType_Patient)); |
355 index.AddAttachment(patients[i], FileInfo(p, FileContentType_Dicom, i + 10)); | 367 index.AddAttachment(patients[i], FileInfo(p, FileContentType_Dicom, i + 10, |
368 "md5-" + boost::lexical_cast<std::string>(i))); | |
356 ASSERT_FALSE(index.IsProtectedPatient(patients[i])); | 369 ASSERT_FALSE(index.IsProtectedPatient(patients[i])); |
357 } | 370 } |
358 | 371 |
359 ASSERT_EQ(5u, index.GetTableRecordCount("Resources")); | 372 ASSERT_EQ(5u, index.GetTableRecordCount("Resources")); |
360 ASSERT_EQ(5u, index.GetTableRecordCount("PatientRecyclingOrder")); | 373 ASSERT_EQ(5u, index.GetTableRecordCount("PatientRecyclingOrder")); |