diff --git a/datamgr_service/services/distributeddataservice/framework/include/store/auto_cache.h b/datamgr_service/services/distributeddataservice/framework/include/store/auto_cache.h index e4940b91999f5be44fac8027941eb77cde54717f..7bb8b4493093223a442059240760d66ef78d3e4c 100644 --- a/datamgr_service/services/distributeddataservice/framework/include/store/auto_cache.h +++ b/datamgr_service/services/distributeddataservice/framework/include/store/auto_cache.h @@ -58,6 +58,7 @@ private: AutoCache(); ~AutoCache(); void GarbageCollect(bool isForce); + void StartTimer(); struct Delegate : public GeneralWatcher { Delegate(GeneralStore *delegate, const Watchers &watchers, int32_t user); ~Delegate(); diff --git a/datamgr_service/services/distributeddataservice/framework/store/auto_cache.cpp b/datamgr_service/services/distributeddataservice/framework/store/auto_cache.cpp index 3dfd2abd13e0f5cc85a30f552bac13231b6c44a2..d31588a369362cd442923d6b647279128b5089ad 100644 --- a/datamgr_service/services/distributeddataservice/framework/store/auto_cache.cpp +++ b/datamgr_service/services/distributeddataservice/framework/store/auto_cache.cpp @@ -13,8 +13,9 @@ * limitations under the License. */ #define LOG_TAG "AutoCache" -#include "store/auto_cache.h" +#include #include "utils/anonymous.h" +#include "store/auto_cache.h" #include "log_print.h" namespace OHOS::DistributedData { @@ -77,46 +78,55 @@ AutoCache::Store AutoCache::GetStore(const StoreMetaData &meta, const Watchers & auto result = stores.emplace(std::piecewise_construct, std::forward_as_tuple(meta.storeId), std::forward_as_tuple(dbStore, watchers, atoi(meta.user.c_str()))); store = result.first->second; - if (executor_ != nullptr && taskId_ == Executor::INVALID_TASK_ID) { - taskId_ = executor_->Schedule(std::bind(&AutoCache::GarbageCollect, this, false), - std::chrono::minutes(INTERVAL), std::chrono::minutes(INTERVAL)); - } + StartTimer(); return !stores.empty(); }); return store; } +// Should be used within stores_'s thread safe methods +void AutoCache::StartTimer() +{ + if (executor_ == nullptr || taskId_ != Executor::INVALID_TASK_ID) { + return; + } + taskId_ = executor_->Schedule( + [this]() { + GarbageCollect(false); + stores_.DoActionIfEmpty([this]() { + if (executor_ == nullptr || taskId_ == Executor::INVALID_TASK_ID) { + return; + } + auto taskId = taskId_; + taskId_ = Executor::INVALID_TASK_ID; + executor_->Remove(taskId); + ZLOGD("remove timer,taskId: %{public}" PRIu64, taskId); + }); + }, + std::chrono::minutes(INTERVAL), std::chrono::minutes(INTERVAL)); + ZLOGD("start timer,taskId: %{public}" PRIu64, taskId_); +} + void AutoCache::CloseStore(uint32_t tokenId, const std::string &storeId) { - stores_.ComputeIfPresent(tokenId, [this, &storeId](auto &key, std::map &delegates) { + stores_.ComputeIfPresent(tokenId, [&storeId](auto &key, std::map &delegates) { auto it = delegates.find(storeId); if (it != delegates.end()) { it->second.Close(); delegates.erase(it); } - - if (executor_ != nullptr && taskId_ != Executor::INVALID_TASK_ID && stores_.Size() == 1 && delegates.empty()) { - executor_->Remove(taskId_, true); - taskId_ = Executor::INVALID_TASK_ID; - } return !delegates.empty(); }); } void AutoCache::CloseStore(uint32_t tokenId) { - stores_.ComputeIfPresent(tokenId, [this](const auto &id, std::map &delegates) { - if (executor_ != nullptr && taskId_ != Executor::INVALID_TASK_ID && stores_.Size() == 1) { - executor_->Remove(taskId_, true); - taskId_ = Executor::INVALID_TASK_ID; - } - return true; - }); + stores_.Erase(tokenId); } void AutoCache::CloseExcept(const std::set &users) { - stores_.EraseIf([this, &users](const auto &tokenId, std::map &delegates) { + stores_.EraseIf([&users](const auto &tokenId, std::map &delegates) { if (delegates.empty() || users.count(delegates.begin()->second.GetUser()) != 0) { return delegates.empty(); } @@ -129,10 +139,6 @@ void AutoCache::CloseExcept(const std::set &users) it = delegates.erase(it); } } - if (executor_ != nullptr && taskId_ != Executor::INVALID_TASK_ID && stores_.Size() == 1 && delegates.empty()) { - executor_->Remove(taskId_, true); - taskId_ = Executor::INVALID_TASK_ID; - } return delegates.empty(); }); } @@ -153,7 +159,7 @@ void AutoCache::SetObserver(uint32_t tokenId, const std::string &storeId, const void AutoCache::GarbageCollect(bool isForce) { auto current = std::chrono::steady_clock::now(); - stores_.EraseIf([this, ¤t, isForce](auto &key, std::map &delegates) { + stores_.EraseIf([¤t, isForce](auto &key, std::map &delegates) { for (auto it = delegates.begin(); it != delegates.end();) { // if the store is BUSY we wait more INTERVAL minutes again if ((isForce || it->second < current) && it->second.Close()) { @@ -162,10 +168,6 @@ void AutoCache::GarbageCollect(bool isForce) ++it; } } - if (executor_ != nullptr && taskId_ != Executor::INVALID_TASK_ID && stores_.Size() == 1 && delegates.empty()) { - executor_->Remove(taskId_, true); - taskId_ = Executor::INVALID_TASK_ID; - } return delegates.empty(); }); } diff --git a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp index 972cc2124c123aff922512f2d4888160094bc501..596bd7dbfa63d7354dc51edbaa9c883be31a5fc9 100644 --- a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp +++ b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.cpp @@ -63,9 +63,8 @@ CloudServiceImpl::CloudServiceImpl() int32_t CloudServiceImpl::EnableCloud(const std::string &id, const std::map &switches) { - auto tokenId = IPCSkeleton::GetCallingTokenID(); - auto user = DistributedKv::AccountDelegate::GetInstance()->GetUserByToken(tokenId); - auto [status, cloudInfo] = GetCloudInfo(user); + CloudInfo cloudInfo; + auto status = GetCloudInfo(IPCSkeleton::GetCallingTokenID(), id, cloudInfo); if (status != SUCCESS) { return status; } @@ -79,7 +78,7 @@ int32_t CloudServiceImpl::EnableCloud(const std::string &id, const std::map CloudServiceImpl::GetCloudInfo(int32_t userId) +CloudInfo CloudServiceImpl::GetCloudInfo(int32_t userId) { CloudInfo cloudInfo; cloudInfo.user = userId; if (MetaDataManager::GetInstance().LoadMeta(cloudInfo.GetKey(), cloudInfo, true)) { - return { SUCCESS, cloudInfo }; + return cloudInfo; } auto instance = CloudServer::GetInstance(); if (instance == nullptr) { - return { SERVER_UNAVAILABLE, cloudInfo }; + return cloudInfo; } cloudInfo = instance->GetServerInfo(userId); if (!cloudInfo.IsValid()) { ZLOGE("no cloud info %{public}d", userId); - return { ERROR, cloudInfo }; + return cloudInfo; } MetaDataManager::GetInstance().SaveMeta(cloudInfo.GetKey(), cloudInfo, true); - return { SUCCESS, cloudInfo }; + return cloudInfo; } -int32_t CloudServiceImpl::OnAppUninstall( - const std::string &bundleName, int32_t user, int32_t index) +int32_t CloudServiceImpl::OnAppUninstall(const std::string &bundleName, int32_t user, int32_t index) { MetaDataManager::GetInstance().DelMeta(Subscription::GetRelationKey(user, bundleName), true); MetaDataManager::GetInstance().DelMeta(CloudInfo::GetSchemaKey(user, bundleName, index), true); @@ -501,11 +499,6 @@ bool CloudServiceImpl::DoSubscribe(int32_t user) ZLOGW("error, there is no cloud info for user(%{public}d)", sub.userId); return false; } - if (!sub.id.empty() && sub.id != cloudInfo.id) { - CleanSubscription(sub); - sub.id.clear(); - sub.expiresTime.clear(); - } ZLOGD("begin cloud:%{public}d user:%{public}d apps:%{public}zu", cloudInfo.enableCloud, sub.userId, cloudInfo.apps.size()); @@ -542,25 +535,6 @@ bool CloudServiceImpl::DoSubscribe(int32_t user) return subDbs.empty() && unsubDbs.empty(); } -void CloudServiceImpl::CleanSubscription(Subscription &sub) -{ - ZLOGD("id:%{public}s, size:%{public}zu", Anonymous::Change(sub.id).c_str(), sub.expiresTime.size()); - MetaDataManager::GetInstance().DelMeta(sub.GetKey(), true); - for (const auto &[bundle, expireTime] : sub.expiresTime) { - MetaDataManager::GetInstance().DelMeta(sub.GetRelationKey(bundle), true); - } -} - -bool CloudServiceImpl::CleanServer(int32_t user) -{ - auto instance = CloudServer::GetInstance(); - if (instance == nullptr) { - return true; - } - instance->Clean(user); - return true; -} - void CloudServiceImpl::Execute(Task task) { auto executor = executor_; diff --git a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.h b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.h index 866e48357f41fb2c1df318dbb314984be7151cc2..85096676eff7352c2ef236db4cc61ecd709d7e24 100644 --- a/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.h +++ b/datamgr_service/services/distributeddataservice/service/cloud/cloud_service_impl.h @@ -69,7 +69,7 @@ private: bool UpdateCloudInfo(int32_t user); bool UpdateSchema(int32_t user); SchemaMeta GetSchemaMeta(int32_t userId, const std::string &bundleName, int32_t instanceId); - std::pair GetCloudInfo(int32_t userId); + CloudInfo GetCloudInfo(int32_t userId); int32_t GetCloudInfo(uint32_t tokenId, const std::string &id, CloudInfo &cloudInfo); int32_t GetCloudInfoFromMeta(CloudInfo &cloudInfo); int32_t GetCloudInfoFromServer(CloudInfo &cloudInfo); @@ -77,9 +77,7 @@ private: void GetSchema(const Event &event); Task GenTask(int32_t retry, int32_t user, Handles handles = { WORK_SUB }); void Execute(Task task); - void CleanSubscription(Subscription &sub); bool DoSubscribe(int32_t user); - bool CleanServer(int32_t user); int32_t DoClean(CloudInfo &cloudInfo, const std::map &actions); std::shared_ptr executor_; SyncManager syncManager_; @@ -87,7 +85,6 @@ private: static constexpr Handle WORK_CLOUD_INFO_UPDATE = &CloudServiceImpl::UpdateCloudInfo; static constexpr Handle WORK_SCHEMA_UPDATE = &CloudServiceImpl::UpdateSchema; static constexpr Handle WORK_SUB = &CloudServiceImpl::DoSubscribe; - static constexpr Handle WORK_CLEAN = &CloudServiceImpl::CleanServer; }; } // namespace OHOS::DistributedData diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_cloud_data_translate.cpp b/datamgr_service/services/distributeddataservice/service/rdb/rdb_cloud_data_translate.cpp index 15b2868ce1d21caf210b994d623286a9c5c22adc..163734b4909cd0e0f61f9e7fe4f67df08b88cd65 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_cloud_data_translate.cpp +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_cloud_data_translate.cpp @@ -26,9 +26,7 @@ using DataAssets = NativeRdb::ValueObject::Assets; std::vector RdbCloudDataTranslate::AssetToBlob(const Asset &asset) { std::vector rawData; - Asset dbAsset = asset; - dbAsset.flag = static_cast(DistributedDB::AssetOpType::NO_CHANGE); - DataAsset dataAsset = ValueProxy::Asset(std::move(dbAsset)); + DataAsset dataAsset = ValueProxy::Asset(asset); InnerAsset innerAsset(dataAsset); auto data = Serializable::Marshall(innerAsset); auto size = DistributedData::HostToNet((uint16_t)data.length()); diff --git a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp index 9a2ec41bed1809824682517afdf2ca1a95a80c55..67c02160d51ebd025aeddae74f02e89257f15e7e 100644 --- a/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp +++ b/datamgr_service/services/distributeddataservice/service/rdb/rdb_service_impl.cpp @@ -152,7 +152,15 @@ int32_t RdbServiceImpl::OnAppExit(pid_t uid, pid_t pid, uint32_t tokenId, const void RdbServiceImpl::OnClientDied(pid_t pid) { ZLOGI("client dead pid=%{public}d", pid); - syncAgents_.EraseIf([pid](auto &key, SyncAgent &agent) { return agent.pid_ == pid; }); + syncAgents_.EraseIf([pid](auto &key, SyncAgent &agent) { + if (agent.pid_ != pid) { + return false; + } + if (agent.watcher_ != nullptr) { + agent.watcher_->SetNotifier(nullptr); + } + return true; + }); } bool RdbServiceImpl::CheckAccess(const std::string& bundleName, const std::string& storeName) @@ -353,7 +361,7 @@ void RdbServiceImpl::DoCloudSync(const RdbSyncerParam ¶m, const RdbService:: storeInfo.bundleName = param.bundleName_; storeInfo.tokenId = IPCSkeleton::GetCallingTokenID(); storeInfo.user = AccountDelegate::GetInstance()->GetUserByToken(storeInfo.tokenId); - storeInfo.storeName = param.storeName_; + storeInfo.storeName = RemoveSuffix(param.storeName_); std::shared_ptr query = nullptr; if (!predicates.tables_.empty()) { query = std::make_shared(); @@ -437,7 +445,7 @@ int32_t RdbServiceImpl::OnInitialize() int32_t RdbServiceImpl::Delete(const RdbSyncerParam ¶m) { auto tokenId = IPCSkeleton::GetCallingTokenID(); - AutoCache::GetInstance().CloseStore(tokenId, param.storeName_); + AutoCache::GetInstance().CloseStore(tokenId, RemoveSuffix(param.storeName_)); RdbSyncerParam tmpParam = param; HapTokenInfo hapTokenInfo; AccessTokenKit::GetHapTokenInfo(tokenId, hapTokenInfo); diff --git a/kv_store/frameworks/CMakeLists.txt b/kv_store/frameworks/CMakeLists.txt index c0231d1955885054dd5521f93aa802700f773c75..4f07341f122a5b1b1e167c12ec9c83f55371ac82 100644 --- a/kv_store/frameworks/CMakeLists.txt +++ b/kv_store/frameworks/CMakeLists.txt @@ -28,8 +28,8 @@ target_link_libraries(kvdb ${links}) target_include_directories(kvdb PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../interfaces/innerkits/distributeddata/include) target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/common) target_include_directories(kvdb PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/innerkitsimpl/distributeddatafwk/include) -target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/innerkitsimpl/distributeddatafwk/src) target_include_directories(kvdb PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/innerkitsimpl/kvdb/include) +target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/innerkitsimpl/distributeddatafwk/src) target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../data_share/interfaces/inner_api/common/include/basic) target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../data_share/interfaces/inner_api/common/include) @@ -37,6 +37,11 @@ target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../data_s target_include_directories(kvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../data_share/interfaces/inner_api/provider/include) target_link_libraries(jskvdb ${links} kvdb) -target_link_libraries(jsolddb ${links} kvdb) target_include_directories(jskvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/jskitsimpl/distributedkvstore/include) -target_include_directories(jsolddb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/jskitsimpl/distributeddata/include) \ No newline at end of file +target_include_directories(jskvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/common) +target_include_directories(jskvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../data_share/interfaces/inner_api/provider/include) +target_include_directories(jskvdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../data_share/interfaces/inner_api/common/include) + +target_link_libraries(jsolddb ${links} kvdb) +target_include_directories(jsolddb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/jskitsimpl/distributeddata/include) +target_include_directories(jsolddb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/common) diff --git a/kv_store/frameworks/common/concurrent_map.h b/kv_store/frameworks/common/concurrent_map.h index cc603d37c05493979c25564081b41406eab52bc3..a1cb7286e4d9005c6bb3b59a3f7f58625b89b76a 100644 --- a/kv_store/frameworks/common/concurrent_map.h +++ b/kv_store/frameworks/common/concurrent_map.h @@ -265,6 +265,18 @@ public: return true; } + void DoActionIfEmpty(const std::function &action) + { + if (action == nullptr) { + return; + } + std::lock_guard lock(mutex_); + if (entries_.empty()) { + action(); + } + return; + } + private: std::map<_Key, _Tp> Steal() noexcept { diff --git a/kv_store/frameworks/common/test/concurrent_map_test.cpp b/kv_store/frameworks/common/test/concurrent_map_test.cpp index 0ef31a6870c7600cc4a243710415e6cbe4fa85f0..deda4156b0f6ac4bbf64a87bc5297712921d8074 100644 --- a/kv_store/frameworks/common/test/concurrent_map_test.cpp +++ b/kv_store/frameworks/common/test/concurrent_map_test.cpp @@ -58,7 +58,6 @@ HWTEST_F(ConcurrentMapTest, EmplaceWithNone, TestSize.Level0) auto it = values_.Find(""); ASSERT_TRUE(it.first); } - /** * @tc.name: EmplaceWithFilter * @tc.desc: test the function: diff --git a/kv_store/frameworks/common/test/executor_pool_test.cpp b/kv_store/frameworks/common/test/executor_pool_test.cpp index 900b63acb44f197c98d80c4d0f0758e8454f65d1..37c680a520a6d22dc140ff8bf293c80c4845d044 100644 --- a/kv_store/frameworks/common/test/executor_pool_test.cpp +++ b/kv_store/frameworks/common/test/executor_pool_test.cpp @@ -187,4 +187,25 @@ HWTEST_F(ExecutorPoolTest, MaxEqualsOne, TestSize.Level0) std::this_thread::sleep_for(std::chrono::milliseconds(SHORT_INTERVAL * 2)); ASSERT_EQ(testNum, 4); } + + +/** +* @tc.name: EmplaceWithNone +* @tc.desc: test the bool Emplace() noexcept function. +* @tc.type: FUNC +* @tc.require: +* @tc.author: Sven Wang +*/ +HWTEST_F(ExecutorPoolTest, RemoveWhenExcute, TestSize.Level0) +{ + auto executors = std::make_shared(2, 1); + auto taskId = ExecutorPool::INVALID_TASK_ID; + taskId = executors->Schedule(std::chrono::seconds(0), [executors, &taskId]() { + std::this_thread::sleep_for(std::chrono::milliseconds(SHORT_INTERVAL)); + executors->Remove(taskId, false); + taskId = ExecutorPool::INVALID_TASK_ID; + }); + std::this_thread::sleep_for(std::chrono::seconds(LONG_INTERVAL)); + ASSERT_EQ(taskId, ExecutorPool::INVALID_TASK_ID); +} } // namespace OHOS::Test diff --git a/kv_store/frameworks/common/test/task_scheduler_test.cpp b/kv_store/frameworks/common/test/task_scheduler_test.cpp index e4a1c667e53eabbcbebd8a87f8a0f6091a74b0d0..e60096948bccdaf19d6f90b89e52684b2010fb51 100644 --- a/kv_store/frameworks/common/test/task_scheduler_test.cpp +++ b/kv_store/frameworks/common/test/task_scheduler_test.cpp @@ -258,4 +258,5 @@ HWTEST_F(TaskSchedulerTest, RemoveNoWaitExecute, TestSize.Level0) blockDataWait->SetValue(testData); ASSERT_EQ(blockDataTest->GetValue(), testData + 1); } + } // namespace OHOS::Test \ No newline at end of file diff --git a/relational_store/frameworks/native/rdb/include/rdb_store_manager.h b/relational_store/frameworks/native/rdb/include/rdb_store_manager.h index e6cbab51923a1e5d730b9ab52ca7c553f9c1d02a..7f5627d582bb40a5e6db6586407af228c383a1e0 100644 --- a/relational_store/frameworks/native/rdb/include/rdb_store_manager.h +++ b/relational_store/frameworks/native/rdb/include/rdb_store_manager.h @@ -41,6 +41,7 @@ public: private: int ProcessOpenCallback(RdbStore &rdbStore, const RdbStoreConfig &config, int version, RdbOpenCallback &openCallback); + std::string bundleName_; std::mutex mutex_; std::map> storeCache_; }; diff --git a/relational_store/frameworks/native/rdb/src/rdb_store_manager.cpp b/relational_store/frameworks/native/rdb/src/rdb_store_manager.cpp index 1cf2d6b135683099f60969e849f22fcac13f964e..7abe3a5a15a8c96ba2f16f40f009391984c4612b 100644 --- a/relational_store/frameworks/native/rdb/src/rdb_store_manager.cpp +++ b/relational_store/frameworks/native/rdb/src/rdb_store_manager.cpp @@ -58,6 +58,7 @@ std::shared_ptr RdbStoreManager::GetRdbStore(const RdbStoreConfig &con { std::string path = config.GetPath(); std::lock_guard lock(mutex_); // TOD this lock should only work on storeCache_, add one more lock for connectionpool + bundleName_ = config.GetBundleName(); if (storeCache_.find(path) != storeCache_.end()) { std::shared_ptr rdbStore = storeCache_[path].lock(); if (rdbStore != nullptr && rdbStore->GetConfig() == config) { @@ -166,6 +167,7 @@ bool RdbStoreManager::Delete(const std::string &path) if (!tokens.empty()) { DistributedRdb::RdbSyncerParam param; param.storeName_ = *tokens.rbegin(); + param.bundleName_ = bundleName_; auto [err, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(param); if (err == E_OK && service != nullptr) { err = service->Delete(param); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ebc80fba26981a29386ee0fcdbae9688dfc90d59..9b79c18fab553b48cccf5d1bf796233d2d05845c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -52,7 +52,8 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/dis aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/test/mock DataMgrTestSrc) list(REMOVE_ITEM DataMgrTestSrc "${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/test/mock/adapter_mock.cpp") aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/test DataMgrTestSrc) -aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/test/data_share DataMgrTestSrc) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/framework/test DataMgrTestSrc) +aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/adapter/test DataMgrTestSrc) add_executable(DataMgrServiceTest ${DataMgrTestSrc} ${mainSrc} ${serviceSrc}) target_link_libraries(DataMgrServiceTest ${links} gtest_main gcov relational_store data_share preferences distributeddb data_object kvdb udmf) target_include_directories(DataMgrServiceTest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../datamgr_service/services/distributeddataservice/service/backup/include)