• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #define LOG_TAG "CloudServiceImplTest"
16 #include "cloud_service_impl.h"
17 
18 #include <gtest/gtest.h>
19 #include <unistd.h>
20 
21 #include "accesstoken_kit.h"
22 #include "account/account_delegate.h"
23 #include "bootstrap.h"
24 #include "checker_mock.h"
25 #include "cloud/change_event.h"
26 #include "cloud/cloud_event.h"
27 #include "cloud/cloud_server.h"
28 #include "cloud/cloud_share_event.h"
29 #include "cloud/schema_meta.h"
30 #include "cloud_types.h"
31 #include "cloud_types_util.h"
32 #include "cloud_value_util.h"
33 #include "communicator/device_manager_adapter.h"
34 #include "device_matrix.h"
35 #include "eventcenter/event_center.h"
36 #include "feature/feature_system.h"
37 #include "ipc_skeleton.h"
38 #include "log_print.h"
39 #include "metadata/meta_data_manager.h"
40 #include "metadata/store_meta_data.h"
41 #include "metadata/store_meta_data_local.h"
42 #include "mock/db_store_mock.h"
43 #include "mock/general_store_mock.h"
44 #include "model/component_config.h"
45 #include "network_delegate.h"
46 #include "network_delegate_mock.h"
47 #include "rdb_query.h"
48 #include "rdb_service.h"
49 #include "rdb_service_impl.h"
50 #include "rdb_types.h"
51 #include "store/auto_cache.h"
52 #include "store/store_info.h"
53 #include "token_setproc.h"
54 
55 using namespace testing::ext;
56 using namespace OHOS::DistributedData;
57 using namespace OHOS::Security::AccessToken;
58 using Confirmation = OHOS::CloudData::Confirmation;
59 using Status = OHOS::CloudData::CloudService::Status;
60 using CloudSyncScene = OHOS::CloudData::CloudServiceImpl::CloudSyncScene;
61 
62 namespace OHOS::Test {
63 namespace DistributedDataTest {
64 static constexpr const char *TEST_CLOUD_BUNDLE = "test_cloud_bundleName";
65 static constexpr const char *TEST_CLOUD_APPID = "test_cloud_appid";
66 static constexpr const char *TEST_CLOUD_STORE = "test_cloud_store";
67 static constexpr const char *TEST_CLOUD_DATABASE_ALIAS_1 = "test_cloud_database_alias_1";
68 class CloudServiceImplTest : public testing::Test {
69 public:
70     static void SetUpTestCase(void);
71     static void TearDownTestCase(void);
72     void SetUp();
73     void TearDown();
74 
75     static std::shared_ptr<CloudData::CloudServiceImpl> cloudServiceImpl_;
76     static NetworkDelegateMock delegate_;
77 };
78 std::shared_ptr<CloudData::CloudServiceImpl> CloudServiceImplTest::cloudServiceImpl_ =
79     std::make_shared<CloudData::CloudServiceImpl>();
80 NetworkDelegateMock CloudServiceImplTest::delegate_;
81 
SetUpTestCase(void)82 void CloudServiceImplTest::SetUpTestCase(void)
83 {
84     size_t max = 12;
85     size_t min = 5;
86     auto executor = std::make_shared<ExecutorPool>(max, min);
87     DeviceManagerAdapter::GetInstance().Init(executor);
88     NetworkDelegate::RegisterNetworkInstance(&delegate_);
89 }
90 
TearDownTestCase()91 void CloudServiceImplTest::TearDownTestCase() { }
92 
SetUp()93 void CloudServiceImplTest::SetUp() { }
94 
TearDown()95 void CloudServiceImplTest::TearDown() { }
96 
97 /**
98  * @tc.name: EnableCloud001
99  * @tc.desc: Test EnableCloud functions with user is invalid.
100  * @tc.type: FUNC
101  * @tc.require:
102  */
103 HWTEST_F(CloudServiceImplTest, EnableCloud001, TestSize.Level0)
104 {
105     ZLOGI("CloudServiceImplTest EnableCloud001 start");
106     std::map<std::string, int32_t> switches;
107     switches.insert_or_assign(TEST_CLOUD_BUNDLE, CloudData::CloudService::SWITCH_ON);
108     auto status = cloudServiceImpl_->EnableCloud(TEST_CLOUD_APPID, switches);
109     EXPECT_EQ(status, CloudData::CloudService::ERROR);
110 }
111 
112 /**
113  * @tc.name: DisableCloud001
114  * @tc.desc: Test DisableCloud functions with user is invalid.
115  * @tc.type: FUNC
116  * @tc.require:
117  */
118 HWTEST_F(CloudServiceImplTest, DisableCloud001, TestSize.Level0)
119 {
120     ZLOGI("CloudServiceImplTest DisableCloud001 start");
121     auto status = cloudServiceImpl_->DisableCloud(TEST_CLOUD_APPID);
122     EXPECT_EQ(status, CloudData::CloudService::ERROR);
123 }
124 
125 /**
126  * @tc.name: ChangeAppSwitch001
127  * @tc.desc: Test ChangeAppSwitch functions with user is invalid.
128  * @tc.type: FUNC
129  * @tc.require:
130  */
131 HWTEST_F(CloudServiceImplTest, ChangeAppSwitch001, TestSize.Level0)
132 {
133     ZLOGI("CloudServiceImplTest ChangeAppSwitch001 start");
134     auto status =
135         cloudServiceImpl_->ChangeAppSwitch(TEST_CLOUD_APPID, TEST_CLOUD_BUNDLE, CloudData::CloudService::SWITCH_ON);
136     EXPECT_EQ(status, CloudData::CloudService::ERROR);
137 }
138 
139 /**
140  * @tc.name: Clean001
141  * @tc.desc: Test Clean functions with user is invalid.
142  * @tc.type: FUNC
143  * @tc.require:
144  */
145 HWTEST_F(CloudServiceImplTest, Clean001, TestSize.Level0)
146 {
147     ZLOGI("CloudServiceImplTest Clean001 start");
148     std::map<std::string, int32_t> actions;
149     actions.insert_or_assign(TEST_CLOUD_BUNDLE, CloudData::CloudService::SWITCH_ON);
150     auto status = cloudServiceImpl_->Clean(TEST_CLOUD_APPID, actions);
151     EXPECT_EQ(status, CloudData::CloudService::ERROR);
152 }
153 
154 /**
155  * @tc.name: NotifyDataChange001
156  * @tc.desc: Test the EnableCloud function in case it doesn't get cloudInfo.
157  * @tc.type: FUNC
158  * @tc.require:
159  */
160 HWTEST_F(CloudServiceImplTest, NotifyDataChange001, TestSize.Level0)
161 {
162     ZLOGI("CloudServiceImplTest NotifyDataChange001 start");
163     auto status = cloudServiceImpl_->NotifyDataChange(TEST_CLOUD_APPID, TEST_CLOUD_BUNDLE);
164     EXPECT_EQ(status, CloudData::CloudService::INVALID_ARGUMENT);
165 }
166 
167 /**
168  * @tc.name: ExecuteStatistics001
169  * @tc.desc: Test the ExecuteStatistics function if the package name does not support CloudSync.
170  * @tc.type: FUNC
171  * @tc.require:
172  */
173 HWTEST_F(CloudServiceImplTest, ExecuteStatistics001, TestSize.Level0)
174 {
175     ZLOGI("CloudServiceImplTest ExecuteStatistics001 start");
176     CloudInfo cloudInfo;
177     CloudInfo::AppInfo appInfo;
178     appInfo.bundleName = TEST_CLOUD_BUNDLE;
179     cloudInfo.apps[TEST_CLOUD_BUNDLE] = std::move(appInfo);
180     SchemaMeta::Database database;
181     database.name = TEST_CLOUD_STORE;
182     database.alias = TEST_CLOUD_DATABASE_ALIAS_1;
183     SchemaMeta schemaMeta;
184     schemaMeta.bundleName = "testBundle";
185     schemaMeta.databases.emplace_back(database);
186     auto result = cloudServiceImpl_->ExecuteStatistics("", cloudInfo, schemaMeta);
187     EXPECT_TRUE(result.empty());
188 }
189 
190 /**
191  * @tc.name: QueryStatistics001
192  * @tc.desc: When metadata is not supported store test the QueryStatistics function.
193  * @tc.type: FUNC
194  * @tc.require:
195  */
196 HWTEST_F(CloudServiceImplTest, QueryStatistics001, TestSize.Level0)
197 {
198     ZLOGI("CloudServiceImplTest QueryStatistics start");
199     StoreMetaData metaData;
200     metaData.storeType = -1;
201     DistributedData::Database database;
202     auto result = cloudServiceImpl_->QueryStatistics(metaData, database);
203     EXPECT_TRUE(result.empty());
204 }
205 
206 /**
207  * @tc.name: QueryLastSyncInfo001
208  * @tc.desc: Test QueryLastSyncInfo functions with invalid parameter.
209  * @tc.type: FUNC
210  * @tc.require:
211  */
212 HWTEST_F(CloudServiceImplTest, QueryLastSyncInfo001, TestSize.Level0)
213 {
214     ZLOGI("CloudServiceImplTest QueryLastSyncInfo start");
215     auto [status, result] = cloudServiceImpl_->QueryLastSyncInfo(TEST_CLOUD_APPID, TEST_CLOUD_BUNDLE, TEST_CLOUD_STORE);
216     EXPECT_EQ(status, CloudData::CloudService::ERROR);
217     EXPECT_TRUE(result.empty());
218 }
219 
220 /**
221  * @tc.name: OnBind001
222  * @tc.desc: Test OnBind functions with invalid parameter.
223  * @tc.type: FUNC
224  * @tc.require:
225  */
226 HWTEST_F(CloudServiceImplTest, OnBind001, TestSize.Level0)
227 {
228     ZLOGI("CloudServiceImplTest OnBind001 start");
229     auto status = cloudServiceImpl_->OnBind({});
230     EXPECT_EQ(status, GeneralError::E_INVALID_ARGS);
231 }
232 
233 /**
234  * @tc.name: UpdateSchema001
235  * @tc.desc: Test UpdateSchema001 functions with invalid parameter.
236  * @tc.type: FUNC
237  * @tc.require:
238  */
239 HWTEST_F(CloudServiceImplTest, UpdateSchema001, TestSize.Level0)
240 {
241     ZLOGI("CloudServiceImplTest UpdateSchema001 start");
242     int user = -1;
243     auto status = cloudServiceImpl_->UpdateSchema(user, CloudSyncScene::ENABLE_CLOUD);
244     EXPECT_FALSE(status);
245 }
246 
247 /**
248  * @tc.name: GetAppSchemaFromServer001
249  * @tc.desc: Test GetAppSchemaFromServer functions not support CloudService.
250  * @tc.type: FUNC
251  * @tc.require:
252  */
253 HWTEST_F(CloudServiceImplTest, GetAppSchemaFromServer001, TestSize.Level0)
254 {
255     ZLOGI("CloudServiceImplTest GetAppSchemaFromServer001 start");
256     int user = -1;
257     auto [status, result] = cloudServiceImpl_->GetAppSchemaFromServer(user, TEST_CLOUD_BUNDLE);
258     EXPECT_EQ(status, CloudData::CloudService::SERVER_UNAVAILABLE);
259 }
260 
261 /**
262  * @tc.name: GetCloudInfoFromServer001
263  * @tc.desc: Test GetCloudInfoFromServer functions not support CloudService.
264  * @tc.type: FUNC
265  * @tc.require:
266  */
267 HWTEST_F(CloudServiceImplTest, GetCloudInfoFromServer001, TestSize.Level0)
268 {
269     ZLOGI("CloudServiceImplTest GetCloudInfoFromServer001 start");
270     int user = -1;
271     auto [status, result] = cloudServiceImpl_->GetCloudInfoFromServer(user);
272     EXPECT_EQ(status, CloudData::CloudService::SERVER_UNAVAILABLE);
273 }
274 
275 /**
276  * @tc.name: ReleaseUserInfo001
277  * @tc.desc: Test ReleaseUserInfo functions with invalid parameter.
278  * @tc.type: FUNC
279  * @tc.require:
280  */
281 HWTEST_F(CloudServiceImplTest, ReleaseUserInfo001, TestSize.Level0)
282 {
283     ZLOGI("CloudServiceImplTest ReleaseUserInfo001 start");
284     int user = 100;
285     auto status = cloudServiceImpl_->ReleaseUserInfo(user, CloudSyncScene::ENABLE_CLOUD);
286     EXPECT_TRUE(status);
287 }
288 
289 /**
290  * @tc.name: DoSubscribe
291  * @tc.desc: Test the DoSubscribe with not support CloudService
292  * @tc.type: FUNC
293  * @tc.require:
294  */
295 HWTEST_F(CloudServiceImplTest, DoSubscribe, TestSize.Level0)
296 {
297     int32_t user = 100;
298     auto status = cloudServiceImpl_->DoSubscribe(user, CloudSyncScene::ENABLE_CLOUD);
299     EXPECT_TRUE(status);
300 }
301 
302 /**
303  * @tc.name: Share001
304  * @tc.desc: Test the Share with invalid parameters
305  * @tc.type: FUNC
306  * @tc.require:
307  */
308 HWTEST_F(CloudServiceImplTest, Share001, TestSize.Level0)
309 {
310     std::string sharingRes;
311     CloudData::Participants participants;
312     CloudData::Results results;
313     auto status = cloudServiceImpl_->Share(sharingRes, participants, results);
314     EXPECT_EQ(status, GeneralError::E_ERROR);
315 }
316 
317 /**
318  * @tc.name: Unshare001
319  * @tc.desc: Test the Unshare with invalid parameters
320  * @tc.type: FUNC
321  * @tc.require:
322  */
323 HWTEST_F(CloudServiceImplTest, Unshare001, TestSize.Level0)
324 {
325     std::string sharingRes;
326     CloudData::Participants participants;
327     CloudData::Results results;
328     auto status = cloudServiceImpl_->Unshare(sharingRes, participants, results);
329     EXPECT_EQ(status, GeneralError::E_ERROR);
330 }
331 
332 /**
333  * @tc.name: Exit001
334  * @tc.desc: Test the Exit with invalid parameters
335  * @tc.type: FUNC
336  * @tc.require:
337  */
338 HWTEST_F(CloudServiceImplTest, Exit001, TestSize.Level0)
339 {
340     std::string sharingRes;
341     std::pair<int32_t, std::string> result;
342     auto status = cloudServiceImpl_->Exit(sharingRes, result);
343     EXPECT_EQ(status, GeneralError::E_ERROR);
344 }
345 
346 /**
347  * @tc.name: ChangePrivilege001
348  * @tc.desc: Test the ChangePrivilege with invalid parameters
349  * @tc.type: FUNC
350  * @tc.require:
351  */
352 HWTEST_F(CloudServiceImplTest, ChangePrivilege001, TestSize.Level0)
353 {
354     std::string sharingRes;
355     CloudData::Participants participants;
356     CloudData::Results results;
357     auto status = cloudServiceImpl_->ChangePrivilege(sharingRes, participants, results);
358     EXPECT_EQ(status, GeneralError::E_ERROR);
359 }
360 
361 /**
362  * @tc.name: Query001
363  * @tc.desc: Test the Query with invalid parameters
364  * @tc.type: FUNC
365  * @tc.require:
366  */
367 HWTEST_F(CloudServiceImplTest, Query001, TestSize.Level0)
368 {
369     std::string sharingRes;
370     CloudData::QueryResults results;
371     auto status = cloudServiceImpl_->Query(sharingRes, results);
372     EXPECT_EQ(status, GeneralError::E_ERROR);
373 }
374 
375 /**
376  * @tc.name: QueryByInvitation001
377  * @tc.desc: Test the QueryByInvitation with invalid parameters
378  * @tc.type: FUNC
379  * @tc.require:
380  */
381 HWTEST_F(CloudServiceImplTest, QueryByInvitation001, TestSize.Level0)
382 {
383     std::string invitation;
384     CloudData::QueryResults results;
385     auto status = cloudServiceImpl_->QueryByInvitation(invitation, results);
386     EXPECT_EQ(status, GeneralError::E_ERROR);
387 }
388 
389 /**
390  * @tc.name: ConfirmInvitation001
391  * @tc.desc: Test the ConfirmInvitation with invalid parameters
392  * @tc.type: FUNC
393  * @tc.require:
394  */
395 HWTEST_F(CloudServiceImplTest, ConfirmInvitation001, TestSize.Level0)
396 {
397     int32_t confirmation = 0;
398     std::tuple<int32_t, std::string, std::string> result { 0, "", "" };
399     std::string invitation;
400     auto status = cloudServiceImpl_->ConfirmInvitation(invitation, confirmation, result);
401     EXPECT_EQ(status, GeneralError::E_ERROR);
402 }
403 
404 /**
405  * @tc.name: ChangeConfirmation001
406  * @tc.desc: Test the ChangeConfirmation with invalid parameters
407  * @tc.type: FUNC
408  * @tc.require:
409  */
410 HWTEST_F(CloudServiceImplTest, ChangeConfirmation001, TestSize.Level0)
411 {
412     int32_t confirmation = 0;
413     std::string sharingRes;
414     std::pair<int32_t, std::string> result;
415     auto status = cloudServiceImpl_->ChangeConfirmation(sharingRes, confirmation, result);
416     EXPECT_EQ(status, GeneralError::E_ERROR);
417 }
418 
419 /**
420  * @tc.name: GetSharingHandle001
421  * @tc.desc: Test the GetSharingHandle with invalid parameters
422  * @tc.type: FUNC
423  * @tc.require:
424  */
425 HWTEST_F(CloudServiceImplTest, GetSharingHandle001, TestSize.Level0)
426 {
427     CloudData::CloudServiceImpl::HapInfo hapInfo;
428     auto status = cloudServiceImpl_->GetSharingHandle(hapInfo);
429     EXPECT_EQ(status, nullptr);
430 }
431 
432 /**
433  * @tc.name: SetCloudStrategy001
434  * @tc.desc: Test the SetCloudStrategy with get hapInfo failed
435  * @tc.type: FUNC
436  * @tc.require:
437  */
438 HWTEST_F(CloudServiceImplTest, SetCloudStrategy001, TestSize.Level0)
439 {
440     CloudData::Strategy strategy = CloudData::Strategy::STRATEGY_NETWORK;
441     std::vector<CommonType::Value> values;
442     values.push_back(CloudData::NetWorkStrategy::WIFI);
443 
444     auto status = cloudServiceImpl_->SetCloudStrategy(strategy, values);
445     EXPECT_EQ(status, CloudData::CloudService::ERROR);
446 }
447 
448 /**
449  * @tc.name: SetGlobalCloudStrategy001
450  * @tc.desc: Test the SetGlobalCloudStrategy with get hapInfo failed
451  * @tc.type: FUNC
452  * @tc.require:
453  */
454 HWTEST_F(CloudServiceImplTest, SetGlobalCloudStrategy001, TestSize.Level0)
455 {
456     CloudData::Strategy strategy = CloudData::Strategy::STRATEGY_NETWORK;
457     std::vector<CommonType::Value> values;
458     values.push_back(CloudData::NetWorkStrategy::WIFI);
459 
460     auto status = cloudServiceImpl_->SetGlobalCloudStrategy(strategy, values);
461     EXPECT_EQ(status, CloudData::CloudService::ERROR);
462 }
463 
464 /**
465  * @tc.name: CheckNotifyConditions001
466  * @tc.desc: Test the CheckNotifyConditions with invalid parameters
467  * @tc.type: FUNC
468  * @tc.require:
469  */
470 HWTEST_F(CloudServiceImplTest, CheckNotifyConditions, TestSize.Level0)
471 {
472     CloudInfo cloudInfo;
473     cloudInfo.enableCloud = false;
474     cloudInfo.id = TEST_CLOUD_APPID;
475 
476     auto status = cloudServiceImpl_->CheckNotifyConditions(TEST_CLOUD_APPID, TEST_CLOUD_BUNDLE, cloudInfo);
477     EXPECT_EQ(status, CloudData::CloudService::CLOUD_DISABLE);
478     cloudInfo.enableCloud = true;
479     CloudInfo::AppInfo appInfo;
480     appInfo.bundleName = TEST_CLOUD_BUNDLE;
481     appInfo.cloudSwitch = false;
482     cloudInfo.apps.insert_or_assign(TEST_CLOUD_BUNDLE, appInfo);
483     status = cloudServiceImpl_->CheckNotifyConditions(TEST_CLOUD_APPID, TEST_CLOUD_BUNDLE, cloudInfo);
484     EXPECT_EQ(status, CloudData::CloudService::CLOUD_DISABLE_SWITCH);
485 }
486 
487 /**
488  * @tc.name: GetDfxFaultType
489  * @tc.desc: test GetDfxFaultType function
490  * @tc.type: FUNC
491  * @tc.require:
492  * @tc.author:
493  */
494 HWTEST_F(CloudServiceImplTest, GetDfxFaultType, TestSize.Level0)
495 {
496     ASSERT_NE(cloudServiceImpl_, nullptr);
497     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::ENABLE_CLOUD), "ENABLE_CLOUD");
498     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::DISABLE_CLOUD), "DISABLE_CLOUD");
499     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::SWITCH_ON), "SWITCH_ON");
500     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::SWITCH_OFF), "SWITCH_OFF");
501     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::QUERY_SYNC_INFO), "QUERY_SYNC_INFO");
502     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::USER_CHANGE), "USER_CHANGE");
503     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::USER_UNLOCK), "USER_UNLOCK");
504     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::NETWORK_RECOVERY), "NETWORK_RECOVERY");
505     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::SERVICE_INIT), "SERVICE_INIT");
506     EXPECT_EQ(cloudServiceImpl_->GetDfxFaultType(CloudSyncScene::ACCOUNT_STOP), "SYNC_TASK");
507 }
508 
509 class ComponentConfigTest : public testing::Test {
510 public:
511     static void SetUpTestCase(void);
512     static void TearDownTestCase(void);
513     void SetUp();
514     void TearDown();
515 };
516 
SetUpTestCase(void)517 void ComponentConfigTest::SetUpTestCase(void) { }
518 
TearDownTestCase()519 void ComponentConfigTest::TearDownTestCase() { }
520 
SetUp()521 void ComponentConfigTest::SetUp() { }
522 
TearDown()523 void ComponentConfigTest::TearDown() { }
524 
525 /**
526  * @tc.name: CapabilityRange
527  * @tc.desc: test CapabilityRange Marshal function
528  * @tc.type: FUNC
529  * @tc.require:
530  * @tc.author: suoqilong
531  */
532 HWTEST_F(ComponentConfigTest, ComponentConfig, TestSize.Level0)
533 {
534     DistributedData::ComponentConfig config;
535     config.description = "description";
536     config.lib = "lib";
537     config.constructor = "constructor";
538     config.destructor = "destructor";
539     config.params = "";
540     Serializable::json node;
541     EXPECT_EQ(config.params.empty(), true);
542 
543     EXPECT_EQ(config.Marshal(node), true);
544     EXPECT_EQ(node["description"], config.description);
545     EXPECT_EQ(node["lib"], config.lib);
546     EXPECT_EQ(node["constructor"], config.constructor);
547     EXPECT_EQ(node["destructor"], config.destructor);
548 
549     DistributedData::ComponentConfig componentConfig;
550     componentConfig.description = "description";
551     componentConfig.lib = "lib";
552     componentConfig.constructor = "constructor";
553     componentConfig.destructor = "destructor";
554     componentConfig.params = "params";
555     Serializable::json node1;
556     EXPECT_EQ(componentConfig.params.empty(), false);
557 
558     EXPECT_EQ(componentConfig.Marshal(node1), true);
559     EXPECT_EQ(node["description"], componentConfig.description);
560     EXPECT_EQ(node["lib"], componentConfig.lib);
561     EXPECT_EQ(node["constructor"], componentConfig.constructor);
562     EXPECT_EQ(node["destructor"], componentConfig.destructor);
563 }
564 } // namespace DistributedDataTest
565 } // namespace OHOS::Test