comparison PostgreSQL/UnitTests/PostgreSQLTests.cpp @ 219:dd6cfc250747

removed useless class StorageAreaBuffer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 Mar 2021 14:52:55 +0200
parents fbb52129158a
children 73cc85f3d9c1
comparison
equal deleted inserted replaced
218:90eb271f85b2 219:dd6cfc250747
364 std::string uuid = boost::lexical_cast<std::string>(i); 364 std::string uuid = boost::lexical_cast<std::string>(i);
365 std::string value = "Value " + boost::lexical_cast<std::string>(i * 2); 365 std::string value = "Value " + boost::lexical_cast<std::string>(i * 2);
366 storageArea.Create(transaction, uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown); 366 storageArea.Create(transaction, uuid, value.c_str(), value.size(), OrthancPluginContentType_Unknown);
367 } 367 }
368 368
369 StorageAreaBuffer buffer(NULL /* we are running unit tests */); 369 std::string buffer;
370 ASSERT_THROW(storageArea.Read(buffer, transaction, "nope", OrthancPluginContentType_Unknown), 370 ASSERT_THROW(storageArea.ReadToString(buffer, transaction, "nope", OrthancPluginContentType_Unknown),
371 Orthanc::OrthancException); 371 Orthanc::OrthancException);
372 372
373 ASSERT_EQ(10, CountLargeObjects(db)); 373 ASSERT_EQ(10, CountLargeObjects(db));
374 storageArea.Remove(transaction, "5", OrthancPluginContentType_Unknown); 374 storageArea.Remove(transaction, "5", OrthancPluginContentType_Unknown);
375 375
380 std::string uuid = boost::lexical_cast<std::string>(i); 380 std::string uuid = boost::lexical_cast<std::string>(i);
381 std::string expected = "Value " + boost::lexical_cast<std::string>(i * 2); 381 std::string expected = "Value " + boost::lexical_cast<std::string>(i * 2);
382 382
383 if (i == 5) 383 if (i == 5)
384 { 384 {
385 ASSERT_THROW(storageArea.Read(buffer, transaction, uuid, OrthancPluginContentType_Unknown), 385 ASSERT_THROW(storageArea.ReadToString(buffer, transaction, uuid, OrthancPluginContentType_Unknown),
386 Orthanc::OrthancException); 386 Orthanc::OrthancException);
387 } 387 }
388 else 388 else
389 { 389 {
390 storageArea.Read(buffer, transaction, uuid, OrthancPluginContentType_Unknown); 390 storageArea.ReadToString(buffer, transaction, uuid, OrthancPluginContentType_Unknown);
391 391 ASSERT_EQ(expected, buffer);
392 std::string s;
393 buffer.ToString(s);
394 ASSERT_EQ(expected, s);
395 } 392 }
396 } 393 }
397 394
398 for (int i = 0; i < 10; i++) 395 for (int i = 0; i < 10; i++)
399 { 396 {