• 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 
16 #include "distributed_bm_storage_test.h"
17 
18 #include <thread>
19 #include "distributed_sched_test_util.h"
20 #include "dtbschedmgr_device_info_storage.h"
21 #include "test_log.h"
22 
23 namespace OHOS {
24 namespace DistributedSchedule {
25 using namespace std;
26 using namespace testing;
27 using namespace testing::ext;
28 using namespace OHOS::DistributedKv;
29 using namespace OHOS::DistributedHardware;
30 namespace {
31 const std::string BASEDIR = "/data/service/el1/public/database/DistributedSchedule";
32 constexpr int32_t TASK_ID_1 = 11;
33 constexpr int32_t TASK_ID_2 = 12;
34 constexpr size_t BYTESTREAM_LENGTH = 100;
35 constexpr uint8_t ONE_BYTE = '6';
36 constexpr uint16_t ONE = 1;
37 }
38 
SetUpTestCase()39 void DistributedBmStorageTest::SetUpTestCase()
40 {
41     mkdir(BASEDIR.c_str(), (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
42     DTEST_LOG << "DistributedBmStorageTest::SetUpTestCase" << std::endl;
43 }
44 
TearDownTestCase()45 void DistributedBmStorageTest::TearDownTestCase()
46 {
47     (void)remove(BASEDIR.c_str());
48     DTEST_LOG << "DistributedBmStorageTest::TearDownTestCase" << std::endl;
49 }
50 
SetUp()51 void DistributedBmStorageTest::SetUp()
52 {
53     DistributedSchedUtil::MockPermission();
54     dmsBmStorage_ = std::make_shared<DmsBmStorage>();
55     DTEST_LOG << "DistributedBmStorageTest::SetUp" << std::endl;
56 }
57 
TearDown()58 void DistributedBmStorageTest::TearDown()
59 {
60     DTEST_LOG << "DistributedBmStorageTest::TearDown" << std::endl;
61 }
62 
63 
GetDmsBmStorage()64 std::shared_ptr<DmsBmStorage> DistributedBmStorageTest::GetDmsBmStorage()
65 {
66     if (dmsBmStorage_ == nullptr) {
67         dmsBmStorage_ = std::make_unique<DmsBmStorage>();
68     }
69     return dmsBmStorage_;
70 }
71 
72 /**
73  * @tc.name: InitTest_001
74  * @tc.desc: test init DistributedBmStorage
75  * @tc.type: FUNC
76  */
77 HWTEST_F(DistributedBmStorageTest, SaveStorageDistributeInfo_001, TestSize.Level0)
78 {
79     DTEST_LOG << "DistributedBmStorageTest SaveStorageDistributeInfo_001 start" << std::endl;
80     ASSERT_NE(dmsBmStorage_, nullptr);
81     auto distributedDataStorage = GetDmsBmStorage();
82     EXPECT_NE(distributedDataStorage, nullptr);
83     if (distributedDataStorage != nullptr) {
84         const std::string bundleName = "NonexistentName";
85         bool ret = dmsBmStorage_->GetInstance()->SaveStorageDistributeInfo(bundleName, true);
86         EXPECT_EQ(ret, false);
87     }
88     DTEST_LOG << "DistributedBmStorageTest SaveStorageDistributeInfo_001 end" << std::endl;
89 }
90 
91 /**
92  * @tc.name: DeleteStorageDistributeInfoTest_001
93  * @tc.desc: test insert DistributedBmStorage
94  * @tc.type: FUNC
95  */
96 HWTEST_F(DistributedBmStorageTest, DeleteStorageDistributeInfoTest_001, TestSize.Level1)
97 {
98     DTEST_LOG << "DistributedBmStorageTest DeleteStorageDistributeInfoTest_001 start" << std::endl;
99     ASSERT_NE(dmsBmStorage_, nullptr);
100     auto distributedDataStorage = GetDmsBmStorage();
101     EXPECT_NE(distributedDataStorage, nullptr);
102     if (distributedDataStorage != nullptr) {
103         const std::string bundleName = "NonexistentName";
104         bool ret = dmsBmStorage_->GetInstance()->SaveStorageDistributeInfo(bundleName);
105         EXPECT_EQ(ret, false);
106     }
107     DTEST_LOG << "DistributedBmStorageTest DeleteStorageDistributeInfoTest_001 end" << std::endl;
108 }
109 
110 /**
111  * @tc.name: GetStorageDistributeInfo_001
112  * @tc.desc: test insert DistributedBmStorage
113  * @tc.type: FUNC
114  */
115 HWTEST_F(DistributedBmStorageTest, GetStorageDistributeInfo_001, TestSize.Level1)
116 {
117     DTEST_LOG << "DistributedBmStorageTest GetStorageDistributeInfo_001 start" << std::endl;
118     ASSERT_NE(dmsBmStorage_, nullptr);
119     auto distributedDataStorage = GetDmsBmStorage();
120     EXPECT_NE(distributedDataStorage, nullptr);
121     if (distributedDataStorage != nullptr) {
122         const std::string bundleName = "NonexistentName";
123         DmsBundleInfo info;
124         bool ret = dmsBmStorage_->GetInstance()->GetStorageDistributeInfo("", bundleName, info);
125         EXPECT_EQ(ret, false);
126     }
127     DTEST_LOG << "DistributedBmStorageTest GetStorageDistributeInfo_001 end" << std::endl;
128 }
129 
130 /**
131  * @tc.name: GetDistributedBundleNameTest_001
132  * @tc.desc: test insert DistributedBmStorage
133  * @tc.type: FUNC
134  */
135 HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_001, TestSize.Level1)
136 {
137     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_001 start" << std::endl;
138     ASSERT_NE(dmsBmStorage_, nullptr);
139     auto distributedDataStorage = GetDmsBmStorage();
140     EXPECT_NE(distributedDataStorage, nullptr);
141     if (distributedDataStorage != nullptr) {
142         std::string bundleName = "";
143         uint16_t bundleNameId = 0;
144         bool ret = dmsBmStorage_->GetInstance()->GetDistributedBundleName("", bundleNameId, bundleName);
145         EXPECT_EQ(ret, false);
146     }
147     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_001 end" << std::endl;
148 }
149 
150 /**
151  * @tc.name: GetDistributedBundleNameTest_002
152  * @tc.desc: test insert DistributedBmStorage
153  * @tc.type: FUNC
154  */
155 HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_002, TestSize.Level1)
156 {
157     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_002 start" << std::endl;
158     ASSERT_NE(dmsBmStorage_, nullptr);
159     auto distributedDataStorage = GetDmsBmStorage();
160     EXPECT_NE(distributedDataStorage, nullptr);
161     if (distributedDataStorage != nullptr) {
162         std::string networkId = "";
163         std::string bundleName = "";
164         uint16_t bundleNameId = 0;
165         bool ret = dmsBmStorage_->GetInstance()->GetDistributedBundleName(networkId, bundleNameId, bundleName);
166         EXPECT_EQ(ret, false);
167     }
168     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_002 end" << std::endl;
169 }
170 
171 /**
172  * @tc.name: GetDistributedBundleNameTest_003
173  * @tc.desc: test insert DistributedBmStorage
174  * @tc.type: FUNC
175  */
176 HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_003, TestSize.Level1)
177 {
178     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_003 start" << std::endl;
179     ASSERT_NE(dmsBmStorage_, nullptr);
180     auto distributedDataStorage = GetDmsBmStorage();
181     EXPECT_NE(distributedDataStorage, nullptr);
182     if (distributedDataStorage != nullptr) {
183         std::string networkId = "";
184         std::string bundleName = "browser";
185         uint16_t bundleNameId = 3;
186         bool ret = dmsBmStorage_->GetInstance()->GetDistributedBundleName(networkId, bundleNameId, bundleName);
187         EXPECT_EQ(ret, false);
188     }
189     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_003 end" << std::endl;
190 }
191 
192 /**
193  * @tc.name: GetDistributedBundleNameTest_004
194  * @tc.desc: test insert DistributedBmStorage
195  * @tc.type: FUNC
196  */
197 HWTEST_F(DistributedBmStorageTest, GetDistributedBundleNameTest_004, TestSize.Level1)
198 {
199     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_004 start" << std::endl;
200     ASSERT_NE(dmsBmStorage_, nullptr);
201     auto distributedDataStorage = GetDmsBmStorage();
202     EXPECT_NE(distributedDataStorage, nullptr);
203     if (distributedDataStorage != nullptr) {
204         std::string networkId = "";
205         std::string bundleName = "browser";
206         uint16_t bundleNameId = 4;
207         bool ret = dmsBmStorage_->GetInstance()->GetDistributedBundleName(networkId, bundleNameId, bundleName);
208         EXPECT_EQ(ret, false);
209     }
210     DTEST_LOG << "DistributedBmStorageTest GetDistributedBundleNameTest_004 end" << std::endl;
211 }
212 
213 /**
214  * @tc.name: GetBundleIdTest_001
215  * @tc.desc: test delete DistributedBmStorage
216  * @tc.type: FUNC
217  */
218 HWTEST_F(DistributedBmStorageTest, GetBundleIdTest_001, TestSize.Level0)
219 {
220     DTEST_LOG << "DistributedBmStorageTest GetBundleIdTest_001 start" << std::endl;
221     ASSERT_NE(dmsBmStorage_, nullptr);
222     auto distributedDataStorage = GetDmsBmStorage();
223     EXPECT_NE(distributedDataStorage, nullptr);
224     if (distributedDataStorage != nullptr) {
225         const std::string bundleName = "NonexistentName";
226         uint16_t bundleNameId = 0;
227         bool ret = dmsBmStorage_->GetInstance()->GetBundleNameId(bundleName, bundleNameId);
228         EXPECT_EQ(ret, false);
229     }
230     DTEST_LOG << "DistributedBmStorageTest GetBundleIdTest_001 end" << std::endl;
231 }
232 
233 /**
234  * @tc.name: GetBundleIdTest_002
235  * @tc.desc: test delete DistributedBmStorage
236  * @tc.type: FUNC
237  */
238 HWTEST_F(DistributedBmStorageTest, GetBundleIdTest_002, TestSize.Level0)
239 {
240     DTEST_LOG << "DistributedBmStorageTest GetBundleIdTest_002 start" << std::endl;
241     ASSERT_NE(dmsBmStorage_, nullptr);
242     auto distributedDataStorage = GetDmsBmStorage();
243     EXPECT_NE(distributedDataStorage, nullptr);
244     if (distributedDataStorage != nullptr) {
245         const std::string bundleName = "browser";
246         uint16_t bundleNameId = 1;
247         bool ret = dmsBmStorage_->GetInstance()->GetBundleNameId(bundleName, bundleNameId);
248         EXPECT_EQ(ret, false);
249     }
250     DTEST_LOG << "DistributedBmStorageTest GetBundleIdTest_002 end" << std::endl;
251 }
252 
253 /**
254  * @tc.name: UpdateDistributedDataTest_001
255  * @tc.desc: test delete DistributedBmStorage
256  * @tc.type: FUNC
257  */
258 HWTEST_F(DistributedBmStorageTest, UpdateDistributedDataTest_001, TestSize.Level1)
259 {
260     DTEST_LOG << "DistributedBmStorageTest UpdateDistributedDataTest_001 start" << std::endl;
261     ASSERT_NE(dmsBmStorage_, nullptr);
262     auto distributedDataStorage = GetDmsBmStorage();
263     EXPECT_NE(distributedDataStorage, nullptr);
264     if (distributedDataStorage != nullptr) {
265         dmsBmStorage_->GetInstance()->UpdateDistributedData();
266     }
267     DTEST_LOG << "DistributedBmStorageTest UpdateDistributedDataTest_001 end" << std::endl;
268 }
269 
270 /**
271  * @tc.name: CloudSyncTest_001
272  * @tc.desc: test delete DistributedBmStorage
273  * @tc.type: FUNC
274  */
275 HWTEST_F(DistributedBmStorageTest, CloudSyncTest_001, TestSize.Level1)
276 {
277     DTEST_LOG << "DistributedBmStorageTest CloudSyncTest_001 start" << std::endl;
278     ASSERT_NE(dmsBmStorage_, nullptr);
279     auto distributedDataStorage = GetDmsBmStorage();
280     EXPECT_NE(distributedDataStorage, nullptr);
281     if (distributedDataStorage != nullptr) {
282         dmsBmStorage_->GetInstance()->CloudSync();
283     }
284     DTEST_LOG << "DistributedBmStorageTest CloudSyncTest_001 end" << std::endl;
285 }
286 
287 /**
288  * @tc.name: GetBundleMgrTest_001
289  * @tc.desc: test delete DistributedBmStorage
290  * @tc.type: FUNC
291  */
292 HWTEST_F(DistributedBmStorageTest, GetBundleMgrTest_001, TestSize.Level1)
293 {
294     DTEST_LOG << "DistributedBmStorageTest GetBundleMgrTest_001 start" << std::endl;
295     ASSERT_NE(dmsBmStorage_, nullptr);
296     auto distributedDataStorage = GetDmsBmStorage();
297     EXPECT_NE(distributedDataStorage, nullptr);
298     if (distributedDataStorage != nullptr) {
299         auto bundleMgr = dmsBmStorage_->GetInstance()->GetBundleMgr();
300         EXPECT_NE(bundleMgr, nullptr);
301     }
302     DTEST_LOG << "DistributedBmStorageTest GetBundleMgrTest_001 end" << std::endl;
303 }
304 
305 /**
306  * @tc.name: GetContinueTypeTest_001
307  * @tc.desc: test delete DistributedBmStorage
308  * @tc.type: FUNC
309  */
310 HWTEST_F(DistributedBmStorageTest, GetContinueTypeTest_001, TestSize.Level1)
311 {
312     DTEST_LOG << "DistributedBmStorageTest GetContinueTypeTest_001 start" << std::endl;
313     ASSERT_NE(dmsBmStorage_, nullptr);
314     auto distributedDataStorage = GetDmsBmStorage();
315     EXPECT_NE(distributedDataStorage, nullptr);
316     if (distributedDataStorage != nullptr) {
317         std::string networkId;
318         std::string bundleName;
319         uint8_t continueTypeId = 0;
320         std::string ret = dmsBmStorage_->GetInstance()->GetContinueType(networkId, bundleName, continueTypeId);
321         EXPECT_EQ(ret, "");
322     }
323     DTEST_LOG << "DistributedBmStorageTest GetContinueTypeTest_001 end" << std::endl;
324 }
325 
326 /**
327  * @tc.name: GetAbilityNameTest_001
328  * @tc.desc: test delete DistributedBmStorage
329  * @tc.type: FUNC
330  */
331 HWTEST_F(DistributedBmStorageTest, GetAbilityNameTest_001, TestSize.Level1)
332 {
333     DTEST_LOG << "DistributedBmStorageTest GetAbilityNameTest_001 start" << std::endl;
334     ASSERT_NE(dmsBmStorage_, nullptr);
335     auto distributedDataStorage = GetDmsBmStorage();
336     EXPECT_NE(distributedDataStorage, nullptr);
337     if (distributedDataStorage != nullptr) {
338         std::string networkId;
339         std::string bundleName;
340         std::string continueType;
341         std::string ret = dmsBmStorage_->GetInstance()->GetAbilityName(networkId, bundleName, continueType);
342         EXPECT_EQ(ret, "");
343     }
344     DTEST_LOG << "DistributedBmStorageTest GetAbilityNameTest_001 end" << std::endl;
345 }
346 
347 /**
348  * @tc.name: GetContinueTypeIdTest_001
349  * @tc.desc: test delete DistributedBmStorage
350  * @tc.type: FUNC
351  */
352 HWTEST_F(DistributedBmStorageTest, GetContinueTypeIdTest_001, TestSize.Level1)
353 {
354     DTEST_LOG << "DistributedBmStorageTest GetContinueTypeIdTest_001 start" << std::endl;
355     ASSERT_NE(dmsBmStorage_, nullptr);
356     auto distributedDataStorage = GetDmsBmStorage();
357     EXPECT_NE(distributedDataStorage, nullptr);
358     if (distributedDataStorage != nullptr) {
359         std::string bundleName;
360         std::string abilityName;
361         uint8_t continueTypeId = 0;
362         bool ret = dmsBmStorage_->GetInstance()->GetContinueTypeId(bundleName, abilityName, continueTypeId);
363         EXPECT_EQ(ret, false);
364     }
365     DTEST_LOG << "DistributedBmStorageTest GetContinueTypeIdTest_001 end" << std::endl;
366 }
367 
368 /**
369  * @tc.name: GetContinueEventInfoTest_001
370  * @tc.desc: test delete DistributedBmStorage
371  * @tc.type: FUNC
372  */
373 HWTEST_F(DistributedBmStorageTest, GetContinueEventInfoTest_001, TestSize.Level1)
374 {
375     DTEST_LOG << "DistributedBmStorageTest GetContinueEventInfoTest_001 start" << std::endl;
376     ASSERT_NE(dmsBmStorage_, nullptr);
377     auto distributedDataStorage = GetDmsBmStorage();
378     EXPECT_NE(distributedDataStorage, nullptr);
379     if (distributedDataStorage != nullptr) {
380         std::string networkId;
381         std::string bundleName;
382         std::string continueType;
383         ContinueEventInfo continueEventInfo;
384         bool ret = dmsBmStorage_->GetInstance()->GetContinueEventInfo(networkId, bundleName,
385             continueType, continueEventInfo);
386         EXPECT_EQ(ret, false);
387     }
388     DTEST_LOG << "DistributedBmStorageTest GetContinueEventInfoTest_001 end" << std::endl;
389 }
390 
391 /**
392  * @tc.name: DmsPutBatchTest_001
393  * @tc.desc: test delete DistributedBmStorage
394  * @tc.type: FUNC
395  */
396 HWTEST_F(DistributedBmStorageTest, DmsPutBatchTest_001, TestSize.Level1)
397 {
398     DTEST_LOG << "DistributedBmStorageTest DmsPutBatchTest_001 start" << std::endl;
399     ASSERT_NE(dmsBmStorage_, nullptr);
400     auto distributedDataStorage = GetDmsBmStorage();
401     EXPECT_NE(distributedDataStorage, nullptr);
402     if (distributedDataStorage != nullptr) {
403         std::vector<DmsBundleInfo> dmsBundleInfos;
404         dmsBmStorage_->GetInstance()->DmsPutBatch(dmsBundleInfos);
405     }
406     DTEST_LOG << "DistributedBmStorageTest DmsPutBatchTest_001 end" << std::endl;
407 }
408 
409 /**
410  * @tc.name: UpdatePublicRecordsTest_001
411  * @tc.desc: test delete DistributedBmStorage
412  * @tc.type: FUNC
413  */
414 HWTEST_F(DistributedBmStorageTest, UpdatePublicRecordsTest_001, TestSize.Level1)
415 {
416     DTEST_LOG << "DistributedBmStorageTest UpdatePublicRecordsTest_001 start" << std::endl;
417     auto distributedDataStorage = GetDmsBmStorage();
418     EXPECT_NE(distributedDataStorage, nullptr);
419     if (distributedDataStorage != nullptr) {
420         std::vector<DmsBundleInfo> dmsBundleInfos;
421         dmsBmStorage_->GetInstance()->UpdatePublicRecords("");
422     }
423     DTEST_LOG << "DistributedBmStorageTest UpdatePublicRecordsTest_001 end" << std::endl;
424 }
425 
426 /**
427  * @tc.name: InnerSaveStorageDistributeInfoTest_001
428  * @tc.desc: test InnerSaveStorageDistributeInfo
429  * @tc.type: FUNC
430  */
431 HWTEST_F(DistributedBmStorageTest, InnerSaveStorageDistributeInfoTest_001, TestSize.Level1)
432 {
433     DTEST_LOG << "DistributedBmStorageTest InnerSaveStorageDistributeInfoTest_001 start" << std::endl;
434     auto distributedDataStorage = GetDmsBmStorage();
435     EXPECT_NE(distributedDataStorage, nullptr);
436     if (distributedDataStorage != nullptr) {
437         std::string udid;
438         DmsBundleInfo bundleInfo;
439         bundleInfo.bundleName = "";
440         bool ret = dmsBmStorage_->InnerSaveStorageDistributeInfo(bundleInfo, udid);
441         EXPECT_EQ(ret, false);
442 
443         bundleInfo.bundleName = "bundleName";
444         udid = "udid";
445         dmsBmStorage_->InnerSaveStorageDistributeInfo(bundleInfo, udid);
446     }
447     DTEST_LOG << "DistributedBmStorageTest InnerSaveStorageDistributeInfoTest_001 end" << std::endl;
448 }
449 
450 /**
451  * @tc.name: DelBundleNameIdTest_001
452  * @tc.desc: test DelBundleNameId
453  * @tc.type: FUNC
454  */
455 HWTEST_F(DistributedBmStorageTest, DelBundleNameIdTest_001, TestSize.Level1)
456 {
457     DTEST_LOG << "DistributedBmStorageTest DelBundleNameIdTest_001 start" << std::endl;
458     auto distributedDataStorage = GetDmsBmStorage();
459     EXPECT_NE(distributedDataStorage, nullptr);
460     if (distributedDataStorage != nullptr) {
461         std::string bundleName = "bundleName";
462         dmsBmStorage_->bundleNameIdTables_.clear();
463         dmsBmStorage_->bundleNameIdTables_[ONE] = bundleName;
464         dmsBmStorage_->DelBundleNameId("bundleName1");
465         dmsBmStorage_->DelBundleNameId(bundleName);
466         EXPECT_EQ(dmsBmStorage_->bundleNameIdTables_.empty(), true);
467     }
468     DTEST_LOG << "DistributedBmStorageTest DelBundleNameIdTest_001 end" << std::endl;
469 }
470 
471 /**
472  * @tc.name: DealGetBundleNameTest_001
473  * @tc.desc: test DealGetBundleName
474  * @tc.type: FUNC
475  */
476 HWTEST_F(DistributedBmStorageTest, DealGetBundleNameTest_001, TestSize.Level1)
477 {
478     DTEST_LOG << "DistributedBmStorageTest DealGetBundleNameTest_001 start" << std::endl;
479     auto distributedDataStorage = GetDmsBmStorage();
480     EXPECT_NE(distributedDataStorage, nullptr);
481     if (distributedDataStorage != nullptr) {
482         std::string bundleName;
483         bool ret = dmsBmStorage_->DealGetBundleName("", ONE, bundleName);
484         EXPECT_EQ(ret, false);
485     }
486     DTEST_LOG << "DistributedBmStorageTest DealGetBundleNameTest_001 end" << std::endl;
487 }
488 
489 /**
490  * @tc.name: DelReduDataTest_001
491  * @tc.desc: test DelReduData
492  * @tc.type: FUNC
493  */
494 HWTEST_F(DistributedBmStorageTest, DelReduDataTest_001, TestSize.Level1)
495 {
496     DTEST_LOG << "DistributedBmStorageTest DelReduDataTest_001 start" << std::endl;
497     auto distributedDataStorage = GetDmsBmStorage();
498     EXPECT_NE(distributedDataStorage, nullptr);
499     if (distributedDataStorage != nullptr) {
500         std::vector<DistributedKv::Entry> reduRiskEntries;
501         bool ret = dmsBmStorage_->DelReduData("", reduRiskEntries);
502         EXPECT_EQ(ret, false);
503     }
504     DTEST_LOG << "DistributedBmStorageTest DelReduDataTest_001 end" << std::endl;
505 }
506 
507 /**
508  * @tc.name: RebuildLocalDataTest_001
509  * @tc.desc: test RebuildLocalData
510  * @tc.type: FUNC
511  */
512 HWTEST_F(DistributedBmStorageTest, RebuildLocalDataTest_001, TestSize.Level1)
513 {
514     DTEST_LOG << "DistributedBmStorageTest RebuildLocalDataTest_001 start" << std::endl;
515     auto distributedDataStorage = GetDmsBmStorage();
516     EXPECT_NE(distributedDataStorage, nullptr);
517     if (distributedDataStorage != nullptr) {
518         bool ret = dmsBmStorage_->RebuildLocalData();
519         EXPECT_EQ(ret, false);
520     }
521     DTEST_LOG << "DistributedBmStorageTest RebuildLocalDataTest_001 end" << std::endl;
522 }
523 
524 /**
525  * @tc.name: ConvertToDistributedBundleInfoTest_001
526  * @tc.desc: test ConvertToDistributedBundleInfo
527  * @tc.type: FUNC
528  */
529 HWTEST_F(DistributedBmStorageTest, ConvertToDistributedBundleInfoTest_001, TestSize.Level1)
530 {
531     DTEST_LOG << "DistributedBmStorageTest ConvertToDistributedBundleInfoTest_001 start" << std::endl;
532     auto distributedDataStorage = GetDmsBmStorage();
533     EXPECT_NE(distributedDataStorage, nullptr);
534     if (distributedDataStorage != nullptr) {
535         DmsBundleInfo distributedBundleInfo;
536         AppExecFwk::BundleInfo bundleInfo;
537         AppExecFwk::AppProvisionInfo appProvisionInfo;
538         distributedBundleInfo = dmsBmStorage_->ConvertToDistributedBundleInfo(bundleInfo, appProvisionInfo, true);
539         EXPECT_EQ(distributedBundleInfo.bundleName.empty(), true);
540 
541         bundleInfo.name = "bundleName";
542         distributedBundleInfo = dmsBmStorage_->ConvertToDistributedBundleInfo(bundleInfo, appProvisionInfo, false);
543         EXPECT_EQ(distributedBundleInfo.bundleName.empty(), false);
544     }
545     DTEST_LOG << "DistributedBmStorageTest ConvertToDistributedBundleInfoTest_001 end" << std::endl;
546 }
547 } // namespace DistributedSchedule
548 } // namespace OHOS