comparison SQLite/UnitTests/UnitTestsMain.cpp @ 569:f18e46d7dbf8 attach-custom-data

merged find-refactoring -> attach-custom-data
author Alain Mazy <am@orthanc.team>
date Tue, 24 Sep 2024 15:04:21 +0200
parents 54d518dcd74a
children
comparison
equal deleted inserted replaced
368:82f73188b58d 569:f18e46d7dbf8
1 /** 1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium 4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium 5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 * 8 *
7 * This program is free software: you can redistribute it and/or 9 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License 10 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of 11 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
32 #include "../../Framework/Plugins/IndexUnitTests.h" 34 #include "../../Framework/Plugins/IndexUnitTests.h"
33 35
34 36
35 TEST(SQLiteIndex, Lock) 37 TEST(SQLiteIndex, Lock)
36 { 38 {
39 std::list<OrthancDatabases::IdentifierTag> identifierTags;
40
37 { 41 {
38 // No locking if using memory backend 42 // No locking if using memory backend
39 OrthancDatabases::SQLiteIndex db1(NULL); 43 OrthancDatabases::SQLiteIndex db1(NULL);
40 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1)); 44 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1, false, identifierTags));
41 45
42 OrthancDatabases::SQLiteIndex db2(NULL); 46 OrthancDatabases::SQLiteIndex db2(NULL);
43 std::unique_ptr<OrthancDatabases::DatabaseManager> manager2(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2)); 47 std::unique_ptr<OrthancDatabases::DatabaseManager> manager2(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2, false, identifierTags));
44 } 48 }
45 49
46 Orthanc::SystemToolbox::RemoveFile("index.db"); 50 Orthanc::SystemToolbox::RemoveFile("index.db");
47 51
48 { 52 {
49 OrthancDatabases::SQLiteIndex db1(NULL, "index.db"); 53 OrthancDatabases::SQLiteIndex db1(NULL, "index.db");
50 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1)); 54 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1, false, identifierTags));
51 55
52 OrthancDatabases::SQLiteIndex db2(NULL, "index.db"); 56 OrthancDatabases::SQLiteIndex db2(NULL, "index.db");
53 ASSERT_THROW(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2), Orthanc::OrthancException); 57 ASSERT_THROW(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2, false, identifierTags), Orthanc::OrthancException);
54 } 58 }
55 59
56 { 60 {
57 OrthancDatabases::SQLiteIndex db3(NULL, "index.db"); 61 OrthancDatabases::SQLiteIndex db3(NULL, "index.db");
58 std::unique_ptr<OrthancDatabases::DatabaseManager> manager3(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db3)); 62 std::unique_ptr<OrthancDatabases::DatabaseManager> manager3(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db3, false, identifierTags));
59 } 63 }
60 } 64 }
61 65
62 66
63 TEST(SQLite, ImplicitTransaction) 67 TEST(SQLite, ImplicitTransaction)