diff --git a/repertory/librepertory/src/db/rdb_meta_db.cpp b/repertory/librepertory/src/db/rdb_meta_db.cpp index 59a1345a..7ef9a55f 100644 --- a/repertory/librepertory/src/db/rdb_meta_db.cpp +++ b/repertory/librepertory/src/db/rdb_meta_db.cpp @@ -376,8 +376,8 @@ auto rdb_meta_db::update_item_meta(const std::string &api_path, json json_data) auto size = directory ? std::uint64_t(0U) : utils::string::to_uint64( json_data.at(META_SIZE).get()); - auto source_path = - directory ? "" : json_data.at(META_SOURCE).get(); + auto source_path = directory ? std::string("") + : json_data.at(META_SOURCE).get(); if (not directory) { std::string orig_source_path; @@ -413,13 +413,13 @@ auto rdb_meta_db::update_item_meta(const std::string &api_path, json json_data) if (not res.ok()) { return res; } - } - if (not source_path.empty()) { - auto res = db_->Put(rocksdb::WriteOptions(), source_family_, - source_path, api_path); - if (not res.ok()) { - return res; + if (not source_path.empty()) { + res = db_->Put(rocksdb::WriteOptions(), source_family_, source_path, + api_path); + if (not res.ok()) { + return res; + } } } diff --git a/repertory/librepertory/src/db/sqlite_meta_db.cpp b/repertory/librepertory/src/db/sqlite_meta_db.cpp index 38c9a1c1..b7d1e2ab 100644 --- a/repertory/librepertory/src/db/sqlite_meta_db.cpp +++ b/repertory/librepertory/src/db/sqlite_meta_db.cpp @@ -322,7 +322,7 @@ auto sqlite_meta_db::update_item_meta(const std::string &api_path, directory ? false : utils::string::to_bool(meta.at(META_PINNED)); auto size = directory ? std::uint64_t(0U) : utils::string::to_uint64(meta.at(META_SIZE)); - auto source_path = directory ? "" : meta.at(META_SOURCE); + auto source_path = directory ? std::string("") : meta.at(META_SOURCE); meta.erase(META_DIRECTORY); meta.erase(META_PINNED); diff --git a/repertory/repertory_test/include/fixtures/meta_db_fixture.hpp b/repertory/repertory_test/include/fixtures/meta_db_fixture.hpp index 9c649fd8..3598a4ef 100644 --- a/repertory/repertory_test/include/fixtures/meta_db_fixture.hpp +++ b/repertory/repertory_test/include/fixtures/meta_db_fixture.hpp @@ -25,20 +25,23 @@ #include "test_common.hpp" #include "app_config.hpp" -#include "db/i_meta_db.hpp" #include "db/rdb_meta_db.hpp" #include "db/sqlite_meta_db.hpp" +#include "events/consumers/console_consumer.hpp" +#include "events/event_system.hpp" namespace repertory { template class meta_db_test : public ::testing::Test { protected: static std::unique_ptr config; + static console_consumer console_; static std::unique_ptr meta_db; protected: static void SetUpTestCase() { static std::uint64_t idx{}; + event_system::instance().start(); auto cfg_directory = utils::path::combine(test::get_test_output_dir(), { "meta_db_test", @@ -51,6 +54,7 @@ protected: static void TearDownTestCase() { meta_db.reset(); config.reset(); + event_system::instance().stop(); } }; @@ -58,6 +62,8 @@ using meta_db_types = ::testing::Types; template std::unique_ptr meta_db_test::config; +template console_consumer meta_db_test::console_; + template std::unique_ptr meta_db_test::meta_db; } // namespace repertory