Mercurial > hg > orthanc-databases
diff PostgreSQL/UnitTests/PostgreSQLTests.cpp @ 242:b97a537f4613
MySQL: Support of range reads for the storage area
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 13 Apr 2021 17:00:02 +0200 |
parents | 35598014f140 |
children | 483af3f35a4b |
line wrap: on
line diff
--- a/PostgreSQL/UnitTests/PostgreSQLTests.cpp Tue Apr 13 12:07:30 2021 +0200 +++ b/PostgreSQL/UnitTests/PostgreSQLTests.cpp Tue Apr 13 17:00:02 2021 +0200 @@ -363,7 +363,7 @@ PostgreSQLStorageArea storageArea(globalParameters_, true /* clear database */); { - PostgreSQLStorageArea::Accessor accessor(storageArea); + std::unique_ptr<OrthancDatabases::StorageBackend::IAccessor> accessor(storageArea.CreateAccessor()); ASSERT_EQ(0, CountLargeObjects(*database)); @@ -371,15 +371,15 @@ { std::string uuid = boost::lexical_cast<std::string>(i); std::string value = "Value " + boost::lexical_cast<std::string>(i * 2); - accessor.Create(uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown); + accessor->Create(uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown); } std::string buffer; - ASSERT_THROW(accessor.ReadToString(buffer, "nope", OrthancPluginContentType_Unknown), + ASSERT_THROW(OrthancDatabases::StorageBackend::ReadWholeToString(buffer, *accessor, "nope", OrthancPluginContentType_Unknown), Orthanc::OrthancException); ASSERT_EQ(10, CountLargeObjects(*database)); - accessor.Remove("5", OrthancPluginContentType_Unknown); + accessor->Remove("5", OrthancPluginContentType_Unknown); ASSERT_EQ(9, CountLargeObjects(*database)); @@ -390,19 +390,19 @@ if (i == 5) { - ASSERT_THROW(accessor.ReadToString(buffer, uuid, OrthancPluginContentType_Unknown), + ASSERT_THROW(OrthancDatabases::StorageBackend::ReadWholeToString(buffer, *accessor, uuid, OrthancPluginContentType_Unknown), Orthanc::OrthancException); } else { - accessor.ReadToString(buffer, uuid, OrthancPluginContentType_Unknown); + OrthancDatabases::StorageBackend::ReadWholeToString(buffer, *accessor, uuid, OrthancPluginContentType_Unknown); ASSERT_EQ(expected, buffer); } } for (int i = 0; i < 10; i++) { - accessor.Remove(boost::lexical_cast<std::string>(i), OrthancPluginContentType_Unknown); + accessor->Remove(boost::lexical_cast<std::string>(i), OrthancPluginContentType_Unknown); } ASSERT_EQ(0, CountLargeObjects(*database));