diff Framework/Plugins/IndexUnitTests.h @ 289:0868500060f3

Fix serialization of large jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Jun 2021 08:19:52 +0200
parents 6d4d413a8797
children 2447c290fc73
line wrap: on
line diff
--- a/Framework/Plugins/IndexUnitTests.h	Mon Jun 28 15:34:49 2021 +0200
+++ b/Framework/Plugins/IndexUnitTests.h	Wed Jun 30 08:19:52 2021 +0200
@@ -523,7 +523,8 @@
   ASSERT_EQ(p1, r);
 
   {
-    // Test creating a large property of 16MB
+    // Test creating a large property of 16MB (large properties are
+    // notably necessary to serialize jobs)
     // https://groups.google.com/g/orthanc-users/c/1Y3nTBdr0uE/m/K7PA5pboAgAJ
     std::string longProperty;
     longProperty.resize(16 * 1024 * 1024);
@@ -534,9 +535,17 @@
 
     db.SetGlobalProperty(*manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8, longProperty.c_str());
 
+    // The following line fails on MySQL 4.0 because the "value"
+    // column in "ServerProperties" is "TEXT" instead of "LONGTEXT"
+    db.SetGlobalProperty(*manager, "some-server", Orthanc::GlobalProperty_DatabaseInternal8, longProperty.c_str());
+
     std::string tmp;
     ASSERT_TRUE(db.LookupGlobalProperty(tmp, *manager, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseInternal8));
     ASSERT_EQ(longProperty, tmp);
+
+    tmp.clear();
+    ASSERT_TRUE(db.LookupGlobalProperty(tmp, *manager, "some-server", Orthanc::GlobalProperty_DatabaseInternal8));
+    ASSERT_EQ(longProperty, tmp);
   }
 
   manager->Close();