• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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")
15
16module_output_path = "kv_store/distributeddatafwk"
17
18###############################################################################
19config("module_private_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "../include/",
24    "../src/",
25    "../../distributeddatafwk/include/",
26    "../../distributeddatafwk/src/",
27    "../../object/include",
28    "../../rdb/include",
29    "../../rdb/src",
30    "../../../common/",
31    "../../../../interfaces/innerkits/distributeddata/include/",
32    "${datashare_innerapi_path}/common/include",
33    "${datashare_innerapi_path}/provider/include",
34
35    # TEMP MODIFICATION FOR PMS
36    "../../../../services/distributeddataservice/app/include",
37
38    # for ipc_core interfaces.
39    "//commonlibrary/c_utils/base/include",
40
41
42    "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/mod_securitylabel",
43    "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include",
44    "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include",
45
46
47  ]
48
49  lib_dirs = [ "//foundation/appexecfwk/libs" ]
50}
51
52###############################################################################
53ohos_source_set("kvdb_src_file") {
54  testonly = true
55
56  old_sources = [
57    "../../distributeddatafwk/src/blob.cpp",
58    "../../distributeddatafwk/src/change_notification.cpp",
59    "../../distributeddatafwk/src/data_query.cpp",
60    "../../distributeddatafwk/src/device_status_change_listener_client.cpp",
61    "../../distributeddatafwk/src/distributed_kv_data_manager.cpp",
62    "../../distributeddatafwk/src/ikvstore_client_death_observer.cpp",
63    "../../distributeddatafwk/src/ikvstore_data_service.cpp",
64    "../../distributeddatafwk/src/ikvstore_observer.cpp",
65    "../../distributeddatafwk/src/ikvstore_sync_callback.cpp",
66    "../../distributeddatafwk/src/itypes_util.cpp",
67    "../../distributeddatafwk/src/kv_utils.cpp",
68    "../../distributeddatafwk/src/kvstore_client_death_observer.cpp",
69    "../../distributeddatafwk/src/kvstore_datashare_bridge.cpp",
70    "../../distributeddatafwk/src/kvstore_observer_client.cpp",
71    "../../distributeddatafwk/src/kvstore_service_death_notifier.cpp",
72    "../../distributeddatafwk/src/kvstore_sync_callback_client.cpp",
73    "../../distributeddatafwk/src/sync_observer.cpp",
74  ]
75
76  rdb_sources = [
77    "../../rdb/src/rdb_manager.cpp",
78    "../../rdb/src/rdb_manager_impl.cpp",
79    "../../rdb/src/rdb_notifier.cpp",
80    "../../rdb/src/rdb_service_proxy.cpp",
81  ]
82
83  kvdb_sources = [
84    "../src/auto_sync_timer.cpp",
85    "../src/backup_manager.cpp",
86    "../src/convertor.cpp",
87    "../src/dev_manager.cpp",
88    "../src/device_convertor.cpp",
89    "../src/kvdb_service_client.cpp",
90    "../src/observer_bridge.cpp",
91    "../src/security_manager.cpp",
92    "../src/single_store_impl.cpp",
93    "../src/store_factory.cpp",
94    "../src/store_manager.cpp",
95    "../src/store_result_set.cpp",
96    "../src/store_util.cpp",
97    "../src/system_api.cpp",
98    "../src/task_executor.cpp",
99  ]
100
101  sources = old_sources + rdb_sources + kvdb_sources
102  configs = [ ":module_private_config" ]
103
104  deps = [
105    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb",
106    "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp:devicemanagersdk",
107  ]
108  external_deps = [
109    "c_utils:utils",
110    "hisysevent_native:libhisysevent",
111    "hitrace_native:hitrace_meter",
112    "hitrace_native:libhitracechain",
113    "hiviewdfx_hilog_native:libhilog",
114    "huks:libhukssdk",
115    "ipc:ipc_core",
116    "samgr:samgr_proxy",
117  ]
118
119  part_name = "kv_store"
120}
121
122ohos_unittest("SingleStoreImplTest") {
123  module_out_path = module_output_path
124
125  sources = [ "single_store_impl_test.cpp" ]
126
127  configs = [ ":module_private_config" ]
128
129  external_deps = [
130    "c_utils:utils",
131    "hilog_native:libhilog",
132    "ipc:ipc_core",
133    "safwk:system_ability_fwk",
134    "samgr:samgr_proxy",
135  ]
136
137  deps = [
138    ":kvdb_src_file",
139    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
140    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb",
141    "//third_party/googletest:gtest",
142  ]
143}
144
145ohos_unittest("StoreUtilTest") {
146  module_out_path = module_output_path
147
148  sources = [ "store_util_test.cpp" ]
149
150  configs = [ ":module_private_config" ]
151
152  external_deps = [
153    "c_utils:utils",
154    "ipc:ipc_core",
155    "safwk:system_ability_fwk",
156    "samgr:samgr_proxy",
157  ]
158
159  deps = [
160    ":kvdb_src_file",
161    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
162    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb",
163    "//third_party/googletest:gtest",
164  ]
165}
166
167ohos_unittest("BackupManagerTest") {
168  module_out_path = module_output_path
169
170  sources = [ "backup_manager_test.cpp" ]
171
172  configs = [ ":module_private_config" ]
173
174  external_deps = [
175    "c_utils:utils",
176    "ipc:ipc_core",
177    "safwk:system_ability_fwk",
178    "samgr:samgr_proxy",
179  ]
180
181  deps = [
182    ":kvdb_src_file",
183    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
184    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb",
185    "//third_party/googletest:gtest",
186  ]
187}
188
189ohos_unittest("AutoSyncTimerTest") {
190  module_out_path = module_output_path
191
192  sources = [ "auto_sync_timer_test.cpp" ]
193
194  configs = [ ":module_private_config" ]
195
196  external_deps = [
197    "c_utils:utils",
198    "hilog_native:libhilog",
199    "ipc:ipc_core",
200    "safwk:system_ability_fwk",
201    "samgr:samgr_proxy",
202  ]
203
204  deps = [
205    ":kvdb_src_file",
206    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
207    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb",
208    "//third_party/googletest:gtest",
209  ]
210}
211
212ohos_unittest("DevManagerTest") {
213  module_out_path = module_output_path
214
215  sources = [ "dev_manager_test.cpp" ]
216
217  configs = [ ":module_private_config" ]
218
219  external_deps = [
220    "c_utils:utils",
221    "hilog_native:libhilog",
222    "ipc:ipc_core",
223    "safwk:system_ability_fwk",
224    "samgr:samgr_proxy",
225  ]
226
227  deps = [
228    ":kvdb_src_file",
229    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
230    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb",
231    "//third_party/googletest:gtest",
232  ]
233}
234
235ohos_unittest("SingleStoreImplGetTopTest") {
236  module_out_path = module_output_path
237
238  sources = [ "single_store_impl_get_top_test.cpp" ]
239
240  configs = [ ":module_private_config" ]
241
242  external_deps = [
243    "c_utils:utils",
244    "hilog_native:libhilog",
245    "ipc:ipc_core",
246    "safwk:system_ability_fwk",
247    "samgr:samgr_proxy",
248  ]
249
250  deps = [
251    ":kvdb_src_file",
252    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
253    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/:distributeddb",
254    "//third_party/googletest:gtest",
255  ]
256}
257
258###############################################################################
259group("unittest") {
260  testonly = true
261
262  deps = []
263  deps += [
264    ":AutoSyncTimerTest",
265    ":BackupManagerTest",
266    ":DevManagerTest",
267    ":SingleStoreImplGetTopTest",
268    ":SingleStoreImplTest",
269    ":StoreUtilTest",
270  ]
271}
272###############################################################################
273