Mercurial > hg > orthanc
annotate UnitTests/ServerIndex.cpp @ 246:fe6ba20d00a8
fix version
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 30 Nov 2012 17:09:52 +0100 |
parents | c11273198cef |
children | bd009f0b1931 |
rev | line source |
---|---|
181 | 1 #include "gtest/gtest.h" |
2 | |
183 | 3 #include "../OrthancServer/DatabaseWrapper.h" |
4 | |
181 | 5 #include <ctype.h> |
6 #include <glog/logging.h> | |
7 | |
183 | 8 using namespace Orthanc; |
181 | 9 |
183 | 10 namespace |
11 { | |
181 | 12 class ServerIndexListener : public IServerIndexListener |
13 { | |
14 public: | |
183 | 15 std::set<std::string> deletedFiles_; |
16 std::string ancestorId_; | |
17 ResourceType ancestorType_; | |
18 | |
19 void Reset() | |
181 | 20 { |
183 | 21 ancestorId_ = ""; |
22 deletedFiles_.clear(); | |
23 } | |
24 | |
25 virtual void SignalRemainingAncestor(ResourceType type, | |
26 const std::string& publicId) | |
27 { | |
28 ancestorId_ = publicId; | |
29 ancestorType_ = type; | |
181 | 30 } |
31 | |
32 virtual void SignalFileDeleted(const std::string& fileUuid) | |
33 { | |
183 | 34 deletedFiles_.insert(fileUuid); |
181 | 35 LOG(INFO) << "A file must be removed: " << fileUuid; |
36 } | |
37 }; | |
38 } | |
39 | |
40 | |
183 | 41 TEST(DatabaseWrapper, Simple) |
181 | 42 { |
43 ServerIndexListener listener; | |
183 | 44 DatabaseWrapper index(listener); |
181 | 45 |
46 int64_t a[] = { | |
182 | 47 index.CreateResource("a", ResourceType_Patient), // 0 |
48 index.CreateResource("b", ResourceType_Study), // 1 | |
49 index.CreateResource("c", ResourceType_Series), // 2 | |
50 index.CreateResource("d", ResourceType_Instance), // 3 | |
51 index.CreateResource("e", ResourceType_Instance), // 4 | |
52 index.CreateResource("f", ResourceType_Instance), // 5 | |
53 index.CreateResource("g", ResourceType_Study) // 6 | |
181 | 54 }; |
55 | |
198
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
56 ASSERT_EQ("a", index.GetPublicId(a[0])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
57 ASSERT_EQ("b", index.GetPublicId(a[1])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
58 ASSERT_EQ("c", index.GetPublicId(a[2])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
59 ASSERT_EQ("d", index.GetPublicId(a[3])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
60 ASSERT_EQ("e", index.GetPublicId(a[4])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
61 ASSERT_EQ("f", index.GetPublicId(a[5])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
62 ASSERT_EQ("g", index.GetPublicId(a[6])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
63 |
190 | 64 { |
65 Json::Value t; | |
66 index.GetAllPublicIds(t, ResourceType_Patient); | |
67 | |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
68 ASSERT_EQ(1u, t.size()); |
190 | 69 ASSERT_EQ("a", t[0u].asString()); |
70 | |
71 index.GetAllPublicIds(t, ResourceType_Series); | |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
72 ASSERT_EQ(1u, t.size()); |
190 | 73 ASSERT_EQ("c", t[0u].asString()); |
74 | |
75 index.GetAllPublicIds(t, ResourceType_Study); | |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
76 ASSERT_EQ(2u, t.size()); |
190 | 77 |
78 index.GetAllPublicIds(t, ResourceType_Instance); | |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
79 ASSERT_EQ(3u, t.size()); |
190 | 80 } |
81 | |
206
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
198
diff
changeset
|
82 index.SetGlobalProperty(GlobalProperty_FlushSleep, "World"); |
181 | 83 |
84 index.AttachChild(a[0], a[1]); | |
85 index.AttachChild(a[1], a[2]); | |
86 index.AttachChild(a[2], a[3]); | |
87 index.AttachChild(a[2], a[4]); | |
88 index.AttachChild(a[6], a[5]); | |
182 | 89 |
198
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
90 int64_t parent; |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
91 ASSERT_FALSE(index.LookupParent(parent, a[0])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
92 ASSERT_TRUE(index.LookupParent(parent, a[1])); ASSERT_EQ(a[0], parent); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
93 ASSERT_TRUE(index.LookupParent(parent, a[2])); ASSERT_EQ(a[1], parent); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
94 ASSERT_TRUE(index.LookupParent(parent, a[3])); ASSERT_EQ(a[2], parent); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
95 ASSERT_TRUE(index.LookupParent(parent, a[4])); ASSERT_EQ(a[2], parent); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
96 ASSERT_TRUE(index.LookupParent(parent, a[5])); ASSERT_EQ(a[6], parent); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
97 ASSERT_FALSE(index.LookupParent(parent, a[6])); |
663cc6c46d0a
before refactoring of ServerIndex::GetXXX
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
197
diff
changeset
|
98 |
182 | 99 std::string s; |
100 | |
101 ASSERT_FALSE(index.GetParentPublicId(s, a[0])); | |
102 ASSERT_FALSE(index.GetParentPublicId(s, a[6])); | |
103 ASSERT_TRUE(index.GetParentPublicId(s, a[1])); ASSERT_EQ("a", s); | |
104 ASSERT_TRUE(index.GetParentPublicId(s, a[2])); ASSERT_EQ("b", s); | |
105 ASSERT_TRUE(index.GetParentPublicId(s, a[3])); ASSERT_EQ("c", s); | |
106 ASSERT_TRUE(index.GetParentPublicId(s, a[4])); ASSERT_EQ("c", s); | |
107 ASSERT_TRUE(index.GetParentPublicId(s, a[5])); ASSERT_EQ("g", s); | |
108 | |
185 | 109 std::list<std::string> l; |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
110 index.GetChildrenPublicId(l, a[0]); ASSERT_EQ(1u, l.size()); ASSERT_EQ("b", l.front()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
111 index.GetChildrenPublicId(l, a[1]); ASSERT_EQ(1u, l.size()); ASSERT_EQ("c", l.front()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
112 index.GetChildrenPublicId(l, a[3]); ASSERT_EQ(0u, l.size()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
113 index.GetChildrenPublicId(l, a[4]); ASSERT_EQ(0u, l.size()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
114 index.GetChildrenPublicId(l, a[5]); ASSERT_EQ(0u, l.size()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
115 index.GetChildrenPublicId(l, a[6]); ASSERT_EQ(1u, l.size()); ASSERT_EQ("f", l.front()); |
182 | 116 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
117 index.GetChildrenPublicId(l, a[2]); ASSERT_EQ(2u, l.size()); |
182 | 118 if (l.front() == "d") |
119 { | |
120 ASSERT_EQ("e", l.back()); | |
121 } | |
122 else | |
123 { | |
124 ASSERT_EQ("d", l.back()); | |
125 ASSERT_EQ("e", l.front()); | |
126 } | |
127 | |
233 | 128 index.AddAttachment(a[4], FileInfo("my json file", FileContentType_Json, 42, CompressionType_Zlib, 21)); |
129 index.AddAttachment(a[4], FileInfo("my dicom file", FileContentType_Dicom, 42)); | |
130 index.AddAttachment(a[6], FileInfo("world", FileContentType_Dicom, 44)); | |
183 | 131 index.SetMetadata(a[4], MetadataType_Instance_RemoteAet, "PINNACLE"); |
182 | 132 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
133 ASSERT_EQ(21u + 42u + 44u, index.GetTotalCompressedSize()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
134 ASSERT_EQ(42u + 42u + 44u, index.GetTotalUncompressedSize()); |
181 | 135 |
136 DicomMap m; | |
137 m.SetValue(0x0010, 0x0010, "PatientName"); | |
138 index.SetMainDicomTags(a[3], m); | |
139 | |
140 int64_t b; | |
141 ResourceType t; | |
188
090cefdab1d1
fix because of Windows macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
185
diff
changeset
|
142 ASSERT_TRUE(index.LookupResource("g", b, t)); |
181 | 143 ASSERT_EQ(7, b); |
144 ASSERT_EQ(ResourceType_Study, t); | |
145 | |
188
090cefdab1d1
fix because of Windows macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
185
diff
changeset
|
146 ASSERT_TRUE(index.LookupMetadata(s, a[4], MetadataType_Instance_RemoteAet)); |
090cefdab1d1
fix because of Windows macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
185
diff
changeset
|
147 ASSERT_FALSE(index.LookupMetadata(s, a[4], MetadataType_Instance_IndexInSeries)); |
181 | 148 ASSERT_EQ("PINNACLE", s); |
149 ASSERT_EQ("PINNACLE", index.GetMetadata(a[4], MetadataType_Instance_RemoteAet)); | |
150 ASSERT_EQ("None", index.GetMetadata(a[4], MetadataType_Instance_IndexInSeries, "None")); | |
151 | |
206
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
198
diff
changeset
|
152 ASSERT_TRUE(index.LookupGlobalProperty(s, GlobalProperty_FlushSleep)); |
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
198
diff
changeset
|
153 ASSERT_FALSE(index.LookupGlobalProperty(s, static_cast<GlobalProperty>(42))); |
181 | 154 ASSERT_EQ("World", s); |
206
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
198
diff
changeset
|
155 ASSERT_EQ("World", index.GetGlobalProperty(GlobalProperty_FlushSleep)); |
4453a010d0db
flush to disk thread
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
198
diff
changeset
|
156 ASSERT_EQ("None", index.GetGlobalProperty(static_cast<GlobalProperty>(42), "None")); |
181 | 157 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
158 FileInfo att; |
233 | 159 ASSERT_TRUE(index.LookupAttachment(att, a[4], FileContentType_Json)); |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
160 ASSERT_EQ("my json file", att.GetUuid()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
161 ASSERT_EQ(21u, att.GetCompressedSize()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
162 ASSERT_EQ(42u, att.GetUncompressedSize()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
163 ASSERT_EQ(CompressionType_Zlib, att.GetCompressionType()); |
181 | 164 |
188
090cefdab1d1
fix because of Windows macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
185
diff
changeset
|
165 ASSERT_EQ(0u, listener.deletedFiles_.size()); |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
166 ASSERT_EQ(7u, index.GetTableRecordCount("Resources")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
167 ASSERT_EQ(3u, index.GetTableRecordCount("AttachedFiles")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
168 ASSERT_EQ(1u, index.GetTableRecordCount("Metadata")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
169 ASSERT_EQ(1u, index.GetTableRecordCount("MainDicomTags")); |
181 | 170 index.DeleteResource(a[0]); |
183 | 171 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
172 ASSERT_EQ(2u, listener.deletedFiles_.size()); |
185 | 173 ASSERT_FALSE(listener.deletedFiles_.find("my json file") == listener.deletedFiles_.end()); |
174 ASSERT_FALSE(listener.deletedFiles_.find("my dicom file") == listener.deletedFiles_.end()); | |
183 | 175 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
176 ASSERT_EQ(2u, index.GetTableRecordCount("Resources")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
177 ASSERT_EQ(0u, index.GetTableRecordCount("Metadata")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
178 ASSERT_EQ(1u, index.GetTableRecordCount("AttachedFiles")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
179 ASSERT_EQ(0u, index.GetTableRecordCount("MainDicomTags")); |
183 | 180 index.DeleteResource(a[5]); |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
181 ASSERT_EQ(0u, index.GetTableRecordCount("Resources")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
182 ASSERT_EQ(0u, index.GetTableRecordCount("AttachedFiles")); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
183 ASSERT_EQ(1u, index.GetTableRecordCount("GlobalProperties")); |
183 | 184 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
185 ASSERT_EQ(3u, listener.deletedFiles_.size()); |
185 | 186 ASSERT_FALSE(listener.deletedFiles_.find("world") == listener.deletedFiles_.end()); |
183 | 187 } |
188 | |
189 | |
190 | |
191 | |
192 TEST(DatabaseWrapper, Upward) | |
193 { | |
194 ServerIndexListener listener; | |
195 DatabaseWrapper index(listener); | |
196 | |
197 int64_t a[] = { | |
198 index.CreateResource("a", ResourceType_Patient), // 0 | |
199 index.CreateResource("b", ResourceType_Study), // 1 | |
200 index.CreateResource("c", ResourceType_Series), // 2 | |
201 index.CreateResource("d", ResourceType_Instance), // 3 | |
202 index.CreateResource("e", ResourceType_Instance), // 4 | |
203 index.CreateResource("f", ResourceType_Study), // 5 | |
204 index.CreateResource("g", ResourceType_Series), // 6 | |
205 index.CreateResource("h", ResourceType_Series) // 7 | |
206 }; | |
207 | |
208 index.AttachChild(a[0], a[1]); | |
209 index.AttachChild(a[1], a[2]); | |
210 index.AttachChild(a[2], a[3]); | |
211 index.AttachChild(a[2], a[4]); | |
212 index.AttachChild(a[1], a[6]); | |
213 index.AttachChild(a[0], a[5]); | |
214 index.AttachChild(a[5], a[7]); | |
215 | |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
216 { |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
217 Json::Value j; |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
218 index.GetChildren(j, a[0]); |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
219 ASSERT_EQ(2u, j.size()); |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
220 ASSERT_TRUE((j[0u] == "b" && j[1u] == "f") || |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
221 (j[1u] == "b" && j[0u] == "f")); |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
222 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
223 index.GetChildren(j, a[1]); |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
224 ASSERT_EQ(2u, j.size()); |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
225 ASSERT_TRUE((j[0u] == "c" && j[1u] == "g") || |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
226 (j[1u] == "c" && j[0u] == "g")); |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
227 |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
228 index.GetChildren(j, a[2]); |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
229 ASSERT_EQ(2u, j.size()); |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
230 ASSERT_TRUE((j[0u] == "d" && j[1u] == "e") || |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
231 (j[1u] == "d" && j[0u] == "e")); |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
232 |
232
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
233 index.GetChildren(j, a[3]); ASSERT_EQ(0u, j.size()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
234 index.GetChildren(j, a[4]); ASSERT_EQ(0u, j.size()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
235 index.GetChildren(j, a[5]); ASSERT_EQ(1u, j.size()); ASSERT_EQ("h", j[0u].asString()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
236 index.GetChildren(j, a[6]); ASSERT_EQ(0u, j.size()); |
5368bbe813cf
refactoring of attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
218
diff
changeset
|
237 index.GetChildren(j, a[7]); ASSERT_EQ(0u, j.size()); |
193
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
238 } |
a1b9d1e1497b
failed attempt to compile with linux standard base
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
190
diff
changeset
|
239 |
183 | 240 listener.Reset(); |
241 index.DeleteResource(a[3]); | |
242 ASSERT_EQ("c", listener.ancestorId_); | |
243 ASSERT_EQ(ResourceType_Series, listener.ancestorType_); | |
244 | |
245 listener.Reset(); | |
246 index.DeleteResource(a[4]); | |
247 ASSERT_EQ("b", listener.ancestorId_); | |
248 ASSERT_EQ(ResourceType_Study, listener.ancestorType_); | |
249 | |
250 listener.Reset(); | |
251 index.DeleteResource(a[7]); | |
252 ASSERT_EQ("a", listener.ancestorId_); | |
253 ASSERT_EQ(ResourceType_Patient, listener.ancestorType_); | |
254 | |
255 listener.Reset(); | |
181 | 256 index.DeleteResource(a[6]); |
183 | 257 ASSERT_EQ("", listener.ancestorId_); // No more ancestor |
181 | 258 } |