diff --git a/frameworks/test/moduletest/mock/include/mock_single_kv_store.h b/frameworks/test/moduletest/mock/include/mock_single_kv_store.h index ffae6b4be5590d59b64df83b686f40526943897d..44b5ec6e731dc303f059d888f973c9a941cb64b5 100644 --- a/frameworks/test/moduletest/mock/include/mock_single_kv_store.h +++ b/frameworks/test/moduletest/mock/include/mock_single_kv_store.h @@ -304,6 +304,34 @@ public: */ virtual Status UnsubscribeWithQuery(const std::vector &deviceIds, const DataQuery &query) override; + /** + * @brief backup the store to a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this backup operation. + */ + virtual Status Backup(const std::string &file, const std::string &baseDir) override; + + /** + * @brief restore the store from a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this restore operation. + */ + virtual Status Restore(const std::string &file, const std::string &baseDir) override; + + /** + * @brief delete the backup files + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @param status result of delete backup. + * @return Indicates the status of this delete backup operation. + */ + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, + std::map &status) override; public: /** * @brief Mock insert into kv store. diff --git a/frameworks/test/moduletest/mock/mock_single_kv_store.cpp b/frameworks/test/moduletest/mock/mock_single_kv_store.cpp index 07e545792ceddfaba289692bc7f5d847f5194448..3fe4e2250a56f7ed9ffc23de31ff35c440cf3014 100644 --- a/frameworks/test/moduletest/mock/mock_single_kv_store.cpp +++ b/frameworks/test/moduletest/mock/mock_single_kv_store.cpp @@ -275,5 +275,22 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) +{ + return Status::SUCCESS; +} } // namespace DistributedKv } // namespace OHOS diff --git a/services/ans/test/unittest/mock/include/mock_single_kv_store.h b/services/ans/test/unittest/mock/include/mock_single_kv_store.h index 01db4cd42a74bb391a7aaa3f47a15d49656fca84..844a4ad5a8e4e6d9fece6a50ccc3ef9b09cb63ca 100644 --- a/services/ans/test/unittest/mock/include/mock_single_kv_store.h +++ b/services/ans/test/unittest/mock/include/mock_single_kv_store.h @@ -303,6 +303,35 @@ public: * @return Indicates the status of this UnSubscribe operation. */ virtual Status UnsubscribeWithQuery(const std::vector &deviceIds, const DataQuery &query) override; + + /** + * @brief backup the store to a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this backup operation. + */ + virtual Status Backup(const std::string &file, const std::string &baseDir) override; + + /** + * @brief restore the store from a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this restore operation. + */ + virtual Status Restore(const std::string &file, const std::string &baseDir) override; + + /** + * @brief delete the backup files + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @param status result of delete backup. + * @return Indicates the status of this delete backup operation. + */ + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, + std::map &status) override; }; } // namespace DistributedKv } // namespace OHOS diff --git a/services/ans/test/unittest/mock/mock_single_kv_store.cpp b/services/ans/test/unittest/mock/mock_single_kv_store.cpp index aba77bcef69852365abbd0568461b247b8f9ccf9..aa774f06bccdab86a8c72c53d5a2547c086376db 100644 --- a/services/ans/test/unittest/mock/mock_single_kv_store.cpp +++ b/services/ans/test/unittest/mock/mock_single_kv_store.cpp @@ -166,5 +166,22 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) +{ + return Status::SUCCESS; +} } // namespace DistributedKv } // namespace OHOS diff --git a/services/distributed/test/unittest/mock/mock_single_kv_store.cpp b/services/distributed/test/unittest/mock/mock_single_kv_store.cpp index 2c0862cd3d76800289e868e701991a6ef1d14f5d..e4dbff65e973bd815c870f9a70b38ebb09772160 100644 --- a/services/distributed/test/unittest/mock/mock_single_kv_store.cpp +++ b/services/distributed/test/unittest/mock/mock_single_kv_store.cpp @@ -167,5 +167,22 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) +{ + return Status::SUCCESS; +} } // namespace DistributedKv } // namespace OHOS diff --git a/services/distributed/test/unittest/mock/mock_single_kv_store.h b/services/distributed/test/unittest/mock/mock_single_kv_store.h index 2479cbcaf0b6243c4bdd3ab0ef0280dc2384c343..c639005cc192f07b24857367d54b0a599aa7e57e 100644 --- a/services/distributed/test/unittest/mock/mock_single_kv_store.h +++ b/services/distributed/test/unittest/mock/mock_single_kv_store.h @@ -305,6 +305,35 @@ public: * @return Indicates the status of this UnSubscribe operation. */ virtual Status UnsubscribeWithQuery(const std::vector &deviceIds, const DataQuery &query) override; + + /** + * @brief backup the store to a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this backup operation. + */ + virtual Status Backup(const std::string &file, const std::string &baseDir) override; + + /** + * @brief restore the store from a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this restore operation. + */ + virtual Status Restore(const std::string &file, const std::string &baseDir) override; + + /** + * @brief delete the backup files + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @param status result of delete backup. + * @return Indicates the status of this delete backup operation. + */ + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, + std::map &status) override; }; } // namespace DistributedKv } // namespace OHOS diff --git a/services/test/moduletest/mock/include/mock_single_kv_store.h b/services/test/moduletest/mock/include/mock_single_kv_store.h index 347cc59aa37c8d22ea77ffbfc09967914dba8a50..520255b04c0e9f5e191b07833808ffa24e0a66f3 100644 --- a/services/test/moduletest/mock/include/mock_single_kv_store.h +++ b/services/test/moduletest/mock/include/mock_single_kv_store.h @@ -304,6 +304,35 @@ public: * @return Indicates the status of this UnSubscribe operation. */ virtual Status UnsubscribeWithQuery(const std::vector &deviceIds, const DataQuery &query) override; + + /** + * @brief backup the store to a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this backup operation. + */ + virtual Status Backup(const std::string &file, const std::string &baseDir) override; + + /** + * @brief restore the store from a specified backup file + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @return Indicates the status of this restore operation. + */ + virtual Status Restore(const std::string &file, const std::string &baseDir) override; + + /** + * @brief delete the backup files + * + * @param file target file of backup. + * @param baseDir root path of store manager. + * @param status result of delete backup. + * @return Indicates the status of this delete backup operation. + */ + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, + std::map &status) override; }; } // namespace DistributedKv } // namespace OHOS diff --git a/services/test/moduletest/mock/mock_single_kv_store.cpp b/services/test/moduletest/mock/mock_single_kv_store.cpp index 446e9bb0569324c93c5a663c7f0b2c518926e783..236aa519d326a055726512fe0786c58525ee22a5 100644 --- a/services/test/moduletest/mock/mock_single_kv_store.cpp +++ b/services/test/moduletest/mock/mock_single_kv_store.cpp @@ -167,5 +167,22 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) +{ + return Status::SUCCESS; +} } // namespace DistributedKv } // namespace OHOS