Mercurial > hg > orthanc-databases
comparison SQLite/UnitTests/UnitTestsMain.cpp @ 417:15bfd9a76f8d pg-transactions
merge
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 23 Jun 2023 14:26:58 +0200 |
parents | 91124cc8a8c7 |
children | ecd0b719cff5 |
comparison
equal
deleted
inserted
replaced
370:d2b5d9c92214 | 417:15bfd9a76f8d |
---|---|
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-2022 Osimis S.A., Belgium | 5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | 6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
7 * | 7 * |
8 * This program is free software: you can redistribute it and/or | 8 * This program is free software: you can redistribute it and/or |
9 * modify it under the terms of the GNU Affero General Public License | 9 * modify it under the terms of the GNU Affero General Public License |
10 * as published by the Free Software Foundation, either version 3 of | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | 11 * the License, or (at your option) any later version. |
33 #include "../../Framework/Plugins/IndexUnitTests.h" | 33 #include "../../Framework/Plugins/IndexUnitTests.h" |
34 | 34 |
35 | 35 |
36 TEST(SQLiteIndex, Lock) | 36 TEST(SQLiteIndex, Lock) |
37 { | 37 { |
38 std::list<OrthancDatabases::IdentifierTag> identifierTags; | |
39 | |
38 { | 40 { |
39 // No locking if using memory backend | 41 // No locking if using memory backend |
40 OrthancDatabases::SQLiteIndex db1(NULL); | 42 OrthancDatabases::SQLiteIndex db1(NULL); |
41 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1)); | 43 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1, false, identifierTags)); |
42 | 44 |
43 OrthancDatabases::SQLiteIndex db2(NULL); | 45 OrthancDatabases::SQLiteIndex db2(NULL); |
44 std::unique_ptr<OrthancDatabases::DatabaseManager> manager2(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2)); | 46 std::unique_ptr<OrthancDatabases::DatabaseManager> manager2(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2, false, identifierTags)); |
45 } | 47 } |
46 | 48 |
47 Orthanc::SystemToolbox::RemoveFile("index.db"); | 49 Orthanc::SystemToolbox::RemoveFile("index.db"); |
48 | 50 |
49 { | 51 { |
50 OrthancDatabases::SQLiteIndex db1(NULL, "index.db"); | 52 OrthancDatabases::SQLiteIndex db1(NULL, "index.db"); |
51 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1)); | 53 std::unique_ptr<OrthancDatabases::DatabaseManager> manager1(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db1, false, identifierTags)); |
52 | 54 |
53 OrthancDatabases::SQLiteIndex db2(NULL, "index.db"); | 55 OrthancDatabases::SQLiteIndex db2(NULL, "index.db"); |
54 ASSERT_THROW(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2), Orthanc::OrthancException); | 56 ASSERT_THROW(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db2, false, identifierTags), Orthanc::OrthancException); |
55 } | 57 } |
56 | 58 |
57 { | 59 { |
58 OrthancDatabases::SQLiteIndex db3(NULL, "index.db"); | 60 OrthancDatabases::SQLiteIndex db3(NULL, "index.db"); |
59 std::unique_ptr<OrthancDatabases::DatabaseManager> manager3(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db3)); | 61 std::unique_ptr<OrthancDatabases::DatabaseManager> manager3(OrthancDatabases::IndexBackend::CreateSingleDatabaseManager(db3, false, identifierTags)); |
60 } | 62 } |
61 } | 63 } |
62 | 64 |
63 | 65 |
64 TEST(SQLite, ImplicitTransaction) | 66 TEST(SQLite, ImplicitTransaction) |