Mercurial > hg > orthanc
comparison UnitTestsSources/ServerIndexTests.cpp @ 1247:32fcc5dc7562
abstraction
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 08 Dec 2014 13:54:27 +0100 |
parents | 90d2f320862d |
children | ee43f0d611a8 |
comparison
equal
deleted
inserted
replaced
1246:54bf0f0245f4 | 1247:32fcc5dc7562 |
---|---|
108 } | 108 } |
109 | 109 |
110 virtual void SetUp() | 110 virtual void SetUp() |
111 { | 111 { |
112 listener_.reset(new ServerIndexListener); | 112 listener_.reset(new ServerIndexListener); |
113 index_.reset(new DatabaseWrapper(*listener_)); | 113 index_.reset(new DatabaseWrapper()); |
114 index_->SetListener(*listener_); | |
114 } | 115 } |
115 | 116 |
116 virtual void TearDown() | 117 virtual void TearDown() |
117 { | 118 { |
118 index_.reset(NULL); | 119 index_.reset(NULL); |
545 { | 546 { |
546 const std::string path = "UnitTestsStorage"; | 547 const std::string path = "UnitTestsStorage"; |
547 | 548 |
548 Toolbox::RemoveFile(path + "/index"); | 549 Toolbox::RemoveFile(path + "/index"); |
549 FilesystemStorage storage(path); | 550 FilesystemStorage storage(path); |
550 ServerContext context(":memory:"); // The SQLite DB is in memory | 551 DatabaseWrapper db; // The SQLite DB is in memory |
552 ServerContext context(db); | |
551 context.SetStorageArea(storage); | 553 context.SetStorageArea(storage); |
552 ServerIndex& index = context.GetIndex(); | 554 ServerIndex& index = context.GetIndex(); |
553 | 555 |
554 ASSERT_EQ(1u, index.IncrementGlobalSequence(GlobalProperty_AnonymizationSequence)); | 556 ASSERT_EQ(1u, index.IncrementGlobalSequence(GlobalProperty_AnonymizationSequence)); |
555 ASSERT_EQ(2u, index.IncrementGlobalSequence(GlobalProperty_AnonymizationSequence)); | 557 ASSERT_EQ(2u, index.IncrementGlobalSequence(GlobalProperty_AnonymizationSequence)); |
612 { | 614 { |
613 const std::string path = "UnitTestsStorage"; | 615 const std::string path = "UnitTestsStorage"; |
614 | 616 |
615 Toolbox::RemoveFile(path + "/index"); | 617 Toolbox::RemoveFile(path + "/index"); |
616 FilesystemStorage storage(path); | 618 FilesystemStorage storage(path); |
617 ServerContext context(":memory:"); // The SQLite DB is in memory | 619 DatabaseWrapper db; // The SQLite DB is in memory |
620 ServerContext context(db); | |
618 context.SetStorageArea(storage); | 621 context.SetStorageArea(storage); |
619 ServerIndex& index = context.GetIndex(); | 622 ServerIndex& index = context.GetIndex(); |
620 | 623 |
621 index.SetMaximumStorageSize(10); | 624 index.SetMaximumStorageSize(10); |
622 | 625 |