comparison OrthancFramework/UnitTestsSources/JobsTests.cpp @ 4451:f4dbdb2dcba6

new configuration option "MaximumPduLength" to tune the maximum PDU length
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 18 Jan 2021 14:51:52 +0100
parents 4a4e33c9082d
children 789676a8c96a
comparison
equal deleted inserted replaced
4450:9bf2f9e0af47 4451:f4dbdb2dcba6
1442 a.SerializeJob(v); 1442 a.SerializeJob(v);
1443 ASSERT_EQ(Json::objectValue, v.type()); 1443 ASSERT_EQ(Json::objectValue, v.type());
1444 ASSERT_EQ("ORTHANC", v["LocalAet"].asString()); 1444 ASSERT_EQ("ORTHANC", v["LocalAet"].asString());
1445 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), v["Timeout"].asInt()); 1445 ASSERT_EQ(DicomAssociationParameters::GetDefaultTimeout(), v["Timeout"].asInt());
1446 ASSERT_TRUE(v.isMember("Remote")); 1446 ASSERT_TRUE(v.isMember("Remote"));
1447 1447 ASSERT_TRUE(v.isMember("MaximumPduLength"));
1448 ASSERT_EQ(3u, v.getMemberNames().size()); 1448
1449 ASSERT_EQ(4u, v.getMemberNames().size());
1449 1450
1450 DicomAssociationParameters b; 1451 DicomAssociationParameters b;
1451 b.UnserializeJob(v); 1452 b.UnserializeJob(v);
1452 ASSERT_EQ("ANY-SCP", b.GetRemoteModality().GetApplicationEntityTitle()); 1453 ASSERT_EQ("ANY-SCP", b.GetRemoteModality().GetApplicationEntityTitle());
1453 ASSERT_EQ("127.0.0.1", b.GetRemoteModality().GetHost()); 1454 ASSERT_EQ("127.0.0.1", b.GetRemoteModality().GetHost());
1454 ASSERT_EQ(104u, b.GetRemoteModality().GetPortNumber()); 1455 ASSERT_EQ(104u, b.GetRemoteModality().GetPortNumber());
1455 ASSERT_EQ("ORTHANC", b.GetLocalApplicationEntityTitle()); 1456 ASSERT_EQ("ORTHANC", b.GetLocalApplicationEntityTitle());
1457 ASSERT_EQ(DicomAssociationParameters::GetDefaultMaximumPduLength(), b.GetMaximumPduLength());
1456 ASSERT_FALSE(b.GetRemoteModality().IsDicomTlsEnabled()); 1458 ASSERT_FALSE(b.GetRemoteModality().IsDicomTlsEnabled());
1457 } 1459 }
1458 1460
1459 { 1461 {
1460 RemoteModalityParameters p; 1462 RemoteModalityParameters p;
1465 1467
1466 DicomAssociationParameters a("HELLO", p); 1468 DicomAssociationParameters a("HELLO", p);
1467 a.SetOwnCertificatePath("key", "crt"); 1469 a.SetOwnCertificatePath("key", "crt");
1468 a.SetTrustedCertificatesPath("trusted"); 1470 a.SetTrustedCertificatesPath("trusted");
1469 1471
1472 ASSERT_THROW(a.SetMaximumPduLength(4095), OrthancException);
1473 ASSERT_THROW(a.SetMaximumPduLength(131073), OrthancException);
1474 a.SetMaximumPduLength(4096);
1475 a.SetMaximumPduLength(131072);
1476
1470 Json::Value v = Json::objectValue; 1477 Json::Value v = Json::objectValue;
1471 a.SerializeJob(v); 1478 a.SerializeJob(v);
1472 1479
1473 ASSERT_EQ(6u, v.getMemberNames().size()); 1480 ASSERT_EQ(7u, v.getMemberNames().size());
1474 1481
1475 DicomAssociationParameters b = DicomAssociationParameters::UnserializeJob(v); 1482 DicomAssociationParameters b = DicomAssociationParameters::UnserializeJob(v);
1476 1483
1477 ASSERT_EQ("WORLD", b.GetRemoteModality().GetApplicationEntityTitle()); 1484 ASSERT_EQ("WORLD", b.GetRemoteModality().GetApplicationEntityTitle());
1478 ASSERT_EQ("hello.world.com", b.GetRemoteModality().GetHost()); 1485 ASSERT_EQ("hello.world.com", b.GetRemoteModality().GetHost());
1480 ASSERT_EQ("HELLO", b.GetLocalApplicationEntityTitle()); 1487 ASSERT_EQ("HELLO", b.GetLocalApplicationEntityTitle());
1481 ASSERT_TRUE(b.GetRemoteModality().IsDicomTlsEnabled()); 1488 ASSERT_TRUE(b.GetRemoteModality().IsDicomTlsEnabled());
1482 ASSERT_EQ("key", b.GetOwnPrivateKeyPath()); 1489 ASSERT_EQ("key", b.GetOwnPrivateKeyPath());
1483 ASSERT_EQ("crt", b.GetOwnCertificatePath()); 1490 ASSERT_EQ("crt", b.GetOwnCertificatePath());
1484 ASSERT_EQ("trusted", b.GetTrustedCertificatesPath()); 1491 ASSERT_EQ("trusted", b.GetTrustedCertificatesPath());
1492 ASSERT_EQ(131072, b.GetMaximumPduLength());
1485 } 1493 }
1486 } 1494 }