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