Mercurial > hg > orthanc
comparison OrthancServer/UnitTestsSources/ServerJobsTests.cpp @ 4730:7826ac059c31
Added Short/Simplify/Full options to format "/modalities/{id}/find-worklist" and "/queries/{id}/retrieve"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Jun 2021 18:13:45 +0200 |
parents | 45bce660ce3a |
children | c1d6ce00be3f 94616af363ec 0a38000b086d |
comparison
equal
deleted
inserted
replaced
4729:4e2247df6327 | 4730:7826ac059c31 |
---|---|
1194 ASSERT_EQ("ANY-SCP", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); | 1194 ASSERT_EQ("ANY-SCP", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
1195 ASSERT_EQ("127.0.0.1", job->GetParameters().GetRemoteModality().GetHost()); | 1195 ASSERT_EQ("127.0.0.1", job->GetParameters().GetRemoteModality().GetHost()); |
1196 ASSERT_EQ(104u, job->GetParameters().GetRemoteModality().GetPortNumber()); | 1196 ASSERT_EQ(104u, job->GetParameters().GetRemoteModality().GetPortNumber()); |
1197 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); | 1197 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); |
1198 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), job->GetParameters().GetTimeout()); | 1198 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), job->GetParameters().GetTimeout()); |
1199 ASSERT_EQ(DicomToJsonFormat_Short, job->GetQueryFormat()); | |
1199 } | 1200 } |
1200 | 1201 |
1201 { | 1202 { |
1202 RemoteModalityParameters r; | 1203 RemoteModalityParameters r; |
1203 r.SetApplicationEntityTitle("HELLO"); | 1204 r.SetApplicationEntityTitle("HELLO"); |
1206 | 1207 |
1207 DicomMoveScuJob job(GetContext()); | 1208 DicomMoveScuJob job(GetContext()); |
1208 job.SetLocalAet("WORLD"); | 1209 job.SetLocalAet("WORLD"); |
1209 job.SetRemoteModality(r); | 1210 job.SetRemoteModality(r); |
1210 job.SetTimeout(43); | 1211 job.SetTimeout(43); |
1212 job.SetQueryFormat(DicomToJsonFormat_Human); | |
1213 | |
1211 job.Serialize(v); | 1214 job.Serialize(v); |
1212 } | 1215 } |
1213 | 1216 |
1214 { | 1217 { |
1215 OrthancJobUnserializer unserializer(GetContext()); | 1218 OrthancJobUnserializer unserializer(GetContext()); |
1219 ASSERT_EQ("HELLO", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); | 1222 ASSERT_EQ("HELLO", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); |
1220 ASSERT_EQ("MY_HOST", job->GetParameters().GetRemoteModality().GetHost()); | 1223 ASSERT_EQ("MY_HOST", job->GetParameters().GetRemoteModality().GetHost()); |
1221 ASSERT_EQ(42u, job->GetParameters().GetRemoteModality().GetPortNumber()); | 1224 ASSERT_EQ(42u, job->GetParameters().GetRemoteModality().GetPortNumber()); |
1222 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); | 1225 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); |
1223 ASSERT_EQ(43u, job->GetParameters().GetTimeout()); | 1226 ASSERT_EQ(43u, job->GetParameters().GetTimeout()); |
1224 } | 1227 ASSERT_EQ(DicomToJsonFormat_Human, job->GetQueryFormat()); |
1225 } | 1228 } |
1229 } | |
1230 | |
1231 | |
1232 TEST_F(OrthancJobsSerialization, DicomMoveScuJob) | |
1233 { | |
1234 Json::Value command = Json::objectValue; | |
1235 command["0008,0005"]["Type"] = "String"; | |
1236 command["0008,0005"]["Content"] = "ISO_IR 100"; | |
1237 command["0010,0020"]["Type"] = "String"; | |
1238 command["0010,0020"]["Content"] = "1234"; | |
1239 | |
1240 Json::Value query = Json::objectValue; | |
1241 query["0010,0020"] = "456"; | |
1242 query["0008,0052"] = "STUDY"; | |
1243 | |
1244 Json::Value remote = Json::objectValue; | |
1245 remote["AET"] = "REMOTE"; | |
1246 remote["Host"] = "192.168.1.1"; | |
1247 remote["Port"] = 4242; | |
1248 | |
1249 Json::Value s = Json::objectValue; | |
1250 s["Permissive"] = true; | |
1251 s["Position"] = 1; | |
1252 s["Description"] = "test"; | |
1253 s["Remote"] = remote; | |
1254 s["LocalAet"] = "LOCAL"; | |
1255 s["TargetAet"] = "TARGET"; | |
1256 s["QueryFormat"] = "Full"; | |
1257 s["Query"] = Json::arrayValue; | |
1258 s["Query"].append(query); | |
1259 s["Commands"] = Json::arrayValue; | |
1260 s["Commands"].append(command); | |
1261 | |
1262 Json::Value s2; | |
1263 | |
1264 { | |
1265 DicomMoveScuJob job(GetContext(), s); | |
1266 job.Serialize(s2); | |
1267 } | |
1268 | |
1269 { | |
1270 DicomMoveScuJob job(GetContext(), s2); | |
1271 ASSERT_EQ("TARGET", job.GetTargetAet()); | |
1272 ASSERT_EQ("LOCAL", job.GetParameters().GetLocalApplicationEntityTitle()); | |
1273 ASSERT_EQ("REMOTE", job.GetParameters().GetRemoteModality().GetApplicationEntityTitle()); | |
1274 ASSERT_EQ("192.168.1.1", job.GetParameters().GetRemoteModality().GetHost()); | |
1275 ASSERT_EQ(4242u, job.GetParameters().GetRemoteModality().GetPortNumber()); | |
1276 ASSERT_EQ("test", job.GetDescription()); | |
1277 ASSERT_TRUE(job.IsPermissive()); | |
1278 ASSERT_EQ(1u, job.GetPosition()); | |
1279 ASSERT_EQ(1u, job.GetCommandsCount()); | |
1280 ASSERT_EQ(DicomToJsonFormat_Full, job.GetQueryFormat()); | |
1281 ASSERT_EQ(1u, s2["Commands"].size()); | |
1282 ASSERT_EQ(command.toStyledString(), s2["Commands"][0].toStyledString()); | |
1283 ASSERT_EQ(1u, s2["Query"].size()); | |
1284 ASSERT_EQ(query.toStyledString(), s2["Query"][0].toStyledString()); | |
1285 } | |
1286 } |