comparison OrthancServer/UnitTestsSources/ServerJobsTests.cpp @ 4740:c1d6ce00be3f openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Jul 2021 08:40:43 +0200
parents f0038043fb97 7826ac059c31
children 70d2a97ca8cb
comparison
equal deleted inserted replaced
4739:8cc9137b5c2e 4740:c1d6ce00be3f
1182 ASSERT_EQ("ANY-SCP", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); 1182 ASSERT_EQ("ANY-SCP", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle());
1183 ASSERT_EQ("127.0.0.1", job->GetParameters().GetRemoteModality().GetHost()); 1183 ASSERT_EQ("127.0.0.1", job->GetParameters().GetRemoteModality().GetHost());
1184 ASSERT_EQ(104u, job->GetParameters().GetRemoteModality().GetPortNumber()); 1184 ASSERT_EQ(104u, job->GetParameters().GetRemoteModality().GetPortNumber());
1185 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); 1185 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer());
1186 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), job->GetParameters().GetTimeout()); 1186 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), job->GetParameters().GetTimeout());
1187 ASSERT_EQ(DicomToJsonFormat_Short, job->GetQueryFormat());
1187 } 1188 }
1188 1189
1189 { 1190 {
1190 RemoteModalityParameters r; 1191 RemoteModalityParameters r;
1191 r.SetApplicationEntityTitle("HELLO"); 1192 r.SetApplicationEntityTitle("HELLO");
1194 1195
1195 DicomMoveScuJob job(GetContext()); 1196 DicomMoveScuJob job(GetContext());
1196 job.SetLocalAet("WORLD"); 1197 job.SetLocalAet("WORLD");
1197 job.SetRemoteModality(r); 1198 job.SetRemoteModality(r);
1198 job.SetTimeout(43); 1199 job.SetTimeout(43);
1200 job.SetQueryFormat(DicomToJsonFormat_Human);
1201
1199 job.Serialize(v); 1202 job.Serialize(v);
1200 } 1203 }
1201 1204
1202 { 1205 {
1203 OrthancJobUnserializer unserializer(GetContext()); 1206 OrthancJobUnserializer unserializer(GetContext());
1207 ASSERT_EQ("HELLO", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle()); 1210 ASSERT_EQ("HELLO", job->GetParameters().GetRemoteModality().GetApplicationEntityTitle());
1208 ASSERT_EQ("MY_HOST", job->GetParameters().GetRemoteModality().GetHost()); 1211 ASSERT_EQ("MY_HOST", job->GetParameters().GetRemoteModality().GetHost());
1209 ASSERT_EQ(42u, job->GetParameters().GetRemoteModality().GetPortNumber()); 1212 ASSERT_EQ(42u, job->GetParameters().GetRemoteModality().GetPortNumber());
1210 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer()); 1213 ASSERT_EQ(ModalityManufacturer_Generic, job->GetParameters().GetRemoteModality().GetManufacturer());
1211 ASSERT_EQ(43u, job->GetParameters().GetTimeout()); 1214 ASSERT_EQ(43u, job->GetParameters().GetTimeout());
1212 } 1215 ASSERT_EQ(DicomToJsonFormat_Human, job->GetQueryFormat());
1213 } 1216 }
1217 }
1218
1219
1220 TEST_F(OrthancJobsSerialization, DicomMoveScuJob)
1221 {
1222 Json::Value command = Json::objectValue;
1223 command["0008,0005"]["Type"] = "String";
1224 command["0008,0005"]["Content"] = "ISO_IR 100";
1225 command["0010,0020"]["Type"] = "String";
1226 command["0010,0020"]["Content"] = "1234";
1227
1228 Json::Value query = Json::objectValue;
1229 query["0010,0020"] = "456";
1230 query["0008,0052"] = "STUDY";
1231
1232 Json::Value remote = Json::objectValue;
1233 remote["AET"] = "REMOTE";
1234 remote["Host"] = "192.168.1.1";
1235 remote["Port"] = 4242;
1236
1237 Json::Value s = Json::objectValue;
1238 s["Permissive"] = true;
1239 s["Position"] = 1;
1240 s["Description"] = "test";
1241 s["Remote"] = remote;
1242 s["LocalAet"] = "LOCAL";
1243 s["TargetAet"] = "TARGET";
1244 s["QueryFormat"] = "Full";
1245 s["Query"] = Json::arrayValue;
1246 s["Query"].append(query);
1247 s["Commands"] = Json::arrayValue;
1248 s["Commands"].append(command);
1249
1250 Json::Value s2;
1251
1252 {
1253 DicomMoveScuJob job(GetContext(), s);
1254 job.Serialize(s2);
1255 }
1256
1257 {
1258 DicomMoveScuJob job(GetContext(), s2);
1259 ASSERT_EQ("TARGET", job.GetTargetAet());
1260 ASSERT_EQ("LOCAL", job.GetParameters().GetLocalApplicationEntityTitle());
1261 ASSERT_EQ("REMOTE", job.GetParameters().GetRemoteModality().GetApplicationEntityTitle());
1262 ASSERT_EQ("192.168.1.1", job.GetParameters().GetRemoteModality().GetHost());
1263 ASSERT_EQ(4242u, job.GetParameters().GetRemoteModality().GetPortNumber());
1264 ASSERT_EQ("test", job.GetDescription());
1265 ASSERT_TRUE(job.IsPermissive());
1266 ASSERT_EQ(1u, job.GetPosition());
1267 ASSERT_EQ(1u, job.GetCommandsCount());
1268 ASSERT_EQ(DicomToJsonFormat_Full, job.GetQueryFormat());
1269 ASSERT_EQ(1u, s2["Commands"].size());
1270 ASSERT_EQ(command.toStyledString(), s2["Commands"][0].toStyledString());
1271 ASSERT_EQ(1u, s2["Query"].size());
1272 ASSERT_EQ(query.toStyledString(), s2["Query"][0].toStyledString());
1273 }
1274 }