From 93f5dfad44de4f01891f6f4ed11e664a54bdb879 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Thu, 28 Jul 2022 14:32:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KVDB=E6=89=8B=E5=8A=A8=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=8D=95=E4=BD=93=E6=B5=8B=E8=AF=95=E6=89=93?= =?UTF-8?q?=E6=A1=A9=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dboy190 --- .../mock/include/mock_single_kv_store.h | 28 ++++++++++++++++++ .../moduletest/mock/mock_single_kv_store.cpp | 16 ++++++++++ .../mock/include/mock_single_kv_store.h | 29 +++++++++++++++++++ .../unittest/mock/mock_single_kv_store.cpp | 16 ++++++++++ .../unittest/mock/mock_single_kv_store.cpp | 16 ++++++++++ .../test/unittest/mock/mock_single_kv_store.h | 29 +++++++++++++++++++ .../mock/include/mock_single_kv_store.h | 29 +++++++++++++++++++ .../moduletest/mock/mock_single_kv_store.cpp | 16 ++++++++++ 8 files changed, 179 insertions(+) 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 ffae6b4be..7ef89a66d 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(std::string &file, 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(std::string &file, 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(std::vector &files, 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 07e545792..cfff5b84c 100644 --- a/frameworks/test/moduletest/mock/mock_single_kv_store.cpp +++ b/frameworks/test/moduletest/mock/mock_single_kv_store.cpp @@ -275,5 +275,21 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup(std::vector &files, 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 01db4cd42..48de86929 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(std::string &file, 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(std::string &file, 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(std::vector &files, 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 aba77bcef..db177d76d 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,21 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup(std::vector &files, 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 2c0862cd3..01ab7632a 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,21 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup(std::vector &files, 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 2479cbcaf..56d90b3c8 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(std::string &file, 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(std::string &file, 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(std::vector &files, 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 347cc59aa..740289e90 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(std::string &file, 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(std::string &file, 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(std::vector &files, 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 446e9bb05..51c77c0d6 100644 --- a/services/test/moduletest/mock/mock_single_kv_store.cpp +++ b/services/test/moduletest/mock/mock_single_kv_store.cpp @@ -167,5 +167,21 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d { return Status::SUCCESS; } + +Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +{ + return Status::SUCCESS; +} + +Status MockSingleKvStore::DeleteBackup(std::vector &files, std::string &baseDir, + std::map &status) +{ + return Status::SUCCESS; +} } // namespace DistributedKv } // namespace OHOS -- Gitee From beee18c0ec59b6e58940e824a6584ba485a0cd66 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Fri, 29 Jul 2022 18:03:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=EF=BC=8Cmock=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dboy190 --- .../test/moduletest/mock/include/mock_single_kv_store.h | 6 +++--- frameworks/test/moduletest/mock/mock_single_kv_store.cpp | 9 +++++---- .../test/unittest/mock/include/mock_single_kv_store.h | 6 +++--- services/ans/test/unittest/mock/mock_single_kv_store.cpp | 9 +++++---- .../test/unittest/mock/mock_single_kv_store.cpp | 9 +++++---- .../test/unittest/mock/mock_single_kv_store.h | 6 +++--- .../test/moduletest/mock/include/mock_single_kv_store.h | 6 +++--- services/test/moduletest/mock/mock_single_kv_store.cpp | 9 +++++---- 8 files changed, 32 insertions(+), 28 deletions(-) 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 7ef89a66d..44b5ec6e7 100644 --- a/frameworks/test/moduletest/mock/include/mock_single_kv_store.h +++ b/frameworks/test/moduletest/mock/include/mock_single_kv_store.h @@ -311,7 +311,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this backup operation. */ - virtual Status Backup(std::string &file, std::string &baseDir) override; + virtual Status Backup(const std::string &file, const std::string &baseDir) override; /** * @brief restore the store from a specified backup file @@ -320,7 +320,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this restore operation. */ - virtual Status Restore(std::string &file, std::string &baseDir) override; + virtual Status Restore(const std::string &file, const std::string &baseDir) override; /** * @brief delete the backup files @@ -330,7 +330,7 @@ public: * @param status result of delete backup. * @return Indicates the status of this delete backup operation. */ - virtual Status DeleteBackup(std::vector &files, std::string &baseDir, + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, std::map &status) override; public: /** diff --git a/frameworks/test/moduletest/mock/mock_single_kv_store.cpp b/frameworks/test/moduletest/mock/mock_single_kv_store.cpp index cfff5b84c..3fe4e2250 100644 --- a/frameworks/test/moduletest/mock/mock_single_kv_store.cpp +++ b/frameworks/test/moduletest/mock/mock_single_kv_store.cpp @@ -276,18 +276,19 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d return Status::SUCCESS; } -Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::DeleteBackup(std::vector &files, std::string &baseDir, - std::map &status) +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) { return Status::SUCCESS; } 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 48de86929..844a4ad5a 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 @@ -311,7 +311,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this backup operation. */ - virtual Status Backup(std::string &file, std::string &baseDir) override; + virtual Status Backup(const std::string &file, const std::string &baseDir) override; /** * @brief restore the store from a specified backup file @@ -320,7 +320,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this restore operation. */ - virtual Status Restore(std::string &file, std::string &baseDir) override; + virtual Status Restore(const std::string &file, const std::string &baseDir) override; /** * @brief delete the backup files @@ -330,7 +330,7 @@ public: * @param status result of delete backup. * @return Indicates the status of this delete backup operation. */ - virtual Status DeleteBackup(std::vector &files, std::string &baseDir, + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, std::map &status) override; }; } // namespace DistributedKv 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 db177d76d..aa774f06b 100644 --- a/services/ans/test/unittest/mock/mock_single_kv_store.cpp +++ b/services/ans/test/unittest/mock/mock_single_kv_store.cpp @@ -167,18 +167,19 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d return Status::SUCCESS; } -Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::DeleteBackup(std::vector &files, std::string &baseDir, - std::map &status) +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) { return Status::SUCCESS; } 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 01ab7632a..e4dbff65e 100644 --- a/services/distributed/test/unittest/mock/mock_single_kv_store.cpp +++ b/services/distributed/test/unittest/mock/mock_single_kv_store.cpp @@ -168,18 +168,19 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d return Status::SUCCESS; } -Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::DeleteBackup(std::vector &files, std::string &baseDir, - std::map &status) +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) { return Status::SUCCESS; } 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 56d90b3c8..c639005cc 100644 --- a/services/distributed/test/unittest/mock/mock_single_kv_store.h +++ b/services/distributed/test/unittest/mock/mock_single_kv_store.h @@ -313,7 +313,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this backup operation. */ - virtual Status Backup(std::string &file, std::string &baseDir) override; + virtual Status Backup(const std::string &file, const std::string &baseDir) override; /** * @brief restore the store from a specified backup file @@ -322,7 +322,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this restore operation. */ - virtual Status Restore(std::string &file, std::string &baseDir) override; + virtual Status Restore(const std::string &file, const std::string &baseDir) override; /** * @brief delete the backup files @@ -332,7 +332,7 @@ public: * @param status result of delete backup. * @return Indicates the status of this delete backup operation. */ - virtual Status DeleteBackup(std::vector &files, std::string &baseDir, + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, std::map &status) override; }; } // namespace DistributedKv 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 740289e90..520255b04 100644 --- a/services/test/moduletest/mock/include/mock_single_kv_store.h +++ b/services/test/moduletest/mock/include/mock_single_kv_store.h @@ -312,7 +312,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this backup operation. */ - virtual Status Backup(std::string &file, std::string &baseDir) override; + virtual Status Backup(const std::string &file, const std::string &baseDir) override; /** * @brief restore the store from a specified backup file @@ -321,7 +321,7 @@ public: * @param baseDir root path of store manager. * @return Indicates the status of this restore operation. */ - virtual Status Restore(std::string &file, std::string &baseDir) override; + virtual Status Restore(const std::string &file, const std::string &baseDir) override; /** * @brief delete the backup files @@ -331,7 +331,7 @@ public: * @param status result of delete backup. * @return Indicates the status of this delete backup operation. */ - virtual Status DeleteBackup(std::vector &files, std::string &baseDir, + virtual Status DeleteBackup(const std::vector &files, const std::string &baseDir, std::map &status) override; }; } // namespace DistributedKv diff --git a/services/test/moduletest/mock/mock_single_kv_store.cpp b/services/test/moduletest/mock/mock_single_kv_store.cpp index 51c77c0d6..236aa519d 100644 --- a/services/test/moduletest/mock/mock_single_kv_store.cpp +++ b/services/test/moduletest/mock/mock_single_kv_store.cpp @@ -168,18 +168,19 @@ Status MockSingleKvStore::UnsubscribeWithQuery(const std::vector &d return Status::SUCCESS; } -Status MockSingleKvStore::Backup(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Backup(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::Restore(std::string &file, std::string &baseDir) +Status MockSingleKvStore::Restore(const std::string &file, const std::string &baseDir) { return Status::SUCCESS; } -Status MockSingleKvStore::DeleteBackup(std::vector &files, std::string &baseDir, - std::map &status) +Status MockSingleKvStore::DeleteBackup( + const std::vector &files, const std::string &baseDir, + std::map &status) { return Status::SUCCESS; } -- Gitee