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/ohos_var.gni")
14import("//build/test.gni")
15import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni")
16
17module_output_path = "datamgr_service/distributeddatafwk"
18
19###############################################################################
20config("module_private_config") {
21  visibility = [ ":*" ]
22
23  include_dirs = [
24    "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include",
25    "${data_service_path}/adapter/include",
26    "${data_service_path}/app/src",
27    "${data_service_path}/framework/include",
28    "${data_service_path}/service/bootstrap/include/",
29    "${data_service_path}/service/backup/include/",
30    "${data_service_path}/service/cloud/",
31    "${data_service_path}/service/config/include/",
32    "${data_service_path}/service/common/",
33    "${data_service_path}/service/crypto/include",
34    "${data_service_path}/service/directory/include/",
35    "${data_service_path}/service/data_share/common",
36    "${data_service_path}/service/data_share/data",
37    "${data_service_path}/service/data_share/strategies",
38    "${data_service_path}/service/data_share/subscriber_managers",
39    "${data_service_path}/service/data_share",
40    "${data_service_path}/service/matrix/include/",
41    "${data_service_path}/service/kvdb",
42    "${data_service_path}/service/object/",
43    "${data_service_path}/service/permission/include",
44    "${data_service_path}/service/rdb/",
45    "${data_service_path}/service/test/mock",
46    "${data_service_path}/service/waterversion",
47    "${dataobject_path}/interfaces/innerkits",
48    "${dataobject_path}/frameworks/innerkitsimpl/include",
49    "${kv_store_distributeddb_path}/interfaces/include/",
50    "${kv_store_distributeddb_path}/include/",
51    "${relational_store_path}/interfaces/inner_api/cloud_data/include",
52    "${relational_store_path}/interfaces/inner_api/common_type/include",
53  ]
54
55  defines = [
56    "TEST_ON_DEVICE",
57    "OPENSSL_SUPPRESS_DEPRECATED",
58  ]
59}
60
61ohos_unittest("CloudDataTest") {
62  sanitize = {
63    cfi = true
64    cfi_cross_dso = true
65    debug = false
66  }
67  module_out_path = module_output_path
68  sources = [
69    "${data_service_path}/service/backup/src/backup_manager.cpp",
70    "${data_service_path}/service/bootstrap/src/bootstrap.cpp",
71    "${data_service_path}/service/cloud/cloud_service_impl.cpp",
72    "${data_service_path}/service/cloud/cloud_service_stub.cpp",
73    "${data_service_path}/service/cloud/cloud_types_util.cpp",
74    "${data_service_path}/service/cloud/cloud_value_util.cpp",
75    "${data_service_path}/service/cloud/sync_manager.cpp",
76    "${data_service_path}/service/cloud/sync_strategies/network_sync_strategy.cpp",
77    "${data_service_path}/service/common/common_types_utils.cpp",
78    "${data_service_path}/service/common/value_proxy.cpp",
79    "${data_service_path}/service/common/xcollie.cpp",
80    "${data_service_path}/service/config/src/config_factory.cpp",
81    "${data_service_path}/service/config/src/model/app_id_mapping_config.cpp",
82    "${data_service_path}/service/config/src/model/backup_config.cpp",
83    "${data_service_path}/service/config/src/model/checker_config.cpp",
84    "${data_service_path}/service/config/src/model/cloud_config.cpp",
85    "${data_service_path}/service/config/src/model/component_config.cpp",
86    "${data_service_path}/service/config/src/model/directory_config.cpp",
87    "${data_service_path}/service/config/src/model/global_config.cpp",
88    "${data_service_path}/service/config/src/model/network_config.cpp",
89    "${data_service_path}/service/config/src/model/protocol_config.cpp",
90    "${data_service_path}/service/crypto/src/crypto_manager.cpp",
91    "${data_service_path}/service/matrix/src/device_matrix.cpp",
92    "${data_service_path}/service/matrix/src/matrix_event.cpp",
93    "${data_service_path}/service/rdb/cache_cursor.cpp",
94    "${data_service_path}/service/rdb/rdb_asset_loader.cpp",
95    "${data_service_path}/service/rdb/rdb_cloud.cpp",
96    "${data_service_path}/service/rdb/rdb_cloud_data_translate.cpp",
97    "${data_service_path}/service/rdb/rdb_cursor.cpp",
98    "${data_service_path}/service/rdb/rdb_general_store.cpp",
99    "${data_service_path}/service/rdb/rdb_notifier_proxy.cpp",
100    "${data_service_path}/service/rdb/rdb_query.cpp",
101    "${data_service_path}/service/rdb/rdb_result_set_impl.cpp",
102    "${data_service_path}/service/rdb/rdb_result_set_stub.cpp",
103    "${data_service_path}/service/rdb/rdb_service_impl.cpp",
104    "${data_service_path}/service/rdb/rdb_service_stub.cpp",
105    "${data_service_path}/service/rdb/rdb_watcher.cpp",
106    "${data_service_path}/service/test/mock/checker_mock.cpp",
107    "${data_service_path}/service/waterversion/water_version_manager.cpp",
108    "cloud_data_test.cpp",
109  ]
110
111  configs = [ ":module_private_config" ]
112
113  external_deps = [
114    "ability_base:base",
115    "ability_base:want",
116    "access_token:libaccesstoken_sdk",
117    "access_token:libtoken_setproc",
118    "access_token:libtokenid_sdk",
119    "c_utils:utils",
120    "hicollie:libhicollie",
121    "hilog:libhilog",
122    "huks:libhukssdk",
123    "ipc:ipc_core",
124    "kv_store:distributeddata_inner",
125    "kv_store:distributeddb",
126    "relational_store:native_rdb",
127  ]
128
129  deps = [
130    "../../adapter:distributeddata_adapter",
131    "../../framework:distributeddatasvcfwk",
132    "mock:distributeddata_mock_static",
133    "//third_party/googletest:gtest_main",
134  ]
135
136  cflags = [
137    "-fno-access-control",  # Ignore Private Member Access Control
138  ]
139
140  cflags_cc = cflags
141}
142
143ohos_unittest("CloudServiceImplTest") {
144  sanitize = {
145    cfi = true
146    cfi_cross_dso = true
147    debug = false
148  }
149  module_out_path = module_output_path
150  sources = [
151    "${data_service_path}/service/backup/src/backup_manager.cpp",
152    "${data_service_path}/service/bootstrap/src/bootstrap.cpp",
153    "${data_service_path}/service/cloud/cloud_service_impl.cpp",
154    "${data_service_path}/service/cloud/cloud_service_stub.cpp",
155    "${data_service_path}/service/cloud/cloud_types_util.cpp",
156    "${data_service_path}/service/cloud/cloud_value_util.cpp",
157    "${data_service_path}/service/cloud/sync_manager.cpp",
158    "${data_service_path}/service/cloud/sync_strategies/network_sync_strategy.cpp",
159    "${data_service_path}/service/common/common_types_utils.cpp",
160    "${data_service_path}/service/common/value_proxy.cpp",
161    "${data_service_path}/service/common/xcollie.cpp",
162    "${data_service_path}/service/config/src/config_factory.cpp",
163    "${data_service_path}/service/config/src/model/app_id_mapping_config.cpp",
164    "${data_service_path}/service/config/src/model/backup_config.cpp",
165    "${data_service_path}/service/config/src/model/checker_config.cpp",
166    "${data_service_path}/service/config/src/model/cloud_config.cpp",
167    "${data_service_path}/service/config/src/model/component_config.cpp",
168    "${data_service_path}/service/config/src/model/directory_config.cpp",
169    "${data_service_path}/service/config/src/model/global_config.cpp",
170    "${data_service_path}/service/config/src/model/network_config.cpp",
171    "${data_service_path}/service/config/src/model/protocol_config.cpp",
172    "${data_service_path}/service/crypto/src/crypto_manager.cpp",
173    "${data_service_path}/service/matrix/src/device_matrix.cpp",
174    "${data_service_path}/service/matrix/src/matrix_event.cpp",
175    "${data_service_path}/service/rdb/cache_cursor.cpp",
176    "${data_service_path}/service/rdb/rdb_asset_loader.cpp",
177    "${data_service_path}/service/rdb/rdb_cloud.cpp",
178    "${data_service_path}/service/rdb/rdb_cloud_data_translate.cpp",
179    "${data_service_path}/service/rdb/rdb_cursor.cpp",
180    "${data_service_path}/service/rdb/rdb_general_store.cpp",
181    "${data_service_path}/service/rdb/rdb_notifier_proxy.cpp",
182    "${data_service_path}/service/rdb/rdb_query.cpp",
183    "${data_service_path}/service/rdb/rdb_result_set_impl.cpp",
184    "${data_service_path}/service/rdb/rdb_result_set_stub.cpp",
185    "${data_service_path}/service/rdb/rdb_service_impl.cpp",
186    "${data_service_path}/service/rdb/rdb_service_stub.cpp",
187    "${data_service_path}/service/rdb/rdb_watcher.cpp",
188    "${data_service_path}/service/test/mock/checker_mock.cpp",
189    "${data_service_path}/service/waterversion/water_version_manager.cpp",
190    "cloud_service_impl_test.cpp",
191  ]
192
193  configs = [ ":module_private_config" ]
194
195  external_deps = [
196    "ability_base:base",
197    "ability_base:want",
198    "access_token:libaccesstoken_sdk",
199    "access_token:libtoken_setproc",
200    "access_token:libtokenid_sdk",
201    "c_utils:utils",
202    "hicollie:libhicollie",
203    "hilog:libhilog",
204    "huks:libhukssdk",
205    "ipc:ipc_core",
206    "kv_store:distributeddata_inner",
207    "kv_store:distributeddb",
208    "relational_store:native_rdb",
209  ]
210
211  deps = [
212    "../../adapter:distributeddata_adapter",
213    "../../framework:distributeddatasvcfwk",
214    "mock:distributeddata_mock_static",
215    "//third_party/googletest:gtest_main",
216  ]
217
218  cflags = [
219    "-fno-access-control",  # Ignore Private Member Access Control
220  ]
221
222  cflags_cc = cflags
223}
224
225ohos_unittest("CloudTest") {
226  module_out_path = module_output_path
227  sources = [ "cloud_test.cpp" ]
228
229  configs = [ ":module_private_config" ]
230
231  external_deps = [
232    "ability_base:base",
233    "ability_base:want",
234    "c_utils:utils",
235    "hilog:libhilog",
236    "ipc:ipc_core",
237    "kv_store:distributeddata_inner",
238    "kv_store:distributeddb",
239  ]
240
241  deps = [
242    "../../adapter:distributeddata_adapter",
243    "../../framework:distributeddatasvcfwk",
244    "../../service:distributeddatasvc",
245    "mock:distributeddata_mock_static",
246    "//third_party/googletest:gtest_main",
247  ]
248}
249
250ohos_unittest("ValueProxyServiceTest") {
251  module_out_path = module_output_path
252  sources = [
253    "../common/value_proxy.cpp",
254    "value_proxy_test.cpp",
255  ]
256
257  include_dirs = [
258    "../../../../../relational_store/interfaces/inner_api/rdb/include",
259    "${relational_store_path}/interfaces/inner_api/common_type/include",
260  ]
261
262  configs = [ ":module_private_config" ]
263
264  cflags = [
265    "-Dprivate=public",
266    "-Dprotected=public",
267    "-Wno-multichar",
268    "-Wno-c99-designator",
269  ]
270
271  external_deps = [
272    "ability_base:base",
273    "ability_base:want",
274    "c_utils:utils",
275    "hilog:libhilog",
276    "ipc:ipc_core",
277    "kv_store:distributeddata_inner",
278  ]
279
280  deps = [
281    "${kv_store_distributeddb_path}:distributeddb",
282    "${relational_store_inner_api_path}:native_rdb_static",
283    "../../adapter:distributeddata_adapter",
284    "../../framework:distributeddatasvcfwk",
285    "../../service:distributeddatasvc",
286    "//third_party/googletest:gtest_main",
287  ]
288}
289
290ohos_unittest("ConfigFactoryTest") {
291  module_out_path = module_output_path
292  sources = [ "config_factory_test.cpp" ]
293
294  configs = [ ":module_private_config" ]
295
296  external_deps = [
297    "ability_base:base",
298    "ability_base:want",
299    "c_utils:utils",
300    "hilog:libhilog",
301    "ipc:ipc_core",
302  ]
303
304  deps = [
305    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
306    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
307    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
308    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
309    "//third_party/googletest:gtest_main",
310    "//third_party/openssl:libcrypto_shared",
311  ]
312}
313
314ohos_unittest("DirectoryManagerTest") {
315  module_out_path = module_output_path
316  sources = [ "directory_manager_test.cpp" ]
317
318  configs = [ ":module_private_config" ]
319
320  external_deps = [
321    "ability_base:base",
322    "ability_base:want",
323    "access_token:libaccesstoken_sdk",
324    "access_token:libnativetoken",
325    "c_utils:utils",
326    "hilog:libhilog",
327    "ipc:ipc_core",
328  ]
329
330  deps = [
331    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
332    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
333    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
334    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
335    "//third_party/googletest:gtest_main",
336  ]
337}
338
339ohos_unittest("CryptoManagerTest") {
340  module_out_path = module_output_path
341  sources = [ "crypto_manager_test.cpp" ]
342
343  configs = [ ":module_private_config" ]
344
345  external_deps = [
346    "ability_base:base",
347    "ability_base:want",
348    "access_token:libaccesstoken_sdk",
349    "access_token:libnativetoken",
350    "c_utils:utils",
351    "hilog:libhilog",
352    "ipc:ipc_core",
353  ]
354
355  deps = [
356    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/adapter:distributeddata_adapter",
357    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/framework:distributeddatasvcfwk",
358    "//foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service:distributeddatasvc",
359    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
360    "//third_party/googletest:gtest_main",
361  ]
362}
363
364ohos_unittest("DeviceMatrixTest") {
365  module_out_path = module_output_path
366  sources = [
367    "device_matrix_test.cpp",
368    "mock/checker_mock.cpp",
369    "mock/db_change_data_mock.cpp",
370    "mock/db_store_mock.cpp",
371  ]
372
373  configs = [ ":module_private_config" ]
374
375  external_deps = [
376    "ability_base:base",
377    "ability_base:want",
378    "access_token:libaccesstoken_sdk",
379    "access_token:libnativetoken",
380    "c_utils:utils",
381    "hilog:libhilog",
382    "ipc:ipc_core",
383  ]
384
385  deps = [
386    "${data_service_path}/adapter:distributeddata_adapter",
387    "${data_service_path}/framework:distributeddatasvcfwk",
388    "${data_service_path}/service:distributeddatasvc",
389    "//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:distributeddb",
390    "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
391    "//third_party/googletest:gtest_main",
392  ]
393}
394
395ohos_unittest("KVDBGeneralStoreTest") {
396  module_out_path = module_output_path
397  sources = [
398    "../common/value_proxy.cpp",
399    "../kvdb/kvdb_general_store.cpp",
400    "../rdb/rdb_cloud.cpp",
401    "../rdb/rdb_query.cpp",
402    "../waterversion/water_version_manager.cpp",
403    "kvdb_general_store_test.cpp",
404    "mock/db_change_data_mock.cpp",
405    "mock/db_store_mock.cpp",
406    "mock/general_watcher_mock.cpp",
407    "mock/kv_store_nb_delegate_mock.cpp",
408  ]
409
410  include_dirs = [
411    "${data_service_path}/service/common",
412    "${data_service_path}/service/rdb",
413    "${data_service_path}/service/waterversion",
414    "${relational_store_path}/interfaces/innerapi/clouddata/include",
415    "${relational_store_path}/interfaces/inner_api/rdb/include",
416    "${relational_store_path}/interfaces/inner_api/common_type/include",
417  ]
418
419  configs = [ ":module_private_config" ]
420
421  cflags = [
422    "-Dprivate=public",
423    "-Dprotected=public",
424  ]
425
426  external_deps = [
427    "ability_base:base",
428    "ability_base:want",
429    "access_token:libaccesstoken_sdk",
430    "access_token:libnativetoken",
431    "c_utils:utils",
432    "hilog:libhilog",
433    "ipc:ipc_core",
434    "kv_store:distributeddata_inner",
435  ]
436
437  deps = [
438    "${data_service_path}/adapter:distributeddata_adapter",
439    "${data_service_path}/framework:distributeddatasvcfwk",
440    "${data_service_path}/service:distributeddatasvc",
441    "${kv_store_distributeddb_path}:distributeddb",
442    "//third_party/googletest:gtest_main",
443  ]
444}
445
446ohos_unittest("RdbResultSetImplTest") {
447  module_out_path = module_output_path
448  sources = [
449    "${data_service_path}/service/common/value_proxy.cpp",
450    "${data_service_path}/service/rdb/rdb_result_set_impl.cpp",
451    "${data_service_path}/service/rdb/rdb_result_set_stub.cpp",
452    "mock/cursor_mock.cpp",
453    "rdb_result_set_impl_test.cpp",
454  ]
455
456  include_dirs = [
457    "${data_service_path}/service/rdb",
458    "${relational_store_path}/interfaces/inner_api/cloud_data/include",
459    "${relational_store_path}/interfaces/inner_api/rdb/include",
460    "${relational_store_path}/interfaces/inner_api/common_type/include",
461  ]
462
463  configs = [ ":module_private_config" ]
464
465  cflags = [
466    "-Dprivate=public",
467    "-Dprotected=public",
468    "-Wno-multichar",
469    "-Wno-c99-designator",
470  ]
471
472  external_deps = [
473    "ability_base:base",
474    "ability_base:want",
475    "access_token:libaccesstoken_sdk",
476    "access_token:libnativetoken",
477    "c_utils:utils",
478    "hilog:libhilog",
479    "ipc:ipc_core",
480  ]
481
482  deps = [
483    "${data_service_path}/adapter:distributeddata_adapter",
484    "${data_service_path}/adapter/utils:distributeddata_utils_static",
485    "${data_service_path}/framework:distributeddatasvcfwk",
486    "${kv_store_distributeddb_path}:distributeddb",
487    "${relational_store_inner_api_path}:native_rdb_static",
488    "//third_party/googletest:gtest_main",
489  ]
490}
491
492ohos_unittest("RdbServiceTest") {
493  module_out_path = module_output_path
494  sources = [
495    "${data_service_path}/service/common/value_proxy.cpp",
496    "${data_service_path}/service/rdb/cache_cursor.cpp",
497    "${data_service_path}/service/rdb/rdb_asset_loader.cpp",
498    "${data_service_path}/service/rdb/rdb_cloud.cpp",
499    "${data_service_path}/service/rdb/rdb_cloud_data_translate.cpp",
500    "${data_service_path}/service/rdb/rdb_cursor.cpp",
501    "${data_service_path}/service/rdb/rdb_general_store.cpp",
502    "${data_service_path}/service/rdb/rdb_notifier_proxy.cpp",
503    "${data_service_path}/service/rdb/rdb_query.cpp",
504    "${data_service_path}/service/rdb/rdb_result_set_impl.cpp",
505    "${data_service_path}/service/rdb/rdb_result_set_stub.cpp",
506    "${data_service_path}/service/rdb/rdb_watcher.cpp",
507    "cache_cursor_test.cpp",
508    "mock/general_watcher_mock.cpp",
509    "rdb_asset_loader_test.cpp",
510    "rdb_cloud_test.cpp",
511    "rdb_cursor_test.cpp",
512    "rdb_general_store_test.cpp",
513    "rdb_query_test.cpp",
514    "rdb_result_set_stub_test.cpp",
515  ]
516
517  include_dirs = [
518    "${relational_store_path}/interfaces/inner_api/cloud_data/include",
519    "${relational_store_path}/interfaces/inner_api/rdb/include",
520    "${relational_store_path}/interfaces/inner_api/common_type/include",
521  ]
522
523  configs = [ ":module_private_config" ]
524
525  cflags = [
526    "-Dprivate=public",
527    "-Dprotected=public",
528    "-Wno-multichar",
529    "-Wno-c99-designator",
530  ]
531
532  external_deps = [
533    "ability_base:base",
534    "ability_base:want",
535    "access_token:libaccesstoken_sdk",
536    "access_token:libnativetoken",
537    "c_utils:utils",
538    "hilog:libhilog",
539    "ipc:ipc_core",
540    "kv_store:distributeddata_inner",
541    "kv_store:distributeddb",
542  ]
543
544  deps = [
545    "${data_service_path}/adapter:distributeddata_adapter",
546    "${data_service_path}/adapter/utils:distributeddata_utils_static",
547    "${data_service_path}/framework:distributeddatasvcfwk",
548    "${data_service_path}/service:distributeddatasvc",
549    "${kv_store_distributeddb_path}:distributeddb",
550    "${relational_store_inner_api_path}:native_rdb_static",
551    "//third_party/googletest:gtest_main",
552  ]
553}
554
555ohos_unittest("ObjectAssetLoaderTest") {
556  module_out_path = module_output_path
557  sources = [
558    "../object/object_asset_loader.cpp",
559    "../object/object_asset_machine.cpp",
560    "../object/object_snapshot.cpp",
561    "object_asset_loader_test.cpp",
562  ]
563
564  include_dirs = [
565    "${dataobject_path}/frameworks/innerkitsimpl/include/common",
566    "${dataobject_path}/interfaces/innerkits",
567    "${relational_store_path}/interfaces/inner_api/common_type/include",
568  ]
569
570  configs = [ ":module_private_config" ]
571
572  external_deps = [
573    "c_utils:utils",
574    "dfs_service:cloudsync_asset_kit_inner",
575    "dfs_service:distributed_file_daemon_kit_inner",
576    "hilog:libhilog",
577    "hisysevent:libhisysevent",
578    "ipc:ipc_core",
579    "kv_store:distributeddata_inner",
580  ]
581
582  deps = [
583    "${data_service_path}/adapter:distributeddata_adapter",
584    "${data_service_path}/framework:distributeddatasvcfwk",
585    "${data_service_path}/service:distributeddatasvc",
586    "//third_party/googletest:gtest_main",
587  ]
588
589  cflags = [
590    "-Dprivate=public",
591    "-Dprotected=public",
592  ]
593}
594
595ohos_unittest("ObjectAssetMachineTest") {
596  module_out_path = module_output_path
597  sources = [
598    "../object/object_asset_loader.cpp",
599    "../object/object_asset_machine.cpp",
600    "object_asset_machine_test.cpp",
601  ]
602
603  include_dirs = [
604    "${dataobject_path}/frameworks/innerkitsimpl/include/common",
605    "${dataobject_path}/interfaces/innerkits",
606    "${relational_store_path}/interfaces/inner_api/common_type/include",
607  ]
608
609  configs = [ ":module_private_config" ]
610
611  external_deps = [
612    "c_utils:utils",
613    "dfs_service:cloudsync_asset_kit_inner",
614    "dfs_service:distributed_file_daemon_kit_inner",
615    "hilog:libhilog",
616    "hisysevent:libhisysevent",
617    "ipc:ipc_core",
618    "kv_store:distributeddata_inner",
619  ]
620
621  deps = [
622    "${data_service_path}/adapter:distributeddata_adapter",
623    "${data_service_path}/framework:distributeddatasvcfwk",
624    "${data_service_path}/service:distributeddatasvc",
625    "//third_party/googletest:gtest_main",
626  ]
627}
628
629ohos_unittest("ObjectDmsHandlerTest") {
630  module_out_path = module_output_path
631  sources = [
632    "../object/object_dms_handler.cpp",
633    "object_dms_handler_test.cpp",
634  ]
635
636  include_dirs = []
637
638  configs = [ ":module_private_config" ]
639
640  external_deps = [
641    "c_utils:utils",
642    "dmsfwk:distributed_sdk",
643    "hilog:libhilog",
644    "ipc:ipc_core",
645    "kv_store:distributeddata_inner",
646  ]
647
648  deps = [
649    "${data_service_path}/adapter:distributeddata_adapter",
650    "${data_service_path}/framework:distributeddatasvcfwk",
651    "//third_party/googletest:gtest_main",
652  ]
653
654  cflags = [
655    "-Dprivate=public",
656    "-Dprotected=public",
657  ]
658}
659
660ohos_unittest("ObjectManagerTest") {
661  module_out_path = module_output_path
662  sources = [
663    "${data_service_path}/service/common/value_proxy.cpp",
664    "../object/object_asset_loader.cpp",
665    "../object/object_asset_machine.cpp",
666    "../object/object_callback_proxy.cpp",
667    "../object/object_data_listener.cpp",
668    "../object/object_manager.cpp",
669    "../object/object_snapshot.cpp",
670    "mock/kv_store_nb_delegate_mock.cpp",
671    "object_manager_test.cpp",
672  ]
673
674  include_dirs = [
675    "${dataobject_path}/frameworks/innerkitsimpl/include",
676    "${data_service_path}/service/common",
677    "${dataobject_path}/frameworks/innerkitsimpl/include/common",
678    "${dataobject_path}/interfaces/innerkits",
679  ]
680
681  configs = [ ":module_private_config" ]
682
683  external_deps = [
684    "access_token:libaccesstoken_sdk",
685    "access_token:libtokenid_sdk",
686    "c_utils:utils",
687    "dfs_service:cloudsync_asset_kit_inner",
688    "dfs_service:distributed_file_daemon_kit_inner",
689    "dmsfwk:distributed_sdk",
690    "hilog:libhilog",
691    "hisysevent:libhisysevent",
692    "ipc:ipc_core",
693    "kv_store:distributeddata_inner",
694    "kv_store:distributeddb",
695    "relational_store:native_rdb",
696  ]
697
698  deps = [
699    "${data_service_path}/adapter:distributeddata_adapter",
700    "${data_service_path}/framework:distributeddatasvcfwk",
701    "${data_service_path}/service:distributeddatasvc",
702    "//third_party/googletest:gtest_main",
703  ]
704
705  cflags = [
706    "-Dprivate=public",
707    "-Dprotected=public",
708  ]
709}
710
711ohos_unittest("ObjectSnapshotTest") {
712  module_out_path = module_output_path
713  sources = [
714    "../object/object_asset_loader.cpp",
715    "../object/object_asset_machine.cpp",
716    "../object/object_snapshot.cpp",
717    "object_snapshot_test.cpp",
718  ]
719
720  include_dirs = [
721    "${dataobject_path}/frameworks/innerkitsimpl/include/common",
722    "${dataobject_path}/interfaces/innerkits",
723    "${relational_store_path}/interfaces/inner_api/common_type/include",
724  ]
725
726  configs = [ ":module_private_config" ]
727
728  external_deps = [
729    "c_utils:utils",
730    "dfs_service:cloudsync_asset_kit_inner",
731    "dfs_service:distributed_file_daemon_kit_inner",
732    "hilog:libhilog",
733    "hisysevent:libhisysevent",
734    "ipc:ipc_core",
735    "kv_store:distributeddata_inner",
736  ]
737
738  deps = [
739    "${data_service_path}/adapter:distributeddata_adapter",
740    "${data_service_path}/framework:distributeddatasvcfwk",
741    "${data_service_path}/service:distributeddatasvc",
742    "//third_party/googletest:gtest_main",
743  ]
744}
745
746ohos_unittest("MetaDataTest") {
747  module_out_path = module_output_path
748  sources = [
749    "${data_service_path}/app/src/kvstore_meta_manager.cpp",
750    "meta_data_test.cpp",
751  ]
752
753  sanitize = {
754    cfi = true
755    cfi_cross_dso = true
756    debug = false
757  }
758
759  include_dirs = [
760    "${data_service_path}/app/src",
761    "${data_service_path}/service/kvdb",
762    "${data_service_path}/adapter/include/account",
763    "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include",
764    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include",
765    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include",
766  ]
767
768  configs = [ ":module_private_config" ]
769
770  external_deps = [
771    "access_token:libaccesstoken_sdk",
772    "access_token:libnativetoken",
773    "access_token:libtoken_setproc",
774    "c_utils:utils",
775    "dataclassification:data_transit_mgr",
776    "hilog:libhilog",
777    "hisysevent:libhisysevent",
778    "ipc:ipc_core",
779    "kv_store:distributeddata_inner",
780  ]
781
782  deps = [
783    "${data_service_path}/adapter:distributeddata_adapter",
784    "${data_service_path}/framework:distributeddatasvcfwk",
785    "${data_service_path}/service:distributeddatasvc",
786    "${kv_store_path}/frameworks/libs/distributeddb:distributeddb",
787    "//third_party/googletest:gtest_main",
788  ]
789}
790
791ohos_unittest("UdmfRunTimeStoreTest") {
792  module_out_path = module_output_path
793  sources = [
794    "${data_service_path}/app/src/kvstore_meta_manager.cpp",
795    "udmf_run_time_store_test.cpp",
796  ]
797
798  include_dirs = [
799    "${data_service_path}/adapter/include/account",
800    "${data_service_path}/adapter/include/communicator",
801    "${data_service_path}/app/src",
802    "${data_service_path}/service/kvdb",
803    "${data_service_path}/service/udmf",
804    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include",
805    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include",
806    "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include",
807  ]
808
809  configs = [ ":module_private_config" ]
810
811  external_deps = [
812    "ability_base:base",
813    "ability_base:want",
814    "access_token:libaccesstoken_sdk",
815    "access_token:libnativetoken",
816    "access_token:libtoken_setproc",
817    "c_utils:utils",
818    "dataclassification:data_transit_mgr",
819    "dsoftbus:softbus_client",
820    "hilog:libhilog",
821    "hisysevent:libhisysevent",
822    "image_framework:image",
823    "ipc:ipc_core",
824    "kv_store:distributeddata_inner",
825    "udmf:udmf_client",
826  ]
827
828  deps = [
829    "${data_service_path}/adapter:distributeddata_adapter",
830    "${data_service_path}/adapter/communicator:distributeddata_communicator_static",
831    "${data_service_path}/framework:distributeddatasvcfwk",
832    "${data_service_path}/service:distributeddatasvc",
833    "${data_service_path}/service/udmf:udmf_server",
834    "${kv_store_path}/frameworks/libs/distributeddb:distributeddb",
835    "//third_party/googletest:gtest_main",
836    "//third_party/openssl:libcrypto_shared",
837  ]
838}
839
840ohos_unittest("WaterVersionManagerTest") {
841  module_out_path = module_output_path
842  sanitize = {
843    cfi = true
844    cfi_cross_dso = true
845    debug = false
846  }
847  sources = [
848    "${data_service_path}/service/backup/src/backup_manager.cpp",
849    "${data_service_path}/service/bootstrap/src/bootstrap.cpp",
850    "${data_service_path}/service/config/src/config_factory.cpp",
851    "${data_service_path}/service/config/src/model/app_id_mapping_config.cpp",
852    "${data_service_path}/service/config/src/model/backup_config.cpp",
853    "${data_service_path}/service/config/src/model/checker_config.cpp",
854    "${data_service_path}/service/config/src/model/cloud_config.cpp",
855    "${data_service_path}/service/config/src/model/component_config.cpp",
856    "${data_service_path}/service/config/src/model/directory_config.cpp",
857    "${data_service_path}/service/config/src/model/global_config.cpp",
858    "${data_service_path}/service/config/src/model/network_config.cpp",
859    "${data_service_path}/service/config/src/model/protocol_config.cpp",
860    "${data_service_path}/service/waterversion/water_version_manager.cpp",
861    "mock/checker_mock.cpp",
862    "mock/db_change_data_mock.cpp",
863    "mock/db_store_mock.cpp",
864    "water_version_manager_test.cpp",
865  ]
866
867  include_dirs = [
868    "${data_service_path}/service/backup/include",
869    "${data_service_path}/service/bootstrap/include",
870    "${data_service_path}/service/cloud",
871    "${data_service_path}/service/common",
872    "${data_service_path}/service/config/include",
873    "${data_service_path}/service/crypto/include",
874    "${data_service_path}/service/dumper/include",
875    "${data_service_path}/service/kvdb",
876    "${data_service_path}/service/matrix/include",
877    "${data_service_path}/service/object",
878    "${data_service_path}/service/permission/include",
879    "${data_service_path}/service/rdb",
880    "${data_service_path}/service/waterversion",
881    "${data_service_path}/adapter/include/communicator",
882    "${data_service_path}/adapter/include",
883    "${data_service_path}/app/src",
884    "${data_service_path}/framework/include",
885  ]
886
887  configs = [ ":module_private_config" ]
888
889  external_deps = [
890    "access_token:libaccesstoken_sdk",
891    "access_token:libnativetoken",
892    "access_token:libtoken_setproc",
893    "access_token:libtokenid_sdk",
894    "c_utils:utils",
895    "device_auth:deviceauth_sdk",
896    "device_manager:devicemanagersdk",
897    "dfs_service:cloudsync_asset_kit_inner",
898    "dfs_service:distributed_file_daemon_kit_inner",
899    "dsoftbus:softbus_client",
900    "hilog:libhilog",
901    "ipc:ipc_core",
902    "kv_store:distributeddata_inner",
903  ]
904
905  deps = [
906    "${data_service_path}/adapter:distributeddata_adapter",
907    "${data_service_path}/framework:distributeddatasvcfwk",
908    "${data_service_path}/service:distributeddatasvc",
909    "${kv_store_distributeddb_path}:distributeddb",
910    "//third_party/googletest:gtest_main",
911    "//third_party/openssl:libcrypto_shared",
912  ]
913}
914
915ohos_unittest("DataShareServiceImplTest") {
916  module_out_path = module_output_path
917
918  include_dirs = [
919    "${datashare_path}/frameworks/native/common/include",
920    "${datashare_path}/interfaces/inner_api/common/include",
921    "${datashare_path}/interfaces/inner_api/consumer/include",
922    "//third_party/json/single_include",
923  ]
924
925  sources = [
926    "${data_service_path}/service/common/xcollie.cpp",
927    "${data_service_path}/service/crypto/src/crypto_manager.cpp",
928    "${data_service_path}/service/data_share/common/app_connect_manager.cpp",
929    "${data_service_path}/service/data_share/common/base64_utils.cpp",
930    "${data_service_path}/service/data_share/common/bundle_mgr_proxy.cpp",
931    "${data_service_path}/service/data_share/common/db_delegate.cpp",
932    "${data_service_path}/service/data_share/common/div_strategy.cpp",
933    "${data_service_path}/service/data_share/common/extension_ability_manager.cpp",
934    "${data_service_path}/service/data_share/common/extension_connect_adaptor.cpp",
935    "${data_service_path}/service/data_share/common/extension_mgr_proxy.cpp",
936    "${data_service_path}/service/data_share/common/kv_delegate.cpp",
937    "${data_service_path}/service/data_share/common/rdb_delegate.cpp",
938    "${data_service_path}/service/data_share/common/scheduler_manager.cpp",
939    "${data_service_path}/service/data_share/common/seq_strategy.cpp",
940    "${data_service_path}/service/data_share/common/uri_utils.cpp",
941    "${data_service_path}/service/data_share/data/published_data.cpp",
942    "${data_service_path}/service/data_share/data/resultset_json_formatter.cpp",
943    "${data_service_path}/service/data_share/data/template_data.cpp",
944    "${data_service_path}/service/data_share/data_provider_config.cpp",
945    "${data_service_path}/service/data_share/data_share_db_config.cpp",
946    "${data_service_path}/service/data_share/data_share_obs_proxy.cpp",
947    "${data_service_path}/service/data_share/data_share_profile_config.cpp",
948    "${data_service_path}/service/data_share/data_share_service_impl.cpp",
949    "${data_service_path}/service/data_share/data_share_service_stub.cpp",
950    "${data_service_path}/service/data_share/data_share_silent_config.cpp",
951    "${data_service_path}/service/data_share/data_share_types_util.cpp",
952    "${data_service_path}/service/data_share/strategies/data_proxy/load_config_from_data_proxy_node_strategy.cpp",
953    "${data_service_path}/service/data_share/strategies/data_share/load_config_from_data_share_bundle_info_strategy.cpp",
954    "${data_service_path}/service/data_share/strategies/general/check_is_data_proxy_strategy.cpp",
955    "${data_service_path}/service/data_share/strategies/general/check_is_single_app_strategy.cpp",
956    "${data_service_path}/service/data_share/strategies/general/cross_permission_strategy.cpp",
957    "${data_service_path}/service/data_share/strategies/general/load_config_common_strategy.cpp",
958    "${data_service_path}/service/data_share/strategies/general/load_config_data_info_strategy.cpp",
959    "${data_service_path}/service/data_share/strategies/general/load_config_from_bundle_info_strategy.cpp",
960    "${data_service_path}/service/data_share/strategies/general/permission_strategy.cpp",
961    "${data_service_path}/service/data_share/strategies/get_data_strategy.cpp",
962    "${data_service_path}/service/data_share/strategies/publish_strategy.cpp",
963    "${data_service_path}/service/data_share/strategies/rdb_notify_strategy.cpp",
964    "${data_service_path}/service/data_share/strategies/subscribe_strategy.cpp",
965    "${data_service_path}/service/data_share/strategies/template_strategy.cpp",
966    "${data_service_path}/service/data_share/subscriber_managers/published_data_subscriber_manager.cpp",
967    "${data_service_path}/service/data_share/subscriber_managers/rdb_subscriber_manager.cpp",
968    "${data_service_path}/service/data_share/sys_event_subscriber.cpp",
969    "${data_service_path}/service/kvdb/user_delegate.cpp",
970    "${data_service_path}/service/permission/src/permit_delegate.cpp",
971    "data_share_profile_config_test.cpp",
972    "data_share_service_impl_test.cpp",
973    "data_share_service_stub_test.cpp",
974    "data_share_subscriber_managers_test.cpp",
975  ]
976
977  configs = [ ":module_private_config" ]
978
979  cflags = [
980    "-g",
981    "-O0",
982    "-Wno-unused-variable",
983    "-fno-omit-frame-pointer",
984    "-Wno-multichar",
985    "-Wno-c99-designator",
986    "-Dprivate=public",
987    "-Dprotected=public",
988  ]
989
990  external_deps = [
991    "ability_base:want",
992    "ability_base:zuri",
993    "ability_runtime:dataobs_manager",
994    "ability_runtime:extension_manager",
995    "ability_runtime:wantagent_innerkits",
996    "access_token:libaccesstoken_sdk",
997    "access_token:libtoken_setproc",
998    "access_token:libtokenid_sdk",
999    "bundle_framework:appexecfwk_base",
1000    "bundle_framework:appexecfwk_core",
1001    "c_utils:utils",
1002    "common_event_service:cesfwk_innerkits",
1003    "data_share:datashare_common",
1004    "device_manager:devicemanagersdk",
1005    "hicollie:libhicollie",
1006    "hilog:libhilog",
1007    "hisysevent:libhisysevent",
1008    "huks:libhukssdk",
1009    "ipc:ipc_core",
1010    "kv_store:distributeddb",
1011    "relational_store:native_rdb",
1012    "relational_store:rdb_data_share_adapter",
1013    "resource_management:global_resmgr",
1014    "samgr:samgr_proxy",
1015    "time_service:time_client",
1016  ]
1017
1018  deps = [
1019    "${data_service_path}/adapter:distributeddata_adapter",
1020    "${data_service_path}/adapter/utils:distributeddata_utils_static",
1021    "${data_service_path}/framework:distributeddatasvcfwk",
1022    "${data_service_path}/service:distributeddatasvc",
1023    "${data_service_path}/service/data_share:data_share_service",
1024    "${kv_store_distributeddb_path}:distributeddb",
1025    "//third_party/googletest:gtest_main",
1026  ]
1027}
1028
1029ohos_unittest("KvdbServiceImplTest") {
1030  module_out_path = module_output_path
1031  sources = [
1032    "${data_service_path}/app/src/kvstore_meta_manager.cpp",
1033    "${data_service_path}/service/common/value_proxy.cpp",
1034    "${data_service_path}/service/kvdb/auth_delegate.cpp",
1035    "${data_service_path}/service/kvdb/kvdb_general_store.cpp",
1036    "${data_service_path}/service/kvdb/kvdb_notifier_proxy.cpp",
1037    "${data_service_path}/service/kvdb/kvdb_watcher.cpp",
1038    "${data_service_path}/service/kvdb/query_helper.cpp",
1039    "${data_service_path}/service/kvdb/upgrade.cpp",
1040    "${data_service_path}/service/kvdb/user_delegate.cpp",
1041    "${data_service_path}/service/rdb/rdb_cloud.cpp",
1042    "${data_service_path}/service/rdb/rdb_query.cpp",
1043    "${data_service_path}/service/waterversion/water_version_manager.cpp",
1044    "kvdb_service_impl_test.cpp",
1045    "kvdb_service_test.cpp",
1046  ]
1047
1048  include_dirs = [
1049    "${data_service_path}/app/src",
1050    "${data_service_path}/service/kvdb",
1051    "${data_service_path}/adapter/include/account",
1052    "${kv_store_path}/frameworks/innerkitsimpl/kvdb/include",
1053    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include",
1054    "${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include",
1055  ]
1056
1057  configs = [ ":module_private_config" ]
1058
1059  cflags = [
1060    "-Dprivate=public",
1061    "-Dprotected=public",
1062  ]
1063
1064  external_deps = [
1065    "access_token:libaccesstoken_sdk",
1066    "access_token:libnativetoken",
1067    "access_token:libtoken_setproc",
1068    "c_utils:utils",
1069    "dataclassification:data_transit_mgr",
1070    "device_auth:deviceauth_sdk",
1071    "hilog:libhilog",
1072    "hisysevent:libhisysevent",
1073    "ipc:ipc_core",
1074    "kv_store:distributeddata_inner",
1075    "relational_store:native_rdb",
1076  ]
1077
1078  deps = [
1079    "${data_service_path}/adapter:distributeddata_adapter",
1080    "${data_service_path}/framework:distributeddatasvcfwk",
1081    "${data_service_path}/service:distributeddatasvc",
1082    "${kv_store_path}/frameworks/libs/distributeddb:distributeddb",
1083    "//third_party/googletest:gtest_main",
1084  ]
1085}
1086
1087ohos_unittest("DumpHelperTest") {
1088  module_out_path = module_output_path
1089  sources = [
1090    "${data_service_path}/service/dumper/src/dump_helper.cpp",
1091    "dump_helper_test.cpp",
1092  ]
1093
1094  include_dirs = [ "${data_service_path}/service/dumper/include" ]
1095
1096  configs = [ ":module_private_config" ]
1097
1098  cflags = [
1099    "-Dprivate=public",
1100    "-Dprotected=public",
1101  ]
1102
1103  external_deps = [
1104    "c_utils:utils",
1105    "hilog:libhilog",
1106    "kv_store:distributeddata_inner",
1107    "kv_store:distributeddb",
1108    "relational_store:native_rdb",
1109  ]
1110
1111  deps = [
1112    "${data_service_path}/framework:distributeddatasvcfwk",
1113    "${data_service_path}/service:distributeddatasvc",
1114    "//third_party/googletest:gtest_main",
1115  ]
1116}
1117
1118###############################################################################
1119group("unittest") {
1120  testonly = true
1121
1122  deps = []
1123
1124  if (datamgr_service_config) {
1125    deps += [ ":ConfigFactoryTest" ]
1126  }
1127
1128  deps += [
1129    ":CloudDataTest",
1130    ":CloudServiceImplTest",
1131    ":CloudTest",
1132    ":CryptoManagerTest",
1133    ":DataShareServiceImplTest",
1134    ":DeviceMatrixTest",
1135    ":DirectoryManagerTest",
1136    ":DumpHelperTest",
1137    ":KVDBGeneralStoreTest",
1138    ":KvdbServiceImplTest",
1139    ":MetaDataTest",
1140    ":ObjectAssetLoaderTest",
1141    ":ObjectAssetMachineTest",
1142    ":ObjectDmsHandlerTest",
1143    ":ObjectManagerTest",
1144    ":ObjectSnapshotTest",
1145    ":RdbResultSetImplTest",
1146    ":RdbServiceTest",
1147    ":UdmfRunTimeStoreTest",
1148    ":ValueProxyServiceTest",
1149    ":WaterVersionManagerTest",
1150  ]
1151}
1152###############################################################################
1153