1# Copyright (c) 2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13import("//build/test.gni") 14import("//foundation/distributeddatamgr/data_share/datashare.gni") 15import("//foundation/distributeddatamgr/kv_store/kv_store.gni") 16 17module_output_path = "kv_store/distributeddatafwk" 18 19############################################################################### 20config("module_private_config") { 21 visibility = [ ":*" ] 22 23 include_dirs = [ 24 "${kv_store_base_path}/frameworks/innerkitsimpl/distributeddatasvc/include", 25 "../../../../interfaces/innerkits/distributeddatamgr/include/", 26 "//commonlibrary/c_utils/base/include", 27 "${datashare_innerapi_path}/common/include", 28 "${datashare_innerapi_path}/provider/include", 29 "//foundation/distributeddatamgr/kv_store/frameworks/common", 30 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/kvdb/include", 31 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/kvdb/src", 32 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/include", 33 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/src", 34 "//foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/distributeddatafwk/test/distributedtest/single_kvstore_client", 35 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/app_distributeddata/include", 36 "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata/include", 37 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/app/include", 38 "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/mod_securitylabel", 39 "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include", 40 "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include", 41 "//test/testfwk/developer_test/aw/distributed", 42 ] 43 lib_dirs = [ "//foundation/appexecfwk/libs" ] 44} 45 46############################################################################### 47ohos_source_set("kvdb_src_file") { 48 testonly = true 49 50 old_sources = [ 51 "../../distributeddatafwk/src/blob.cpp", 52 "../../distributeddatafwk/src/change_notification.cpp", 53 "../../distributeddatafwk/src/data_query.cpp", 54 "../../distributeddatafwk/src/distributed_kv_data_manager.cpp", 55 "../../distributeddatafwk/src/ikvstore_client_death_observer.cpp", 56 "../../distributeddatafwk/src/ikvstore_observer.cpp", 57 "../../distributeddatafwk/src/ikvstore_sync_callback.cpp", 58 "../../distributeddatafwk/src/kv_utils.cpp", 59 "../../distributeddatafwk/src/kvstore_client_death_observer.cpp", 60 "../../distributeddatafwk/src/kvstore_datashare_bridge.cpp", 61 "../../distributeddatafwk/src/kvstore_observer_client.cpp", 62 "../../distributeddatafwk/src/kvstore_service_death_notifier.cpp", 63 "../../distributeddatafwk/src/kvstore_sync_callback_client.cpp", 64 "../../distributeddatafwk/src/sync_observer.cpp", 65 ] 66 67 kvdb_sources = [ 68 "../src/auto_sync_timer.cpp", 69 "../src/backup_manager.cpp", 70 "../src/convertor.cpp", 71 "../src/dev_manager.cpp", 72 "../src/device_convertor.cpp", 73 "../src/kv_types_util.cpp", 74 "../src/kvdb_service_client.cpp", 75 "../src/observer_bridge.cpp", 76 "../src/security_manager.cpp", 77 "../src/single_store_impl.cpp", 78 "../src/store_factory.cpp", 79 "../src/store_manager.cpp", 80 "../src/store_result_set.cpp", 81 "../src/store_util.cpp", 82 "../src/system_api.cpp", 83 "../src/task_executor.cpp", 84 "../src/task_executor_adapter.cpp", 85 ] 86 87 sources = old_sources + kvdb_sources 88 configs = [ ":module_private_config" ] 89 90 deps = [ 91 "../../../../interfaces/innerkits/distributeddatamgr:distributeddata_mgr", 92 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb", 93 "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp:devicemanagersdk", 94 ] 95 external_deps = [ 96 "c_utils:utils", 97 "hilog:libhilog", 98 "hisysevent:libhisysevent", 99 "hitrace:hitrace_meter", 100 "hitrace:libhitracechain", 101 "huks:libhukssdk", 102 "ipc:ipc_single", 103 "samgr:samgr_proxy", 104 ] 105 106 part_name = "kv_store" 107} 108 109ohos_unittest("SingleStoreImplTest") { 110 module_out_path = module_output_path 111 112 sources = [ "single_store_impl_test.cpp" ] 113 114 configs = [ ":module_private_config" ] 115 116 external_deps = [ 117 "c_utils:utils", 118 "hilog:libhilog", 119 "ipc:ipc_single", 120 "safwk:system_ability_fwk", 121 "samgr:samgr_proxy", 122 ] 123 124 deps = [ 125 ":kvdb_src_file", 126 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 127 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 128 "//third_party/googletest:gtest", 129 ] 130} 131 132ohos_unittest("StoreUtilTest") { 133 module_out_path = module_output_path 134 135 sources = [ "store_util_test.cpp" ] 136 137 configs = [ ":module_private_config" ] 138 139 external_deps = [ 140 "c_utils:utils", 141 "ipc:ipc_single", 142 "safwk:system_ability_fwk", 143 "samgr:samgr_proxy", 144 ] 145 146 deps = [ 147 ":kvdb_src_file", 148 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 149 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 150 "//third_party/googletest:gtest", 151 ] 152} 153 154ohos_unittest("BackupManagerTest") { 155 module_out_path = module_output_path 156 157 sources = [ "backup_manager_test.cpp" ] 158 159 configs = [ ":module_private_config" ] 160 161 external_deps = [ 162 "c_utils:utils", 163 "ipc:ipc_single", 164 "safwk:system_ability_fwk", 165 "samgr:samgr_proxy", 166 ] 167 168 deps = [ 169 ":kvdb_src_file", 170 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 171 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 172 "//third_party/googletest:gtest", 173 ] 174} 175 176ohos_unittest("AutoSyncTimerTest") { 177 module_out_path = module_output_path 178 179 sources = [ "auto_sync_timer_test.cpp" ] 180 181 configs = [ ":module_private_config" ] 182 183 external_deps = [ 184 "c_utils:utils", 185 "hilog:libhilog", 186 "ipc:ipc_single", 187 "safwk:system_ability_fwk", 188 "samgr:samgr_proxy", 189 ] 190 191 deps = [ 192 ":kvdb_src_file", 193 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 194 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 195 "//third_party/googletest:gtest", 196 ] 197} 198 199ohos_unittest("DevManagerTest") { 200 module_out_path = module_output_path 201 202 sources = [ "dev_manager_test.cpp" ] 203 204 configs = [ ":module_private_config" ] 205 206 external_deps = [ 207 "c_utils:utils", 208 "hilog:libhilog", 209 "ipc:ipc_single", 210 "safwk:system_ability_fwk", 211 "samgr:samgr_proxy", 212 ] 213 214 deps = [ 215 ":kvdb_src_file", 216 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 217 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 218 "//third_party/googletest:gtest", 219 ] 220} 221 222ohos_unittest("SingleStoreImplGetTopTest") { 223 module_out_path = module_output_path 224 225 sources = [ "single_store_impl_get_top_test.cpp" ] 226 227 configs = [ ":module_private_config" ] 228 229 external_deps = [ 230 "c_utils:utils", 231 "hilog:libhilog", 232 "ipc:ipc_single", 233 "safwk:system_ability_fwk", 234 "samgr:samgr_proxy", 235 ] 236 237 deps = [ 238 ":kvdb_src_file", 239 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 240 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 241 "//third_party/googletest:gtest", 242 ] 243} 244 245ohos_unittest("StoreFactoryTest") { 246 module_out_path = module_output_path 247 248 sources = [ "store_factory_test.cpp" ] 249 250 configs = [ ":module_private_config" ] 251 252 external_deps = [ 253 "c_utils:utils", 254 "hilog:libhilog", 255 "ipc:ipc_single", 256 "safwk:system_ability_fwk", 257 "samgr:samgr_proxy", 258 ] 259 260 deps = [ 261 ":kvdb_src_file", 262 "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter", 263 "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb", 264 "//third_party/googletest:gtest", 265 ] 266} 267 268############################################################################### 269group("unittest") { 270 testonly = true 271 272 deps = [] 273 deps += [ 274 ":AutoSyncTimerTest", 275 ":BackupManagerTest", 276 ":DevManagerTest", 277 ":SingleStoreImplGetTopTest", 278 ":SingleStoreImplTest", 279 ":StoreFactoryTest", 280 ":StoreUtilTest", 281 ] 282} 283############################################################################### 284