Mercurial > hg > orthanc
annotate OrthancServer/UnitTestsSources/ServerJobsTests.cpp @ 5091:d9c4d77dedf4 Orthanc-1.11.2
added INSTALL_COMMAND to external projects to fix OpenSUSE build
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 03 Oct 2022 09:52:04 +0200 |
parents | 6eff25f70121 |
children | f2dcdbe05884 |
rev | line source |
---|---|
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
1 /** |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1009
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
827
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
7 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
11 * License, or (at your option) any later version. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
12 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
16 * General Public License for more details. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
17 * |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
20 **/ |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
21 |
3d6f9b7d0add
precompiled headers in unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
776
diff
changeset
|
22 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
827
diff
changeset
|
23 #include "PrecompiledHeadersUnitTests.h" |
4062 | 24 #include <gtest/gtest.h> |
723 | 25 |
4045 | 26 #include "../../OrthancFramework/Sources/Compatibility.h" |
27 #include "../../OrthancFramework/Sources/FileStorage/MemoryStorageArea.h" | |
4062 | 28 #include "../../OrthancFramework/Sources/JobsEngine/Operations/LogJobOperation.h" |
4304 | 29 #include "../../OrthancFramework/Sources/Logging.h" |
4045 | 30 #include "../../OrthancFramework/Sources/SerializationToolbox.h" |
4060
149172a06b4d
splitting MultiThreadingTests.cpp into JobsTests.cpp and ServerJobsTests.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
31 |
4045 | 32 #include "../Sources/Database/SQLiteDatabaseWrapper.h" |
33 #include "../Sources/ServerContext.h" | |
34 #include "../Sources/ServerJobs/LuaJobManager.h" | |
35 #include "../Sources/ServerJobs/OrthancJobUnserializer.h" | |
2655 | 36 |
4062 | 37 #include "../Sources/ServerJobs/Operations/DeleteResourceOperation.h" |
4045 | 38 #include "../Sources/ServerJobs/Operations/DicomInstanceOperationValue.h" |
39 #include "../Sources/ServerJobs/Operations/ModifyInstanceOperation.h" | |
40 #include "../Sources/ServerJobs/Operations/StorePeerOperation.h" | |
41 #include "../Sources/ServerJobs/Operations/StoreScuOperation.h" | |
42 #include "../Sources/ServerJobs/Operations/SystemCallOperation.h" | |
2655 | 43 |
4045 | 44 #include "../Sources/ServerJobs/ArchiveJob.h" |
45 #include "../Sources/ServerJobs/DicomModalityStoreJob.h" | |
46 #include "../Sources/ServerJobs/DicomMoveScuJob.h" | |
47 #include "../Sources/ServerJobs/MergeStudyJob.h" | |
48 #include "../Sources/ServerJobs/OrthancPeerStoreJob.h" | |
49 #include "../Sources/ServerJobs/ResourceModificationJob.h" | |
50 #include "../Sources/ServerJobs/SplitStudyJob.h" | |
2655 | 51 |
723 | 52 |
53 using namespace Orthanc; | |
54 | |
55 namespace | |
56 { | |
2652 | 57 class DummyJob : public IJob |
58 { | |
59 private: | |
60 bool fails_; | |
61 unsigned int count_; | |
62 unsigned int steps_; | |
63 | |
64 public: | |
65 DummyJob() : | |
66 fails_(false), | |
67 count_(0), | |
68 steps_(4) | |
69 { | |
70 } | |
71 | |
72 explicit DummyJob(bool fails) : | |
73 fails_(fails), | |
74 count_(0), | |
75 steps_(4) | |
76 { | |
77 } | |
78 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
79 virtual void Start() ORTHANC_OVERRIDE |
2652 | 80 { |
81 } | |
82 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
83 virtual void Reset() ORTHANC_OVERRIDE |
2652 | 84 { |
85 } | |
86 | |
3658
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
87 virtual JobStepResult Step(const std::string& jobId) ORTHANC_OVERRIDE |
2652 | 88 { |
89 if (fails_) | |
90 { | |
3240
e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
91 return JobStepResult::Failure(ErrorCode_ParameterOutOfRange, NULL); |
2652 | 92 } |
93 else if (count_ == steps_ - 1) | |
94 { | |
95 return JobStepResult::Success(); | |
96 } | |
97 else | |
98 { | |
99 count_++; | |
100 return JobStepResult::Continue(); | |
101 } | |
102 } | |
103 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
104 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE |
2652 | 105 { |
106 } | |
107 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
108 virtual float GetProgress() ORTHANC_OVERRIDE |
2652 | 109 { |
110 return static_cast<float>(count_) / static_cast<float>(steps_ - 1); | |
111 } | |
112 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
113 virtual void GetJobType(std::string& type) ORTHANC_OVERRIDE |
2652 | 114 { |
115 type = "DummyJob"; | |
116 } | |
117 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
118 virtual bool Serialize(Json::Value& value) ORTHANC_OVERRIDE |
2652 | 119 { |
2667
5fa2f2ce74f0
serialization of JobsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2666
diff
changeset
|
120 value = Json::objectValue; |
5fa2f2ce74f0
serialization of JobsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2666
diff
changeset
|
121 value["Type"] = "DummyJob"; |
2663
228e2783ce83
some jobs might not be serializable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
122 return true; |
2652 | 123 } |
124 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
125 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE |
2652 | 126 { |
127 value["hello"] = "world"; | |
128 } | |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
129 |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
130 virtual bool GetOutput(std::string& output, |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
131 MimeType& mime, |
4805
0a38000b086d
Archive jobs response now contains a header Content-Disposition:filename='archive.zip'
Alain Mazy <am@osimis.io>
parents:
4730
diff
changeset
|
132 std::string& filename, |
2976
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
133 const std::string& key) ORTHANC_OVERRIDE |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
134 { |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
135 return false; |
cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2966
diff
changeset
|
136 } |
2652 | 137 }; |
138 | |
139 | |
140 class DummyInstancesJob : public SetOfInstancesJob | |
141 { | |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
142 private: |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
143 bool trailingStepDone_; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
144 |
2652 | 145 protected: |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
146 virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE |
2652 | 147 { |
2657
5eea2f11e8df
JobsSerialization.GenericJobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
148 return (instance != "nope"); |
2652 | 149 } |
150 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
151 virtual bool HandleTrailingStep() ORTHANC_OVERRIDE |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
152 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
153 if (HasTrailingStep()) |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
154 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
155 if (trailingStepDone_) |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
156 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
157 throw OrthancException(ErrorCode_InternalError); |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
158 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
159 else |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
160 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
161 trailingStepDone_ = true; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
162 return true; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
163 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
164 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
165 else |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
166 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
167 throw OrthancException(ErrorCode_InternalError); |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
168 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
169 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
170 |
2652 | 171 public: |
2860 | 172 DummyInstancesJob() : |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
173 trailingStepDone_(false) |
2652 | 174 { |
175 } | |
176 | |
177 DummyInstancesJob(const Json::Value& value) : | |
178 SetOfInstancesJob(value) | |
179 { | |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
180 if (HasTrailingStep()) |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
181 { |
2860 | 182 trailingStepDone_ = (GetPosition() == GetCommandsCount()); |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
183 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
184 else |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
185 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
186 trailingStepDone_ = false; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
187 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
188 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
189 |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
190 bool IsTrailingStepDone() const |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
191 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
192 return trailingStepDone_; |
2652 | 193 } |
194 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
195 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE |
2652 | 196 { |
197 } | |
198 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
199 virtual void GetJobType(std::string& s) ORTHANC_OVERRIDE |
2652 | 200 { |
201 s = "DummyInstancesJob"; | |
202 } | |
203 }; | |
204 | |
205 | |
206 class DummyUnserializer : public GenericJobUnserializer | |
207 { | |
208 public: | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
209 virtual IJob* UnserializeJob(const Json::Value& value) ORTHANC_OVERRIDE |
2652 | 210 { |
2656
a6d3e45eeff5
SerializationToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2655
diff
changeset
|
211 if (SerializationToolbox::ReadString(value, "Type") == "DummyInstancesJob") |
2652 | 212 { |
213 return new DummyInstancesJob(value); | |
214 } | |
2667
5fa2f2ce74f0
serialization of JobsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2666
diff
changeset
|
215 else if (SerializationToolbox::ReadString(value, "Type") == "DummyJob") |
5fa2f2ce74f0
serialization of JobsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2666
diff
changeset
|
216 { |
5fa2f2ce74f0
serialization of JobsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2666
diff
changeset
|
217 return new DummyJob; |
5fa2f2ce74f0
serialization of JobsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2666
diff
changeset
|
218 } |
2652 | 219 else |
220 { | |
221 return GenericJobUnserializer::UnserializeJob(value); | |
222 } | |
223 } | |
224 }; | |
225 | |
226 | |
1396
ac4efabeb80c
Migration of the orthanc-client as a separate project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1304
diff
changeset
|
227 class DynamicInteger : public IDynamicObject |
723 | 228 { |
229 private: | |
230 int value_; | |
231 std::set<int>& target_; | |
232 | |
233 public: | |
234 DynamicInteger(int value, std::set<int>& target) : | |
235 value_(value), target_(target) | |
236 { | |
237 } | |
238 | |
239 int GetValue() const | |
240 { | |
241 return value_; | |
242 } | |
243 }; | |
244 } | |
245 | |
246 | |
2621
83ac5a05ce84
primitives for unserializing jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2610
diff
changeset
|
247 TEST(JobsEngine, DISABLED_Lua) |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
248 { |
2950
dc18d5804746
support of JobsHistorySize set to zero
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2924
diff
changeset
|
249 JobsEngine engine(10); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
250 engine.SetThreadSleep(10); |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
251 engine.SetWorkersCount(2); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
252 engine.Start(); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
253 |
2604
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
254 LuaJobManager lua; |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
255 lua.SetMaxOperationsPerJob(5); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
256 lua.SetTrailingOperationTimeout(200); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
257 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
258 for (size_t i = 0; i < 30; i++) |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
259 { |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
260 boost::this_thread::sleep(boost::posix_time::milliseconds(150)); |
2604
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
261 |
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
262 LuaJobManager::Lock lock(lua, engine); |
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
263 size_t a = lock.AddLogOperation(); |
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
264 size_t b = lock.AddLogOperation(); |
2606
f2b9d3256060
SystemCallOperation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2604
diff
changeset
|
265 size_t c = lock.AddSystemCallOperation("echo"); |
2604
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
266 lock.AddStringInput(a, boost::lexical_cast<std::string>(i)); |
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
267 lock.AddNullInput(a); |
76ef12fa136c
fix race conditions if creating Lua jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2603
diff
changeset
|
268 lock.Connect(a, b); |
2606
f2b9d3256060
SystemCallOperation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2604
diff
changeset
|
269 lock.Connect(a, c); |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
270 } |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
271 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
272 boost::this_thread::sleep(boost::posix_time::milliseconds(2000)); |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
273 |
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
274 engine.Stop(); |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
275 } |
2600
140a539b4eba
SequenceOfOperationsJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2599
diff
changeset
|
276 |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
277 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
278 static bool CheckSameJson(const Json::Value& a, |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
279 const Json::Value& b) |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
280 { |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
281 std::string s = a.toStyledString(); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
282 std::string t = b.toStyledString(); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
283 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
284 if (s == t) |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
285 { |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
286 return true; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
287 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
288 else |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
289 { |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
290 LOG(ERROR) << "Expected serialization: " << s; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
291 LOG(ERROR) << "Actual serialization: " << t; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
292 return false; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
293 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
294 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
295 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
296 |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
297 static bool CheckIdempotentSetOfInstances(IJobUnserializer& unserializer, |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
298 SetOfInstancesJob& job) |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
299 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
300 Json::Value a = 42; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
301 |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
302 if (!job.Serialize(a)) |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
303 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
304 return false; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
305 } |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
306 else |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
307 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
308 std::unique_ptr<SetOfInstancesJob> unserialized |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
309 (dynamic_cast<SetOfInstancesJob*>(unserializer.UnserializeJob(a))); |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
310 |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
311 Json::Value b = 43; |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
312 if (unserialized->Serialize(b)) |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
313 { |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
314 return (CheckSameJson(a, b) && |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
315 job.HasTrailingStep() == unserialized->HasTrailingStep() && |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
316 job.GetPosition() == unserialized->GetPosition() && |
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
317 job.GetInstancesCount() == unserialized->GetInstancesCount() && |
2860 | 318 job.GetCommandsCount() == unserialized->GetCommandsCount()); |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
319 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
320 else |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
321 { |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
322 return false; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
323 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
324 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
325 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
326 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
327 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
328 static bool CheckIdempotentSerialization(IJobUnserializer& unserializer, |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
329 IJobOperation& operation) |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
330 { |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
331 Json::Value a = 42; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
332 operation.Serialize(a); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
333 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
334 std::unique_ptr<IJobOperation> unserialized(unserializer.UnserializeOperation(a)); |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
335 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
336 Json::Value b = 43; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
337 unserialized->Serialize(b); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
338 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
339 return CheckSameJson(a, b); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
340 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
341 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
342 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
343 static bool CheckIdempotentSerialization(IJobUnserializer& unserializer, |
4310
2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
344 IJobOperationValue& value) |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
345 { |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
346 Json::Value a = 42; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
347 value.Serialize(a); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
348 |
4310
2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
349 std::unique_ptr<IJobOperationValue> unserialized(unserializer.UnserializeValue(a)); |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
350 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
351 Json::Value b = 43; |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
352 unserialized->Serialize(b); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
353 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
354 return CheckSameJson(a, b); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
355 } |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
356 |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
357 |
2655 | 358 TEST(JobsSerialization, GenericOperations) |
359 { | |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
360 DummyUnserializer unserializer; |
2655 | 361 Json::Value s; |
362 | |
363 { | |
364 LogJobOperation operation; | |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
365 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
366 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
2655 | 367 operation.Serialize(s); |
368 } | |
369 | |
370 ASSERT_THROW(unserializer.UnserializeJob(s), OrthancException); | |
371 ASSERT_THROW(unserializer.UnserializeValue(s), OrthancException); | |
372 | |
373 { | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
374 std::unique_ptr<IJobOperation> operation; |
2655 | 375 operation.reset(unserializer.UnserializeOperation(s)); |
376 | |
2657
5eea2f11e8df
JobsSerialization.GenericJobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
377 // Make sure that we have indeed unserialized a log operation |
2731 | 378 Json::Value dummy; |
379 ASSERT_THROW(dynamic_cast<DeleteResourceOperation&>(*operation).Serialize(dummy), std::bad_cast); | |
380 dynamic_cast<LogJobOperation&>(*operation).Serialize(dummy); | |
2655 | 381 } |
382 } | |
383 | |
384 | |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
385 TEST(JobsSerialization, DicomInstanceOrigin) |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
386 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
387 Json::Value s; |
2726
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
388 std::string t; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
389 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
390 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
391 DicomInstanceOrigin origin; |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
392 |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
393 s = 42; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
394 origin.Serialize(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
395 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
396 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
397 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
398 DicomInstanceOrigin origin(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
399 ASSERT_EQ(RequestOrigin_Unknown, origin.GetRequestOrigin()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
400 ASSERT_EQ("", std::string(origin.GetRemoteAetC())); |
2726
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
401 ASSERT_FALSE(origin.LookupRemoteIp(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
402 ASSERT_FALSE(origin.LookupRemoteAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
403 ASSERT_FALSE(origin.LookupCalledAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
404 ASSERT_FALSE(origin.LookupHttpUsername(t)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
405 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
406 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
407 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
408 DicomInstanceOrigin origin(DicomInstanceOrigin::FromDicomProtocol("host", "aet", "called")); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
409 |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
410 s = 42; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
411 origin.Serialize(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
412 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
413 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
414 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
415 DicomInstanceOrigin origin(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
416 ASSERT_EQ(RequestOrigin_DicomProtocol, origin.GetRequestOrigin()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
417 ASSERT_EQ("aet", std::string(origin.GetRemoteAetC())); |
2726
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
418 ASSERT_TRUE(origin.LookupRemoteIp(t)); ASSERT_EQ("host", t); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
419 ASSERT_TRUE(origin.LookupRemoteAet(t)); ASSERT_EQ("aet", t); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
420 ASSERT_TRUE(origin.LookupCalledAet(t)); ASSERT_EQ("called", t); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
421 ASSERT_FALSE(origin.LookupHttpUsername(t)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
422 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
423 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
424 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
425 DicomInstanceOrigin origin(DicomInstanceOrigin::FromHttp("host", "username")); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
426 |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
427 s = 42; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
428 origin.Serialize(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
429 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
430 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
431 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
432 DicomInstanceOrigin origin(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
433 ASSERT_EQ(RequestOrigin_RestApi, origin.GetRequestOrigin()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
434 ASSERT_EQ("", std::string(origin.GetRemoteAetC())); |
2726
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
435 ASSERT_TRUE(origin.LookupRemoteIp(t)); ASSERT_EQ("host", t); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
436 ASSERT_FALSE(origin.LookupRemoteAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
437 ASSERT_FALSE(origin.LookupCalledAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
438 ASSERT_TRUE(origin.LookupHttpUsername(t)); ASSERT_EQ("username", t); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
439 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
440 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
441 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
442 DicomInstanceOrigin origin(DicomInstanceOrigin::FromLua()); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
443 |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
444 s = 42; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
445 origin.Serialize(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
446 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
447 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
448 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
449 DicomInstanceOrigin origin(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
450 ASSERT_EQ(RequestOrigin_Lua, origin.GetRequestOrigin()); |
2726
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
451 ASSERT_FALSE(origin.LookupRemoteIp(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
452 ASSERT_FALSE(origin.LookupRemoteAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
453 ASSERT_FALSE(origin.LookupCalledAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
454 ASSERT_FALSE(origin.LookupHttpUsername(t)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
455 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
456 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
457 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
458 DicomInstanceOrigin origin(DicomInstanceOrigin::FromPlugins()); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
459 |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
460 s = 42; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
461 origin.Serialize(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
462 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
463 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
464 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
465 DicomInstanceOrigin origin(s); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
466 ASSERT_EQ(RequestOrigin_Plugins, origin.GetRequestOrigin()); |
2726
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
467 ASSERT_FALSE(origin.LookupRemoteIp(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
468 ASSERT_FALSE(origin.LookupRemoteAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
469 ASSERT_FALSE(origin.LookupCalledAet(t)); |
46061a91c88a
new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2715
diff
changeset
|
470 ASSERT_FALSE(origin.LookupHttpUsername(t)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
471 } |
4245
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
472 |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
473 { |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
474 DicomInstanceOrigin origin(DicomInstanceOrigin::FromWebDav()); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
475 |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
476 s = 42; |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
477 origin.Serialize(s); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
478 } |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
479 |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
480 { |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
481 DicomInstanceOrigin origin(s); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
482 ASSERT_EQ(RequestOrigin_WebDav, origin.GetRequestOrigin()); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
483 ASSERT_EQ("", std::string(origin.GetRemoteAetC())); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
484 ASSERT_FALSE(origin.LookupRemoteIp(t)); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
485 ASSERT_FALSE(origin.LookupRemoteAet(t)); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
486 ASSERT_FALSE(origin.LookupCalledAet(t)); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
487 ASSERT_FALSE(origin.LookupHttpUsername(t)); |
c70df925151e
RequestOrigin_WebDav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4177
diff
changeset
|
488 } |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
489 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
490 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
491 |
2655 | 492 namespace |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
493 { |
2655 | 494 class OrthancJobsSerialization : public testing::Test |
495 { | |
496 private: | |
497 MemoryStorageArea storage_; | |
3017
517fc4767ae0
renamed class DatabaseWrapper as SQLiteDatabaseWrapper
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2976
diff
changeset
|
498 SQLiteDatabaseWrapper db_; // The SQLite DB is in memory |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
499 std::unique_ptr<ServerContext> context_; |
2655 | 500 |
501 public: | |
502 OrthancJobsSerialization() | |
503 { | |
504 db_.Open(); | |
2950
dc18d5804746
support of JobsHistorySize set to zero
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2924
diff
changeset
|
505 context_.reset(new ServerContext(db_, storage_, true /* running unit tests */, 10)); |
2815
925d8dc03a23
unserialization of jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2812
diff
changeset
|
506 context_->SetupJobsEngine(true, false); |
2655 | 507 } |
508 | |
2924
22524fd06225
macros ORTHANC_OVERRIDE and ORTHANC_FINAL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
509 virtual ~OrthancJobsSerialization() ORTHANC_OVERRIDE |
2655 | 510 { |
511 context_->Stop(); | |
512 context_.reset(NULL); | |
513 db_.Close(); | |
514 } | |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
515 |
2655 | 516 ServerContext& GetContext() |
517 { | |
518 return *context_; | |
519 } | |
520 | |
521 bool CreateInstance(std::string& id) | |
522 { | |
523 // Create a sample DICOM file | |
524 ParsedDicomFile dicom(true); | |
525 dicom.Replace(DICOM_TAG_PATIENT_NAME, std::string("JODOGNE"), | |
3691
4922bdd046dd
Fix issue #140 (Modifying private tags with REST API changes VR from LO to UN) - DANGEROUS COMMIT
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
526 false, DicomReplaceMode_InsertIfAbsent, ""); |
2655 | 527 |
4508
8f9090b137f1
Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
528 std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromParsedDicomFile(dicom)); |
2655 | 529 |
4796
94616af363ec
added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents:
4730
diff
changeset
|
530 ServerContext::StoreResult result = context_->Store(id, *toStore, StoreInstanceMode_Default); |
94616af363ec
added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents:
4730
diff
changeset
|
531 return (result.GetStatus() == StoreStatus_Success); |
2655 | 532 } |
533 }; | |
534 } | |
535 | |
536 | |
537 TEST_F(OrthancJobsSerialization, Values) | |
538 { | |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
539 std::string id; |
2655 | 540 ASSERT_TRUE(CreateInstance(id)); |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
541 |
2655 | 542 Json::Value s; |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
543 OrthancJobUnserializer unserializer(GetContext()); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
544 |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
545 { |
2655 | 546 DicomInstanceOperationValue instance(GetContext(), id); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
547 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
548 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, instance)); |
2655 | 549 instance.Serialize(s); |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
550 } |
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
551 |
4310
2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
552 std::unique_ptr<IJobOperationValue> value; |
2655 | 553 value.reset(unserializer.UnserializeValue(s)); |
4310
2ae905070221
renaming pure interface JobOperationValue as IJobOperationValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4304
diff
changeset
|
554 ASSERT_EQ(IJobOperationValue::Type_DicomInstance, value->GetType()); |
2655 | 555 ASSERT_EQ(id, dynamic_cast<DicomInstanceOperationValue&>(*value).GetId()); |
556 | |
557 { | |
558 std::string content; | |
559 dynamic_cast<DicomInstanceOperationValue&>(*value).ReadDicom(content); | |
560 | |
561 ParsedDicomFile dicom(content); | |
562 ASSERT_TRUE(dicom.GetTagValue(content, DICOM_TAG_PATIENT_NAME)); | |
563 ASSERT_EQ("JODOGNE", content); | |
564 } | |
2651
1da5a052c777
testing value serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2648
diff
changeset
|
565 } |
2655 | 566 |
567 | |
568 TEST_F(OrthancJobsSerialization, Operations) | |
569 { | |
570 std::string id; | |
571 ASSERT_TRUE(CreateInstance(id)); | |
572 | |
573 Json::Value s; | |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
574 OrthancJobUnserializer unserializer(GetContext()); |
2655 | 575 |
2659 | 576 // DeleteResourceOperation |
577 | |
2655 | 578 { |
579 DeleteResourceOperation operation(GetContext()); | |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
580 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
581 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
2655 | 582 operation.Serialize(s); |
583 } | |
584 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
585 std::unique_ptr<IJobOperation> operation; |
2659 | 586 |
587 { | |
588 operation.reset(unserializer.UnserializeOperation(s)); | |
589 | |
2731 | 590 Json::Value dummy; |
591 ASSERT_THROW(dynamic_cast<LogJobOperation&>(*operation).Serialize(dummy), std::bad_cast); | |
592 dynamic_cast<DeleteResourceOperation&>(*operation).Serialize(dummy); | |
2659 | 593 } |
594 | |
595 // StorePeerOperation | |
596 | |
597 { | |
598 WebServiceParameters peer; | |
599 peer.SetUrl("http://localhost/"); | |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2731
diff
changeset
|
600 peer.SetCredentials("username", "password"); |
2659 | 601 peer.SetPkcs11Enabled(true); |
602 | |
603 StorePeerOperation operation(peer); | |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
604 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
605 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
2659 | 606 operation.Serialize(s); |
607 } | |
608 | |
609 { | |
610 operation.reset(unserializer.UnserializeOperation(s)); | |
611 | |
612 const StorePeerOperation& tmp = dynamic_cast<StorePeerOperation&>(*operation); | |
613 ASSERT_EQ("http://localhost/", tmp.GetPeer().GetUrl()); | |
614 ASSERT_EQ("username", tmp.GetPeer().GetUsername()); | |
615 ASSERT_EQ("password", tmp.GetPeer().GetPassword()); | |
616 ASSERT_TRUE(tmp.GetPeer().IsPkcs11Enabled()); | |
617 } | |
618 | |
619 // StoreScuOperation | |
2658 | 620 |
2659 | 621 { |
3851
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
622 TimeoutDicomConnectionManager luaManager; |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
623 |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
624 { |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
625 RemoteModalityParameters modality; |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
626 modality.SetApplicationEntityTitle("REMOTE"); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
627 modality.SetHost("192.168.1.1"); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
628 modality.SetPortNumber(1000); |
4177
f0d81320f17f
removed references to unused Manufacturer_StoreScp
Alain Mazy <alain@mazy.be>
parents:
4062
diff
changeset
|
629 modality.SetManufacturer(ModalityManufacturer_GE); |
2659 | 630 |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3878
diff
changeset
|
631 StoreScuOperation operation(GetContext(), luaManager, "TEST", modality); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
632 |
3851
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
633 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
634 operation.Serialize(s); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
635 } |
2659 | 636 |
3851
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
637 { |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
638 operation.reset(unserializer.UnserializeOperation(s)); |
2659 | 639 |
3851
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
640 const StoreScuOperation& tmp = dynamic_cast<StoreScuOperation&>(*operation); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
641 ASSERT_EQ("REMOTE", tmp.GetRemoteModality().GetApplicationEntityTitle()); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
642 ASSERT_EQ("192.168.1.1", tmp.GetRemoteModality().GetHost()); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
643 ASSERT_EQ(1000, tmp.GetRemoteModality().GetPortNumber()); |
4177
f0d81320f17f
removed references to unused Manufacturer_StoreScp
Alain Mazy <alain@mazy.be>
parents:
4062
diff
changeset
|
644 ASSERT_EQ(ModalityManufacturer_GE, tmp.GetRemoteModality().GetManufacturer()); |
3851
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
645 ASSERT_EQ("TEST", tmp.GetLocalAet()); |
6498739a3c3c
refactoring: TimeoutDicomConnectionManager is now only used by Lua
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3849
diff
changeset
|
646 } |
2659 | 647 } |
2658 | 648 |
2659 | 649 // SystemCallOperation |
650 | |
651 { | |
652 SystemCallOperation operation(std::string("echo")); | |
653 operation.AddPreArgument("a"); | |
654 operation.AddPreArgument("b"); | |
655 operation.AddPostArgument("c"); | |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
656 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
657 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
2659 | 658 operation.Serialize(s); |
659 } | |
2658 | 660 |
2659 | 661 { |
662 operation.reset(unserializer.UnserializeOperation(s)); | |
663 | |
664 const SystemCallOperation& tmp = dynamic_cast<SystemCallOperation&>(*operation); | |
665 ASSERT_EQ("echo", tmp.GetCommand()); | |
666 ASSERT_EQ(2u, tmp.GetPreArgumentsCount()); | |
667 ASSERT_EQ(1u, tmp.GetPostArgumentsCount()); | |
668 ASSERT_EQ("a", tmp.GetPreArgument(0)); | |
669 ASSERT_EQ("b", tmp.GetPreArgument(1)); | |
670 ASSERT_EQ("c", tmp.GetPostArgument(0)); | |
671 } | |
2658 | 672 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2660
diff
changeset
|
673 // ModifyInstanceOperation |
2659 | 674 |
675 { | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
676 std::unique_ptr<DicomModification> modification(new DicomModification); |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2660
diff
changeset
|
677 modification->SetupAnonymization(DicomVersion_2008); |
2659 | 678 |
679 ModifyInstanceOperation operation(GetContext(), RequestOrigin_Lua, modification.release()); | |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
680 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
681 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
2659 | 682 operation.Serialize(s); |
683 } | |
684 | |
685 { | |
686 operation.reset(unserializer.UnserializeOperation(s)); | |
687 | |
688 const ModifyInstanceOperation& tmp = dynamic_cast<ModifyInstanceOperation&>(*operation); | |
689 ASSERT_EQ(RequestOrigin_Lua, tmp.GetRequestOrigin()); | |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2660
diff
changeset
|
690 ASSERT_TRUE(tmp.GetModification().IsRemoved(DICOM_TAG_STUDY_DESCRIPTION)); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2660
diff
changeset
|
691 } |
4678
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
692 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
693 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
694 std::unique_ptr<DicomModification> modification(new DicomModification); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
695 modification->SetupAnonymization(DicomVersion_2021b); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
696 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
697 ModifyInstanceOperation operation(GetContext(), RequestOrigin_Lua, modification.release()); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
698 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
699 ASSERT_TRUE(CheckIdempotentSerialization(unserializer, operation)); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
700 operation.Serialize(s); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
701 } |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
702 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
703 { |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
704 operation.reset(unserializer.UnserializeOperation(s)); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
705 |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
706 const ModifyInstanceOperation& tmp = dynamic_cast<ModifyInstanceOperation&>(*operation); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
707 ASSERT_EQ(RequestOrigin_Lua, tmp.GetRequestOrigin()); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
708 ASSERT_TRUE(tmp.GetModification().IsRemoved(DICOM_TAG_STUDY_DESCRIPTION)); |
2e850edf03d6
Full support for the anonymization of subsequences containing tags whose VR is UI
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4508
diff
changeset
|
709 } |
2655 | 710 } |
2658 | 711 |
712 | |
713 TEST_F(OrthancJobsSerialization, Jobs) | |
714 { | |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
715 Json::Value s; |
2663
228e2783ce83
some jobs might not be serializable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
716 |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
717 // ArchiveJob |
2663
228e2783ce83
some jobs might not be serializable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
718 |
228e2783ce83
some jobs might not be serializable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
719 { |
2966 | 720 ArchiveJob job(GetContext(), false, false); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
721 ASSERT_FALSE(job.Serialize(s)); // Cannot serialize this |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
722 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
723 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
724 // DicomModalityStoreJob |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
725 |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
726 OrthancJobUnserializer unserializer(GetContext()); |
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
727 |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
728 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
729 RemoteModalityParameters modality; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
730 modality.SetApplicationEntityTitle("REMOTE"); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
731 modality.SetHost("192.168.1.1"); |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2671
diff
changeset
|
732 modality.SetPortNumber(1000); |
4177
f0d81320f17f
removed references to unused Manufacturer_StoreScp
Alain Mazy <alain@mazy.be>
parents:
4062
diff
changeset
|
733 modality.SetManufacturer(ModalityManufacturer_GE); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
734 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
735 DicomModalityStoreJob job(GetContext()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
736 job.SetLocalAet("LOCAL"); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
737 job.SetRemoteModality(modality); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
738 job.SetMoveOriginator("MOVESCU", 42); |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
739 |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
740 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
741 ASSERT_TRUE(job.Serialize(s)); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
742 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
743 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
744 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
745 std::unique_ptr<IJob> job; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
746 job.reset(unserializer.UnserializeJob(s)); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
747 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
748 DicomModalityStoreJob& tmp = dynamic_cast<DicomModalityStoreJob&>(*job); |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3857
diff
changeset
|
749 ASSERT_EQ("LOCAL", tmp.GetParameters().GetLocalApplicationEntityTitle()); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3857
diff
changeset
|
750 ASSERT_EQ("REMOTE", tmp.GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3857
diff
changeset
|
751 ASSERT_EQ("192.168.1.1", tmp.GetParameters().GetRemoteModality().GetHost()); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3857
diff
changeset
|
752 ASSERT_EQ(1000, tmp.GetParameters().GetRemoteModality().GetPortNumber()); |
4177
f0d81320f17f
removed references to unused Manufacturer_StoreScp
Alain Mazy <alain@mazy.be>
parents:
4062
diff
changeset
|
753 ASSERT_EQ(ModalityManufacturer_GE, tmp.GetParameters().GetRemoteModality().GetManufacturer()); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
754 ASSERT_TRUE(tmp.HasMoveOriginator()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
755 ASSERT_EQ("MOVESCU", tmp.GetMoveOriginatorAet()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
756 ASSERT_EQ(42, tmp.GetMoveOriginatorId()); |
2663
228e2783ce83
some jobs might not be serializable
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
757 } |
2658 | 758 |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
759 // OrthancPeerStoreJob |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
760 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
761 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
762 WebServiceParameters peer; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
763 peer.SetUrl("http://localhost/"); |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2731
diff
changeset
|
764 peer.SetCredentials("username", "password"); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
765 peer.SetPkcs11Enabled(true); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
766 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
767 OrthancPeerStoreJob job(GetContext()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
768 job.SetPeer(peer); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
769 |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
770 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
771 ASSERT_TRUE(job.Serialize(s)); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
772 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
773 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
774 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
775 std::unique_ptr<IJob> job; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
776 job.reset(unserializer.UnserializeJob(s)); |
2658 | 777 |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
778 OrthancPeerStoreJob& tmp = dynamic_cast<OrthancPeerStoreJob&>(*job); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
779 ASSERT_EQ("http://localhost/", tmp.GetPeer().GetUrl()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
780 ASSERT_EQ("username", tmp.GetPeer().GetUsername()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
781 ASSERT_EQ("password", tmp.GetPeer().GetPassword()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
782 ASSERT_TRUE(tmp.GetPeer().IsPkcs11Enabled()); |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
783 ASSERT_FALSE(tmp.IsTranscode()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
784 ASSERT_THROW(tmp.GetTransferSyntax(), OrthancException); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
785 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
786 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
787 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
788 OrthancPeerStoreJob job(GetContext()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
789 ASSERT_THROW(job.SetTranscode("nope"), OrthancException); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
790 job.SetTranscode("1.2.840.10008.1.2.4.50"); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
791 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
792 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
793 ASSERT_TRUE(job.Serialize(s)); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
794 } |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
795 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
796 { |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
797 std::unique_ptr<IJob> job; |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
798 job.reset(unserializer.UnserializeJob(s)); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
799 |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
800 OrthancPeerStoreJob& tmp = dynamic_cast<OrthancPeerStoreJob&>(*job); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
801 ASSERT_EQ("http://127.0.0.1:8042/", tmp.GetPeer().GetUrl()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
802 ASSERT_EQ("", tmp.GetPeer().GetUsername()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
803 ASSERT_EQ("", tmp.GetPeer().GetPassword()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
804 ASSERT_FALSE(tmp.GetPeer().IsPkcs11Enabled()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
805 ASSERT_TRUE(tmp.IsTranscode()); |
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
806 ASSERT_EQ(DicomTransferSyntax_JPEGProcess1, tmp.GetTransferSyntax()); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
807 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
808 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
809 // ResourceModificationJob |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
810 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
811 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
812 std::unique_ptr<DicomModification> modification(new DicomModification); |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
813 modification->SetupAnonymization(DicomVersion_2008); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
814 modification->SetLevel(ResourceType_Series); |
2658 | 815 |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
816 ResourceModificationJob job(GetContext()); |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
817 ASSERT_THROW(job.IsSingleResourceModification(), OrthancException); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
818 job.SetSingleResourceModification(modification.release(), ResourceType_Patient, true); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
819 job.SetOrigin(DicomInstanceOrigin::FromLua()); |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
820 ASSERT_TRUE(job.IsAnonymization()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
821 ASSERT_TRUE(job.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
822 ASSERT_EQ(ResourceType_Patient, job.GetOutputLevel()); |
3942
5b882ad2ffd0
"/{patients|studies|series}/.../modify": New option "KeepSource"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3894
diff
changeset
|
823 |
5b882ad2ffd0
"/{patients|studies|series}/.../modify": New option "KeepSource"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3894
diff
changeset
|
824 job.AddTrailingStep(); // Necessary since 1.7.0 |
2842
ff0ed5ea9e4e
trailing step in SetOfInstancesJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2815
diff
changeset
|
825 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
826 ASSERT_TRUE(job.Serialize(s)); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
827 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
828 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
829 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
830 std::unique_ptr<IJob> job; |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
831 job.reset(unserializer.UnserializeJob(s)); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
832 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
833 ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
834 ASSERT_TRUE(tmp.IsAnonymization()); |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
835 ASSERT_FALSE(tmp.IsTranscode()); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
836 ASSERT_THROW(tmp.GetTransferSyntax(), OrthancException); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
837 ASSERT_EQ(RequestOrigin_Lua, tmp.GetOrigin().GetRequestOrigin()); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
838 ASSERT_TRUE(tmp.GetModification().IsRemoved(DICOM_TAG_STUDY_DESCRIPTION)); |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
839 ASSERT_TRUE(tmp.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
840 ASSERT_EQ(ResourceType_Patient, tmp.GetOutputLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
841 ASSERT_EQ(ResourceType_Series, tmp.GetModification().GetLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
842 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
843 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
844 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
845 // Backward compatibility with Orthanc 1.9.3 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
846 ASSERT_TRUE(s.isMember("OutputLevel")); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
847 ASSERT_TRUE(s.isMember("IsSingleResource")); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
848 s.removeMember("OutputLevel"); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
849 s.removeMember("IsSingleResource"); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
850 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
851 std::unique_ptr<IJob> job; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
852 job.reset(unserializer.UnserializeJob(s)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
853 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
854 ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
855 ASSERT_TRUE(tmp.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
856 ASSERT_EQ(ResourceType_Series, tmp.GetOutputLevel()); // old, incorrect behavior |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
857 ASSERT_EQ(ResourceType_Series, tmp.GetModification().GetLevel()); |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
858 } |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
859 |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
860 { |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
861 ResourceModificationJob job(GetContext()); |
3949
ef696db8426f
preparing transcoding in OrthancPeerStoreJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3943
diff
changeset
|
862 ASSERT_THROW(job.SetTranscode("nope"), OrthancException); |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
863 job.SetTranscode(DicomTransferSyntax_JPEGProcess1); |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
864 job.SetSingleResourceModification(new DicomModification, ResourceType_Study, false); |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
865 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
866 job.AddTrailingStep(); // Necessary since 1.7.0 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
867 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
868 ASSERT_TRUE(job.Serialize(s)); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
869 } |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
870 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
871 { |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
872 std::unique_ptr<IJob> job; |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
873 job.reset(unserializer.UnserializeJob(s)); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
874 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
875 ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
876 ASSERT_FALSE(tmp.IsAnonymization()); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
877 ASSERT_TRUE(tmp.IsTranscode()); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
878 ASSERT_EQ(DicomTransferSyntax_JPEGProcess1, tmp.GetTransferSyntax()); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
879 ASSERT_EQ(RequestOrigin_Unknown, tmp.GetOrigin().GetRequestOrigin()); |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
880 ASSERT_TRUE(tmp.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
881 ASSERT_EQ(ResourceType_Study, tmp.GetOutputLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
882 ASSERT_EQ(ResourceType_Instance, tmp.GetModification().GetLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
883 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
884 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
885 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
886 ResourceModificationJob job(GetContext()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
887 job.SetMultipleResourcesModification(new DicomModification, true); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
888 job.AddInstance("toto"); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
889 job.AddInstance("tutu"); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
890 job.AddTrailingStep(); // Necessary since 1.7.0 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
891 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
892 ASSERT_TRUE(job.Serialize(s)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
893 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
894 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
895 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
896 std::unique_ptr<IJob> job; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
897 job.reset(unserializer.UnserializeJob(s)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
898 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
899 ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
900 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
901 std::set<std::string> instances; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
902 for (size_t i = 0; i < tmp.GetInstancesCount(); i++) |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
903 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
904 instances.insert(tmp.GetInstance(i)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
905 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
906 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
907 ASSERT_EQ(2u, instances.size()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
908 ASSERT_TRUE(instances.find("toto") != instances.end()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
909 ASSERT_TRUE(instances.find("tutu") != instances.end()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
910 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
911 ASSERT_TRUE(tmp.IsAnonymization()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
912 ASSERT_FALSE(tmp.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
913 ASSERT_THROW(tmp.GetOutputLevel(), OrthancException); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
914 ASSERT_EQ(ResourceType_Instance, tmp.GetModification().GetLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
915 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
916 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
917 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
918 // Test behavior on broken serialization |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
919 ASSERT_FALSE(s.isMember("OutputLevel")); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
920 ASSERT_TRUE(s.isMember("IsSingleResource")); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
921 s.removeMember("IsSingleResource"); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
922 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
923 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
924 std::unique_ptr<IJob> job; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
925 job.reset(unserializer.UnserializeJob(s)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
926 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
927 ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
928 ASSERT_TRUE(tmp.IsAnonymization()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
929 ASSERT_TRUE(tmp.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
930 ASSERT_EQ(ResourceType_Patient, tmp.GetOutputLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
931 ASSERT_EQ(ResourceType_Instance, tmp.GetModification().GetLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
932 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
933 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
934 s["Modification"]["Level"] = "Series"; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
935 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
936 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
937 std::unique_ptr<IJob> job; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
938 job.reset(unserializer.UnserializeJob(s)); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
939 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
940 ResourceModificationJob& tmp = dynamic_cast<ResourceModificationJob&>(*job); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
941 ASSERT_TRUE(tmp.IsAnonymization()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
942 ASSERT_TRUE(tmp.IsSingleResourceModification()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
943 ASSERT_EQ(ResourceType_Series, tmp.GetOutputLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
944 ASSERT_EQ(ResourceType_Series, tmp.GetModification().GetLevel()); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4678
diff
changeset
|
945 } |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
946 } |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
947 |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
948 // SplitStudyJob |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
949 |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
950 std::string instance; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
951 ASSERT_TRUE(CreateInstance(instance)); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
952 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
953 std::string study, series; |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
954 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
955 { |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
956 ServerContext::DicomCacheLocker lock(GetContext(), instance); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
957 study = lock.GetDicom().GetHasher().HashStudy(); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
958 series = lock.GetDicom().GetHasher().HashSeries(); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
959 } |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
960 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
961 { |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
962 std::list<std::string> tmp; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
963 GetContext().GetIndex().GetAllUuids(tmp, ResourceType_Study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
964 ASSERT_EQ(1u, tmp.size()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
965 ASSERT_EQ(study, tmp.front()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
966 GetContext().GetIndex().GetAllUuids(tmp, ResourceType_Series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
967 ASSERT_EQ(1u, tmp.size()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
968 ASSERT_EQ(series, tmp.front()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
969 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
970 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
971 std::string study2; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
972 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
973 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
974 std::string a, b; |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
975 |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
976 { |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
977 ASSERT_THROW(SplitStudyJob(GetContext(), std::string("nope")), OrthancException); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
978 |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
979 SplitStudyJob job(GetContext(), study); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
980 job.SetKeepSource(true); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
981 job.AddSourceSeries(series); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
982 ASSERT_THROW(job.AddSourceSeries("nope"), OrthancException); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
983 job.SetOrigin(DicomInstanceOrigin::FromLua()); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
984 job.Replace(DICOM_TAG_PATIENT_NAME, "hello"); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
985 job.Remove(DICOM_TAG_PATIENT_BIRTH_DATE); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
986 ASSERT_THROW(job.Replace(DICOM_TAG_SERIES_DESCRIPTION, "nope"), OrthancException); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
987 ASSERT_THROW(job.Remove(DICOM_TAG_SERIES_DESCRIPTION), OrthancException); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
988 |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
989 ASSERT_TRUE(job.GetTargetStudy().empty()); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
990 a = job.GetTargetStudyUid(); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
991 ASSERT_TRUE(job.LookupTargetSeriesUid(b, series)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
992 |
2860 | 993 job.AddTrailingStep(); |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
994 job.Start(); |
3658
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
995 ASSERT_EQ(JobStepCode_Continue, job.Step("jobId").GetCode()); |
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
996 ASSERT_EQ(JobStepCode_Success, job.Step("jobId").GetCode()); |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
997 |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
998 study2 = job.GetTargetStudy(); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
999 ASSERT_FALSE(study2.empty()); |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1000 |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1001 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1002 ASSERT_TRUE(job.Serialize(s)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1003 } |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1004 |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1005 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1006 std::unique_ptr<IJob> job; |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1007 job.reset(unserializer.UnserializeJob(s)); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
1008 |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1009 SplitStudyJob& tmp = dynamic_cast<SplitStudyJob&>(*job); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1010 ASSERT_TRUE(tmp.IsKeepSource()); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1011 ASSERT_EQ(study, tmp.GetSourceStudy()); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1012 ASSERT_EQ(a, tmp.GetTargetStudyUid()); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1013 ASSERT_EQ(RequestOrigin_Lua, tmp.GetOrigin().GetRequestOrigin()); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
1014 |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1015 std::string s; |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1016 ASSERT_EQ(study2, tmp.GetTargetStudy()); |
2847
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1017 ASSERT_FALSE(tmp.LookupTargetSeriesUid(s, "nope")); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1018 ASSERT_TRUE(tmp.LookupTargetSeriesUid(s, series)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1019 ASSERT_EQ(b, s); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1020 |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1021 ASSERT_FALSE(tmp.LookupReplacement(s, DICOM_TAG_STUDY_DESCRIPTION)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1022 ASSERT_TRUE(tmp.LookupReplacement(s, DICOM_TAG_PATIENT_NAME)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1023 ASSERT_EQ("hello", s); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1024 ASSERT_FALSE(tmp.IsRemoved(DICOM_TAG_PATIENT_NAME)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1025 ASSERT_TRUE(tmp.IsRemoved(DICOM_TAG_PATIENT_BIRTH_DATE)); |
2da68edacab6
unit testing of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
1026 } |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2842
diff
changeset
|
1027 } |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1028 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1029 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1030 std::list<std::string> tmp; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1031 GetContext().GetIndex().GetAllUuids(tmp, ResourceType_Study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1032 ASSERT_EQ(2u, tmp.size()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1033 GetContext().GetIndex().GetAllUuids(tmp, ResourceType_Series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1034 ASSERT_EQ(2u, tmp.size()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1035 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1036 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1037 // MergeStudyJob |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1038 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1039 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1040 ASSERT_THROW(SplitStudyJob(GetContext(), std::string("nope")), OrthancException); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1041 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1042 MergeStudyJob job(GetContext(), study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1043 job.SetKeepSource(true); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1044 job.AddSource(study2); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1045 ASSERT_THROW(job.AddSourceSeries("nope"), OrthancException); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1046 ASSERT_THROW(job.AddSourceStudy("nope"), OrthancException); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1047 ASSERT_THROW(job.AddSource("nope"), OrthancException); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1048 job.SetOrigin(DicomInstanceOrigin::FromLua()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1049 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1050 ASSERT_EQ(job.GetTargetStudy(), study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1051 |
2860 | 1052 job.AddTrailingStep(); |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1053 job.Start(); |
3658
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1054 ASSERT_EQ(JobStepCode_Continue, job.Step("jobId").GetCode()); |
2d90dd30858c
providing job ID to the IJob::Step() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
1055 ASSERT_EQ(JobStepCode_Success, job.Step("jobId").GetCode()); |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1056 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1057 ASSERT_TRUE(CheckIdempotentSetOfInstances(unserializer, job)); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1058 ASSERT_TRUE(job.Serialize(s)); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1059 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1060 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1061 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1062 std::list<std::string> tmp; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1063 GetContext().GetIndex().GetAllUuids(tmp, ResourceType_Study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1064 ASSERT_EQ(2u, tmp.size()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1065 GetContext().GetIndex().GetAllUuids(tmp, ResourceType_Series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1066 ASSERT_EQ(3u, tmp.size()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1067 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1068 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1069 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
1070 std::unique_ptr<IJob> job; |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1071 job.reset(unserializer.UnserializeJob(s)); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1072 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1073 MergeStudyJob& tmp = dynamic_cast<MergeStudyJob&>(*job); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1074 ASSERT_TRUE(tmp.IsKeepSource()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1075 ASSERT_EQ(study, tmp.GetTargetStudy()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1076 ASSERT_EQ(RequestOrigin_Lua, tmp.GetOrigin().GetRequestOrigin()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2847
diff
changeset
|
1077 } |
2666
2540ac79ab6c
SequenceOfOperationsJob serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2665
diff
changeset
|
1078 } |
2665
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
1079 |
389d050a2e66
fix deadlock, speed up unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2664
diff
changeset
|
1080 |
3878
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1081 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1082 TEST_F(OrthancJobsSerialization, DicomAssociationParameters) |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1083 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1084 Json::Value v; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1085 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1086 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1087 v = Json::objectValue; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1088 DicomAssociationParameters p; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1089 p.SerializeJob(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1090 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1091 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1092 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1093 DicomAssociationParameters p = DicomAssociationParameters::UnserializeJob(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1094 ASSERT_EQ("ORTHANC", p.GetLocalApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1095 ASSERT_EQ("ANY-SCP", p.GetRemoteModality().GetApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1096 ASSERT_EQ(104u, p.GetRemoteModality().GetPortNumber()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1097 ASSERT_EQ(ModalityManufacturer_Generic, p.GetRemoteModality().GetManufacturer()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1098 ASSERT_EQ("127.0.0.1", p.GetRemoteModality().GetHost()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1099 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), p.GetTimeout()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1100 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1101 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1102 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1103 v = Json::objectValue; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1104 DicomAssociationParameters p; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1105 p.SetLocalApplicationEntityTitle("HELLO"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1106 p.SetRemoteApplicationEntityTitle("WORLD"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1107 p.SetRemotePort(42); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1108 p.SetRemoteHost("MY_HOST"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1109 p.SetTimeout(43); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1110 p.SerializeJob(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1111 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1112 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1113 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1114 DicomAssociationParameters p = DicomAssociationParameters::UnserializeJob(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1115 ASSERT_EQ("HELLO", p.GetLocalApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1116 ASSERT_EQ("WORLD", p.GetRemoteModality().GetApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1117 ASSERT_EQ(42u, p.GetRemoteModality().GetPortNumber()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1118 ASSERT_EQ(ModalityManufacturer_Generic, p.GetRemoteModality().GetManufacturer()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1119 ASSERT_EQ("MY_HOST", p.GetRemoteModality().GetHost()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1120 ASSERT_EQ(43u, p.GetTimeout()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1121 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1122 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1123 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1124 DicomModalityStoreJob job(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1125 job.Serialize(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1126 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1127 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1128 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1129 OrthancJobUnserializer unserializer(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1130 std::unique_ptr<DicomModalityStoreJob> job( |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1131 dynamic_cast<DicomModalityStoreJob*>(unserializer.UnserializeJob(v))); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1132 ASSERT_EQ("ORTHANC", job->GetParameters().GetLocalApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1133 ASSERT_EQ("ANY-SCP", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1134 ASSERT_EQ("127.0.0.1", job->GetParameters().GetRemoteModality().GetHost()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1135 ASSERT_EQ(104u, job->GetParameters().GetRemoteModality().GetPortNumber()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1136 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1137 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), job->GetParameters().GetTimeout()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1138 ASSERT_FALSE(job->HasMoveOriginator()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1139 ASSERT_THROW(job->GetMoveOriginatorAet(), OrthancException); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1140 ASSERT_THROW(job->GetMoveOriginatorId(), OrthancException); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1141 ASSERT_FALSE(job->HasStorageCommitment()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1142 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1143 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1144 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1145 RemoteModalityParameters r; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1146 r.SetApplicationEntityTitle("HELLO"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1147 r.SetPortNumber(42); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1148 r.SetHost("MY_HOST"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1149 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1150 DicomModalityStoreJob job(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1151 job.SetLocalAet("WORLD"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1152 job.SetRemoteModality(r); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1153 job.SetTimeout(43); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1154 job.SetMoveOriginator("ORIGINATOR", 100); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1155 job.EnableStorageCommitment(true); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1156 job.Serialize(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1157 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1158 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1159 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1160 OrthancJobUnserializer unserializer(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1161 std::unique_ptr<DicomModalityStoreJob> job( |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1162 dynamic_cast<DicomModalityStoreJob*>(unserializer.UnserializeJob(v))); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1163 ASSERT_EQ("WORLD", job->GetParameters().GetLocalApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1164 ASSERT_EQ("HELLO", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1165 ASSERT_EQ("MY_HOST", job->GetParameters().GetRemoteModality().GetHost()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1166 ASSERT_EQ(42u, job->GetParameters().GetRemoteModality().GetPortNumber()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1167 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1168 ASSERT_EQ(43u, job->GetParameters().GetTimeout()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1169 ASSERT_TRUE(job->HasMoveOriginator()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1170 ASSERT_EQ("ORIGINATOR", job->GetMoveOriginatorAet()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1171 ASSERT_EQ(100, job->GetMoveOriginatorId()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1172 ASSERT_TRUE(job->HasStorageCommitment()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1173 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1174 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1175 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1176 DicomMoveScuJob job(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1177 job.Serialize(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1178 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1179 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1180 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1181 OrthancJobUnserializer unserializer(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1182 std::unique_ptr<DicomMoveScuJob> job( |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1183 dynamic_cast<DicomMoveScuJob*>(unserializer.UnserializeJob(v))); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1184 ASSERT_EQ("ORTHANC", job->GetParameters().GetLocalApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1185 ASSERT_EQ("ANY-SCP", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1186 ASSERT_EQ("127.0.0.1", job->GetParameters().GetRemoteModality().GetHost()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1187 ASSERT_EQ(104u, job->GetParameters().GetRemoteModality().GetPortNumber()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1188 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1189 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), job->GetParameters().GetTimeout()); |
4730
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1190 ASSERT_EQ(DicomToJsonFormat_Short, job->GetQueryFormat()); |
3878
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1191 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1192 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1193 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1194 RemoteModalityParameters r; |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1195 r.SetApplicationEntityTitle("HELLO"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1196 r.SetPortNumber(42); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1197 r.SetHost("MY_HOST"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1198 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1199 DicomMoveScuJob job(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1200 job.SetLocalAet("WORLD"); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1201 job.SetRemoteModality(r); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1202 job.SetTimeout(43); |
4730
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1203 job.SetQueryFormat(DicomToJsonFormat_Human); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1204 |
3878
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1205 job.Serialize(v); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1206 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1207 |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1208 { |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1209 OrthancJobUnserializer unserializer(GetContext()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1210 std::unique_ptr<DicomMoveScuJob> job( |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1211 dynamic_cast<DicomMoveScuJob*>(unserializer.UnserializeJob(v))); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1212 ASSERT_EQ("WORLD", job->GetParameters().GetLocalApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1213 ASSERT_EQ("HELLO", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1214 ASSERT_EQ("MY_HOST", job->GetParameters().GetRemoteModality().GetHost()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1215 ASSERT_EQ(42u, job->GetParameters().GetRemoteModality().GetPortNumber()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1216 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1217 ASSERT_EQ(43u, job->GetParameters().GetTimeout()); |
4730
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1218 ASSERT_EQ(DicomToJsonFormat_Human, job->GetQueryFormat()); |
3878
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1219 } |
661c931f22ad
new unit test: OrthancJobsSerialization.DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3875
diff
changeset
|
1220 } |
4730
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1221 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1222 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1223 TEST_F(OrthancJobsSerialization, DicomMoveScuJob) |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1224 { |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1225 Json::Value command = Json::objectValue; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1226 command["0008,0005"]["Type"] = "String"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1227 command["0008,0005"]["Content"] = "ISO_IR 100"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1228 command["0010,0020"]["Type"] = "String"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1229 command["0010,0020"]["Content"] = "1234"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1230 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1231 Json::Value query = Json::objectValue; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1232 query["0010,0020"] = "456"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1233 query["0008,0052"] = "STUDY"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1234 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1235 Json::Value remote = Json::objectValue; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1236 remote["AET"] = "REMOTE"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1237 remote["Host"] = "192.168.1.1"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1238 remote["Port"] = 4242; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1239 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1240 Json::Value s = Json::objectValue; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1241 s["Permissive"] = true; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1242 s["Position"] = 1; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1243 s["Description"] = "test"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1244 s["Remote"] = remote; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1245 s["LocalAet"] = "LOCAL"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1246 s["TargetAet"] = "TARGET"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1247 s["QueryFormat"] = "Full"; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1248 s["Query"] = Json::arrayValue; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1249 s["Query"].append(query); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1250 s["Commands"] = Json::arrayValue; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1251 s["Commands"].append(command); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1252 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1253 Json::Value s2; |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1254 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1255 { |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1256 DicomMoveScuJob job(GetContext(), s); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1257 job.Serialize(s2); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1258 } |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1259 |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1260 { |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1261 DicomMoveScuJob job(GetContext(), s2); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1262 ASSERT_EQ("TARGET", job.GetTargetAet()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1263 ASSERT_EQ("LOCAL", job.GetParameters().GetLocalApplicationEntityTitle()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1264 ASSERT_EQ("REMOTE", job.GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1265 ASSERT_EQ("192.168.1.1", job.GetParameters().GetRemoteModality().GetHost()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1266 ASSERT_EQ(4242u, job.GetParameters().GetRemoteModality().GetPortNumber()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1267 ASSERT_EQ("test", job.GetDescription()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1268 ASSERT_TRUE(job.IsPermissive()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1269 ASSERT_EQ(1u, job.GetPosition()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1270 ASSERT_EQ(1u, job.GetCommandsCount()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1271 ASSERT_EQ(DicomToJsonFormat_Full, job.GetQueryFormat()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1272 ASSERT_EQ(1u, s2["Commands"].size()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1273 ASSERT_EQ(command.toStyledString(), s2["Commands"][0].toStyledString()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1274 ASSERT_EQ(1u, s2["Query"].size()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1275 ASSERT_EQ(query.toStyledString(), s2["Query"][0].toStyledString()); |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1276 } |
7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4693
diff
changeset
|
1277 } |