From eb8938f772c2f3b6201eee15c0a6e175813b1267 Mon Sep 17 00:00:00 2001 From: Sven Wang Date: Tue, 6 Aug 2024 20:29:52 +0800 Subject: [PATCH] update the mock files Signed-off-by: Sven Wang --- .../native/rdb/mock/include/rdb_store_impl.h | 1 - .../rdb/mock/include/sqlite_connection.h | 1 + .../inner_api/rdb/mock/include/rdb_helper.h | 1 + .../rdb/mock/include/rdb_store_config.h | 42 ++++++++++--------- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/frameworks/native/rdb/mock/include/rdb_store_impl.h b/frameworks/native/rdb/mock/include/rdb_store_impl.h index babede5f0..4adabd782 100644 --- a/frameworks/native/rdb/mock/include/rdb_store_impl.h +++ b/frameworks/native/rdb/mock/include/rdb_store_impl.h @@ -112,7 +112,6 @@ protected: bool isEncrypt_; int64_t vSchema_ = 0; std::string path_; - std::string orgPath_; std::string name_; std::string fileType_; diff --git a/frameworks/native/rdb/mock/include/sqlite_connection.h b/frameworks/native/rdb/mock/include/sqlite_connection.h index f341c2d87..29a087cac 100644 --- a/frameworks/native/rdb/mock/include/sqlite_connection.h +++ b/frameworks/native/rdb/mock/include/sqlite_connection.h @@ -77,6 +77,7 @@ private: std::string GetSecManagerName(const RdbStoreConfig &config); int SetEncrypt(const RdbStoreConfig &config); int SetEncryptKey(const std::vector &key, int32_t iter); + int SetServiceKey(const RdbStoreConfig &config, int32_t lastErr); int SetEncryptAgo(int32_t iter); int SetJournalMode(const RdbStoreConfig &config); int SetJournalSizeLimit(const RdbStoreConfig &config); diff --git a/interfaces/inner_api/rdb/mock/include/rdb_helper.h b/interfaces/inner_api/rdb/mock/include/rdb_helper.h index a845d501a..2183de99f 100644 --- a/interfaces/inner_api/rdb/mock/include/rdb_helper.h +++ b/interfaces/inner_api/rdb/mock/include/rdb_helper.h @@ -31,6 +31,7 @@ public: static std::shared_ptr GetRdbStore( const RdbStoreConfig &config, int version, RdbOpenCallback &openCallback, int &errCode); static int DeleteRdbStore(const std::string &path); + static int DeleteRdbStore(const RdbStoreConfig &config); static void ClearCache(); }; } // namespace NativeRdb diff --git a/interfaces/inner_api/rdb/mock/include/rdb_store_config.h b/interfaces/inner_api/rdb/mock/include/rdb_store_config.h index 336770d43..e7dbb19bf 100644 --- a/interfaces/inner_api/rdb/mock/include/rdb_store_config.h +++ b/interfaces/inner_api/rdb/mock/include/rdb_store_config.h @@ -128,6 +128,8 @@ public: // distributed rdb int SetBundleName(const std::string &bundleName); std::string GetBundleName() const; + int SetDistributedType(DistributedType type); + DistributedType GetDistributedType() const; void SetModuleName(const std::string& moduleName); std::string GetModuleName() const; void SetServiceName(const std::string& serviceName); @@ -147,6 +149,9 @@ public: int GetReadConSize() const; void SetReadConSize(int readConSize); void SetEncryptKey(const std::vector &encryptKey); + + void RestoreEncryptKey(const std::vector &encryptKey) const; + std::vector GetEncryptKey() const; void ChangeEncryptKey() const; std::vector GetNewEncryptKey() const; @@ -189,13 +194,13 @@ public: } } - return this->path == config.path && this->storageMode == config.storageMode - && this->storageMode == config.storageMode && this->journalMode == config.journalMode - && this->syncMode == config.syncMode && this->databaseFileType == config.databaseFileType - && this->isEncrypt_ == config.isEncrypt_ && this->securityLevel == config.securityLevel - && this->journalSize_ == config.journalSize_ && this->pageSize_ == config.pageSize_ - && this->readConSize_ == config.readConSize_ && this->customDir_ == config.customDir_ - && this->allowRebuilt_ == config.allowRebuilt_ && this->pluginLibs_ == config.pluginLibs_; + return this->path_ == config.path_ && this->storageMode_ == config.storageMode_ && + this->journalMode_ == config.journalMode_ && this->syncMode_ == config.syncMode_ && + this->databaseFileType == config.databaseFileType && this->isEncrypt_ == config.isEncrypt_ && + this->securityLevel_ == config.securityLevel_ && this->journalSize_ == config.journalSize_ && + this->pageSize_ == config.pageSize_ && this->readConSize_ == config.readConSize_ && + this->customDir_ == config.customDir_ && this->allowRebuilt_ == config.allowRebuilt_ && + this->pluginLibs_ == config.pluginLibs_; } bool IsSearchable() const; @@ -210,20 +215,18 @@ public: bool GetAllowRebuild() const; void SetDBType(int32_t dbType); int32_t GetDBType() const; - void SetIntegrityCheck(IntegrityCheck checkType); + void SetIntegrityCheck(IntegrityCheck checkMode); IntegrityCheck GetIntegrityCheck() const; void SetPluginLibs(const std::vector &pluginLibs); std::vector GetPluginLibs() const; void SetIter(int32_t iter) const; int32_t GetIter() const; - int SetDistributedType(DistributedType type); - DistributedType GetDistributedType() const; private: void ClearEncryptKey(); int32_t GenerateEncryptedKey() const; - bool readOnly = false; + bool readOnly_ = false; bool isEncrypt_ = false; bool isCreateNecessary_; bool isSearchable_ = false; @@ -238,21 +241,21 @@ private: int32_t writeTimeout_ = 2; // seconds int32_t readTimeout_ = 1; // seconds int32_t dbType_ = DB_SQLITE; - SecurityLevel securityLevel = SecurityLevel::LAST; + SecurityLevel securityLevel_ = SecurityLevel::LAST; RoleType role_ = OWNER; - StorageMode storageMode; - IntegrityCheck checkType_ = IntegrityCheck::NONE; DistributedType distributedType_ = DistributedType::RDB_DEVICE_COLLABORATION; - std::string name; - std::string path; - std::string journalMode; - std::string syncMode; + StorageMode storageMode_; + IntegrityCheck checkType_ = IntegrityCheck::NONE; + std::string name_; + std::string path_; + std::string journalMode_; + std::string syncMode_; std::string databaseFileType; // distributed rdb std::string bundleName_; std::string moduleName_; std::string visitorDir_; - std::string encryptAlgo; + std::string encryptAlgo_; std::string dataGroupId_; std::string customDir_; mutable std::vector encryptKey_{}; @@ -265,5 +268,4 @@ private: bool allowRebuilt_ = false; }; } // namespace OHOS::NativeRdb - #endif \ No newline at end of file