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 "cloud_file_utils.h"
17 #include "clouddisk_rdb_utils.h"
18 #include "clouddisk_rdbstore.h"
19 #include "clouddisk_rdbstore_mock.h"
20 #include "clouddisk_resultset_mock.h"
21 #include "dfs_error.h"
22 #include "rdb_helper.h"
23 #include "rdb_open_callback.h"
24 #include "rdb_store_config.h"
25 #include "cloud_status.h"
26 #include <gmock/gmock.h>
27 #include <gtest/gtest.h>
28 #include <memory>
29 
30 namespace OHOS::FileManagement::CloudDisk::Test {
31 using namespace testing;
32 using namespace testing::ext;
33 using namespace std;
34 using namespace NativeRdb;
35 const int RESNUM = 16;
36 
37 class CloudDiskRdbStoreTest : public testing::Test {
38 public:
39     static void SetUpTestCase(void);
40     static void TearDownTestCase(void);
41     void SetUp();
42     void TearDown();
43 };
44 
SetUpTestCase(void)45 void CloudDiskRdbStoreTest::SetUpTestCase(void)
46 {
47     GTEST_LOG_(INFO) << "SetUpTestCase";
48 }
49 
TearDownTestCase(void)50 void CloudDiskRdbStoreTest::TearDownTestCase(void)
51 {
52     GTEST_LOG_(INFO) << "TearDownTestCase";
53 }
54 
SetUp(void)55 void CloudDiskRdbStoreTest::SetUp(void)
56 {
57     GTEST_LOG_(INFO) << "SetUp";
58 }
59 
TearDown(void)60 void CloudDiskRdbStoreTest::TearDown(void)
61 {
62     GTEST_LOG_(INFO) << "TearDown";
63 }
64 
65 /**
66  * @tc.name: RdbInit
67  * @tc.desc: Verify the CloudDiskRdbStore::RdbInit function
68  * @tc.type: FUNC
69  * @tc.require: SR000HRKKA
70  */
71 HWTEST_F(CloudDiskRdbStoreTest, RdbInitTest1, TestSize.Level1)
72 {
73     const std::string bundleName = "RdbInitTest";
74     const int32_t userId = 123456789;
75     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
76     int32_t ret = CloudDiskRdbStore.RdbInit();
77     EXPECT_EQ(ret, RESNUM);
78 }
79 
80 /**
81  * @tc.name: GetRaw
82  * @tc.desc: Verify the CloudDiskRdbStore::GetRaw function
83  * @tc.type: FUNC
84  * @tc.require: SR000HRKKA
85  */
86 HWTEST_F(CloudDiskRdbStoreTest, GetRawTest1, TestSize.Level1)
87 {
88     const std::string bundleName = "InitRootIdTest";
89     const int32_t userId = 123456789;
90     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
91     EXPECT_FALSE(CloudDiskRdbStore.GetRaw());
92 }
93 
94 /**
95  * @tc.name: LookUp
96  * @tc.desc: Verify the CloudDiskRdbStore::LookUp function
97  * @tc.type: FUNC
98  * @tc.require: SR000HRKKA
99  */
100 HWTEST_F(CloudDiskRdbStoreTest, LookUpTest1, TestSize.Level1)
101 {
102     const std::string parentCloudId = "LookUpTest";
103     const std::string fileName = "";
104     const std::string bundleName = "InitRootIdTest";
105     const int32_t userId = 123456789;
106     CloudDiskFileInfo info;
107     info.name = "test.txt";
108     info.cloudId = "1223456";
109     info.parentCloudId = "22222";
110     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
111     int32_t ret = CloudDiskRdbStore.LookUp(parentCloudId, fileName, info);
112     EXPECT_EQ(ret, E_RDB);
113 }
114 
115 /**
116  * @tc.name: LookUp
117  * @tc.desc: Verify the CloudDiskRdbStore::LookUp function
118  * @tc.type: FUNC
119  * @tc.require: SR000HRKKA
120  */
121 HWTEST_F(CloudDiskRdbStoreTest, LookUpTest2, TestSize.Level1)
122 {
123     const std::string parentCloudId = "";
124     const std::string fileName = "LookUpTest";
125     const std::string bundleName = "InitRootIdTest";
126     const int32_t userId = 123456789;
127     CloudDiskFileInfo info;
128     info.name = "test.txt";
129     info.cloudId = "1223456";
130     info.parentCloudId = "22222";
131     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
132     int32_t ret = CloudDiskRdbStore.LookUp(parentCloudId, fileName, info);
133     EXPECT_EQ(ret, E_RDB);
134 }
135 
136 /**
137  * @tc.name: LookUp
138  * @tc.desc: Verify the CloudDiskRdbStore::LookUp function
139  * @tc.type: FUNC
140  * @tc.require: SR000HRKKA
141  */
142 HWTEST_F(CloudDiskRdbStoreTest, LookUpTest3, TestSize.Level1)
143 {
144     const std::string parentCloudId = "100";
145     const std::string fileName = "Test";
146     const std::string bundleName = "com.ohos.photos";
147     const int32_t userId = 100;
148     CloudDiskFileInfo info;
149     info.name = "test.txt";
150     info.cloudId = "1223456";
151     info.parentCloudId = "22222";
152     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
153     int32_t ret = CloudDiskRdbStore.LookUp(parentCloudId, fileName, info);
154     EXPECT_EQ(ret, E_RDB);
155 }
156 
157 /**
158  * @tc.name: GetAttr
159  * @tc.desc: Verify the CloudDiskRdbStore::GetAttr function
160  * @tc.type: FUNC
161  * @tc.require: SR000HRKKA
162  */
163 HWTEST_F(CloudDiskRdbStoreTest, GetAttrTest1, TestSize.Level1)
164 {
165     const std::string cloudId = "";
166     const std::string parentCloudId = "123456";
167     const std::string fileName = "LookUpTest";
168     const std::string bundleName = "InitRootIdTest";
169     const int32_t userId = 123456789;
170     CloudDiskFileInfo info;
171     info.name = "test.txt";
172     info.cloudId = "";
173     info.parentCloudId = "22222";
174     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
175     int32_t ret = CloudDiskRdbStore.GetAttr(cloudId, info);
176     EXPECT_EQ(ret, E_RDB);
177 }
178 
179 /**
180  * @tc.name: GetAttr
181  * @tc.desc: Verify the CloudDiskRdbStore::GetAttr function
182  * @tc.type: FUNC
183  * @tc.require: SR000HRKKA
184  */
185 HWTEST_F(CloudDiskRdbStoreTest, GetAttrTest2, TestSize.Level1)
186 {
187     const std::string cloudId = "rootId";
188     const std::string parentCloudId = "123456";
189     const std::string fileName = "LookUpTest";
190     const std::string bundleName = "InitRootIdTest";
191     const int32_t userId = 123456789;
192     CloudDiskFileInfo info;
193     info.name = "test.txt";
194     info.cloudId = "rootId";
195     info.parentCloudId = "22222";
196     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
197     int32_t ret = CloudDiskRdbStore.GetAttr(cloudId, info);
198     EXPECT_EQ(ret, E_RDB);
199 }
200 
201 /**
202  * @tc.name: GetAttr
203  * @tc.desc: Verify the CloudDiskRdbStore::GetAttr function
204  * @tc.type: FUNC
205  * @tc.require: SR000HRKKA
206  */
207 HWTEST_F(CloudDiskRdbStoreTest, GetAttrTest3, TestSize.Level1)
208 {
209     const std::string cloudId = "100";
210     const std::string bundleName = "com.ohos.photos";
211     const int32_t userId = 100;
212     CloudDiskFileInfo info;
213     info.name = "test.txt";
214     info.cloudId = "1223456";
215     info.parentCloudId = "22222";
216     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
217     int32_t ret = CloudDiskRdbStore.GetAttr(cloudId, info);
218     EXPECT_EQ(ret, E_RDB);
219 }
220 
221 /**
222  * @tc.name: SetAttr
223  * @tc.desc: Verify the CloudDiskRdbStore::SetAttr function
224  * @tc.type: FUNC
225  * @tc.require: SR000HRKKA
226  */
227 HWTEST_F(CloudDiskRdbStoreTest, SetAttrTest1, TestSize.Level1)
228 {
229     const std::string fileName = "Test";
230     const std::string parentCloudId = "100";
231     const std::string cloudId = "";
232     const unsigned long long size = 0;
233     const std::string bundleName = "com.ohos.photos";
234     const int32_t userId = 100;
235     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
236     int32_t ret = CloudDiskRdbStore.SetAttr(fileName, parentCloudId, cloudId, size);
237     EXPECT_EQ(ret, E_RDB);
238 }
239 
240 /**
241  * @tc.name: SetAttr
242  * @tc.desc: Verify the CloudDiskRdbStore::SetAttr function
243  * @tc.type: FUNC
244  * @tc.require: SR000HRKKA
245  */
246 HWTEST_F(CloudDiskRdbStoreTest, SetAttrTest2, TestSize.Level1)
247 {
248     const std::string fileName = "Test";
249     const std::string parentCloudId = "100";
250     const std::string cloudId = "rootId";
251     const unsigned long long size = 0;
252     const std::string bundleName = "com.ohos.photos";
253     const int32_t userId = 100;
254     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
255     int32_t ret = CloudDiskRdbStore.SetAttr(fileName, parentCloudId, cloudId, size);
256     EXPECT_EQ(ret, E_RDB);
257 }
258 
259 /**
260  * @tc.name: SetAttr
261  * @tc.desc: Verify the CloudDiskRdbStore::SetAttr function
262  * @tc.type: FUNC
263  * @tc.require: SR000HRKKA
264  */
265 HWTEST_F(CloudDiskRdbStoreTest, SetAttrTest3, TestSize.Level1)
266 {
267     const std::string fileName = "Test";
268     const std::string parentCloudId = "100";
269     const std::string cloudId = "100";
270     const unsigned long long size = 0;
271     const std::string bundleName = "com.ohos.photos";
272     const int32_t userId = 100;
273     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
274     int32_t ret = CloudDiskRdbStore.SetAttr(fileName, parentCloudId, cloudId, size);
275     EXPECT_EQ(ret, E_RDB);
276 }
277 
278 /**
279  * @tc.name: ReadDir
280  * @tc.desc: Verify the CloudDiskRdbStore::ReadDir function
281  * @tc.type: FUNC
282  * @tc.require: SR000HRKKA
283  */
284 HWTEST_F(CloudDiskRdbStoreTest, ReadDirTest1, TestSize.Level1)
285 {
286     const std::string cloudId = "rootId";
287     const std::string bundleName = "com.ohos.photos";
288     const int32_t userId = 100;
289     vector<CloudDiskFileInfo> infos;
290     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
291     int32_t ret = CloudDiskRdbStore.ReadDir(cloudId, infos);
292     EXPECT_EQ(ret, E_RDB);
293 }
294 
295 /**
296  * @tc.name: Create
297  * @tc.desc: Verify the CloudDiskRdbStore::Create function
298  * @tc.type: FUNC
299  * @tc.require: SR000HRKKA
300  */
301 HWTEST_F(CloudDiskRdbStoreTest, CreateTest1, TestSize.Level1)
302 {
303     const std::string cloudId = "";
304     const std::string parentCloudId = "3246213";
305     const std::string fileName = "test.txt";
306     const std::string filePath = "/data/test";
307     const std::string bundleName = "MkDirTest";
308     const int32_t userId = 123456789;
309     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
310     int32_t ret = CloudDiskRdbStore.Create(cloudId, parentCloudId, fileName);
311     EXPECT_EQ(ret, E_RDB);
312 }
313 
314 /**
315  * @tc.name: Create
316  * @tc.desc: Verify the CloudDiskRdbStore::Create function
317  * @tc.type: FUNC
318  * @tc.require: SR000HRKKA
319  */
320 HWTEST_F(CloudDiskRdbStoreTest, CreateTest2, TestSize.Level1)
321 {
322     const std::string cloudId = "123123";
323     const std::string parentCloudId = "";
324     const std::string fileName = "test.txt";
325     const std::string filePath = "/data/test";
326     const std::string bundleName = "MkDirTest";
327     const int32_t userId = 123456789;
328     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
329     int32_t ret = CloudDiskRdbStore.Create(cloudId, parentCloudId, fileName);
330     EXPECT_EQ(ret, E_RDB);
331 }
332 
333 /**
334  * @tc.name: Create
335  * @tc.desc: Verify the CloudDiskRdbStore::Create function
336  * @tc.type: FUNC
337  * @tc.require: SR000HRKKA
338  */
339 HWTEST_F(CloudDiskRdbStoreTest, CreateTest3, TestSize.Level1)
340 {
341     const std::string cloudId = "123123";
342     const std::string parentCloudId = "123456";
343     const std::string fileName = "";
344     const std::string filePath = "/data/test";
345     const std::string bundleName = "MkDirTest";
346     const int32_t userId = 123456789;
347     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
348     int32_t ret = CloudDiskRdbStore.Create(cloudId, parentCloudId, fileName);
349     EXPECT_EQ(ret, EINVAL);
350 }
351 
352 /**
353  * @tc.name: Create
354  * @tc.desc: Verify the CloudDiskRdbStore::Create function
355  * @tc.type: FUNC
356  * @tc.require: SR000HRKKA
357  */
358 HWTEST_F(CloudDiskRdbStoreTest, CreateTest4, TestSize.Level1)
359 {
360     const std::string cloudId = "123123";
361     const std::string parentCloudId = "123456";
362     const std::string fileName = "1.txt";
363     const std::string filePath = "/data/test";
364     const std::string bundleName = "MkDirTest";
365     const int32_t userId = 123456789;
366     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
367     int32_t ret = CloudDiskRdbStore.Create(cloudId, parentCloudId, fileName);
368     EXPECT_EQ(ret, E_RDB);
369 }
370 
371 /**
372  * @tc.name: MkDir
373  * @tc.desc: Verify the CloudDiskRdbStore::MkDir function
374  * @tc.type: FUNC
375  * @tc.require: SR000HRKKA
376  */
377 HWTEST_F(CloudDiskRdbStoreTest, MkDirTest1, TestSize.Level1)
378 {
379     const std::string cloudId = "100";
380     const std::string parentCloudId = "100";
381     const std::string directoryName = "";
382     const std::string bundleName = "com.ohos.photos";;
383     const int32_t userId = 100;
384     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
385     int32_t ret = CloudDiskRdbStore.MkDir(cloudId, parentCloudId, directoryName);
386     EXPECT_EQ(ret, EINVAL);
387 }
388 
389 /**
390  * @tc.name: MkDir
391  * @tc.desc: Verify the CloudDiskRdbStore::MkDir function
392  * @tc.type: FUNC
393  * @tc.require: SR000HRKKA
394  */
395 HWTEST_F(CloudDiskRdbStoreTest, MkDirTest2, TestSize.Level1)
396 {
397     const std::string cloudId = "100";
398     const std::string parentCloudId = "100";
399     const std::string directoryName = " test.txt";
400     const std::string bundleName = "com.ohos.photos";;
401     const int32_t userId = 100;
402     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
403     int32_t ret = CloudDiskRdbStore.MkDir(cloudId, parentCloudId, directoryName);
404     EXPECT_EQ(ret, EINVAL);
405 }
406 
407 /**
408  * @tc.name: MkDir
409  * @tc.desc: Verify the CloudDiskRdbStore::MkDir function
410  * @tc.type: FUNC
411  * @tc.require: SR000HRKKA
412  */
413 HWTEST_F(CloudDiskRdbStoreTest, MkDirTest3, TestSize.Level1)
414 {
415     const std::string cloudId = "";
416     const std::string parentCloudId = "100";
417     const std::string directoryName = "test.txt";
418     const std::string bundleName = "com.ohos.photos";;
419     const int32_t userId = 100;
420     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
421     int32_t ret = CloudDiskRdbStore.MkDir(cloudId, parentCloudId, directoryName);
422     EXPECT_EQ(ret, E_RDB);
423 }
424 
425 /**
426  * @tc.name: Write
427  * @tc.desc: Verify the CloudDiskRdbStore::Write function
428  * @tc.type: FUNC
429  * @tc.require: SR000HRKKA
430  */
431 HWTEST_F(CloudDiskRdbStoreTest, WriteTest1, TestSize.Level1)
432 {
433     const std::string cloudId = "nullptr";
434     const std::string bundleName = "WriteTest";
435     const std::string fileName = "file";
436     const std::string parentCloudId = "rootId";
437     const int32_t userId = 123456789;
438     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
439     int32_t ret = CloudDiskRdbStore.Write(fileName, parentCloudId, cloudId);
440     EXPECT_EQ(ret, E_RDB);
441 }
442 
443 /**
444  * @tc.name: Write
445  * @tc.desc: Verify the CloudDiskRdbStore::Write function
446  * @tc.type: FUNC
447  * @tc.require: SR000HRKKA
448  */
449 HWTEST_F(CloudDiskRdbStoreTest, WriteTest2, TestSize.Level1)
450 {
451     const std::string cloudId = "";
452     const std::string bundleName = "WriteTest";
453     const std::string fileName = "file";
454     const std::string parentCloudId = "rootId";
455     const int32_t userId = 123456789;
456     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
457     int32_t ret = CloudDiskRdbStore.Write(fileName, parentCloudId, cloudId);
458     EXPECT_EQ(ret, E_RDB);
459 }
460 
461 /**
462  * @tc.name: Write
463  * @tc.desc: Verify the CloudDiskRdbStore::Write function
464  * @tc.type: FUNC
465  * @tc.require: SR000HRKKA
466  */
467 HWTEST_F(CloudDiskRdbStoreTest, WriteTest3, TestSize.Level1)
468 {
469     const std::string cloudId = "rootId";
470     const std::string bundleName = "WriteTest";
471     const int32_t userId = 123456789;
472     const std::string fileName = "file";
473     const std::string parentCloudId = "rootId";
474     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
475     int32_t ret = CloudDiskRdbStore.Write(fileName, parentCloudId, cloudId);
476     EXPECT_EQ(ret, E_RDB);
477 }
478 
479 /**
480  * @tc.name: Write
481  * @tc.desc: Verify the CloudDiskRdbStore::Write function
482  * @tc.type: FUNC
483  * @tc.require: SR000HRKKA
484  */
485 HWTEST_F(CloudDiskRdbStoreTest, WriteTest4, TestSize.Level1)
486 {
487     const std::string cloudId = "123123";
488     const std::string filePath = "/data/test";
489     const std::string bundleName = "MkDirTest";
490     const std::string fileName = "test";
491     const std::string parentCloudId = "rootId";
492     const int32_t userId = 123456789;
493     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
494     int32_t ret = CloudDiskRdbStore.Write(fileName, parentCloudId, cloudId);
495     EXPECT_EQ(ret, E_RDB);
496 }
497 
498 /**
499  * @tc.name: LocationSetXattr
500  * @tc.desc: Verify the CloudDiskRdbStore::LocationSetXattr function
501  * @tc.type: FUNC
502  * @tc.require: SR000HRKKA
503  */
504 HWTEST_F(CloudDiskRdbStoreTest, LocationSetXattrTest1, TestSize.Level1)
505 {
506     const std::string name = "test";
507     const std::string parentCloudId = "100";
508     const std::string cloudId = "100";
509     const std::string value = "4";
510     const std::string bundleName = "com.ohos.photos";
511     const int32_t userId = 100;
512     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
513     int32_t ret = CloudDiskRdbStore.LocationSetXattr(name, parentCloudId, cloudId, value);
514     EXPECT_EQ(ret, E_RDB);
515 }
516 
517 /**
518  * @tc.name: LocationSetXattr
519  * @tc.desc: Verify the CloudDiskRdbStore::LocationSetXattr function
520  * @tc.type: FUNC
521  * @tc.require: SR000HRKKA
522  */
523 HWTEST_F(CloudDiskRdbStoreTest, LocationSetXattrTest2, TestSize.Level1)
524 {
525     const std::string name = "test";
526     const std::string parentCloudId = "100";
527     const std::string cloudId = "100";
528     const std::string value = "1";
529     const std::string bundleName = "com.ohos.photos";
530     const int32_t userId = 100;
531     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
532     int32_t ret = CloudDiskRdbStore.LocationSetXattr(name, parentCloudId, cloudId, value);
533     EXPECT_EQ(ret, E_RDB);
534 }
535 
536 /**
537  * @tc.name: GetRowId
538  * @tc.desc: Verify the CloudDiskRdbStore::GetRowId function
539  * @tc.type: FUNC
540  * @tc.require: SR000HRKKA
541  */
542 HWTEST_F(CloudDiskRdbStoreTest, GetRowIdTest1, TestSize.Level1)
543 {
544     const std::string cloudId = "100";
545     int64_t rowId = 100;
546     const std::string bundleName = "com.ohos.photos";
547     const int32_t userId = 100;
548     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
549     int32_t ret = CloudDiskRdbStore.GetRowId(cloudId, rowId);
550     EXPECT_EQ(ret, E_RDB);
551 }
552 
553 /**
554  * @tc.name: GetParentCloudId
555  * @tc.desc: Verify the CloudDiskRdbStore::GetParentCloudId function
556  * @tc.type: FUNC
557  * @tc.require: SR000HRKKA
558  */
559 HWTEST_F(CloudDiskRdbStoreTest, GetParentCloudIdTest1, TestSize.Level1)
560 {
561     const std::string cloudId = "100";
562     std::string parentCloudId = "100";
563     const std::string bundleName = "com.ohos.photos";
564     const int32_t userId = 100;
565     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
566     int32_t ret = CloudDiskRdbStore.GetParentCloudId(cloudId, parentCloudId);
567     EXPECT_EQ(ret, E_RDB);
568 }
569 
570 /**
571  * @tc.name: RecycleSetXattr
572  * @tc.desc: Verify the CloudDiskRdbStore::RecycleSetXattr function
573  * @tc.type: FUNC
574  * @tc.require: SR000HRKKA
575  */
576 HWTEST_F(CloudDiskRdbStoreTest, RecycleSetXattrTest1, TestSize.Level1)
577 {
578     const std::string name = "test";
579     const std::string parentCloudId = "100";
580     const std::string cloudId = "100";
581     const std::string value = "notnum";
582     const std::string bundleName = "com.ohos.photos";
583     const int32_t userId = 100;
584     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
585     int32_t ret = CloudDiskRdbStore.RecycleSetXattr(name, parentCloudId, cloudId, value);
586     EXPECT_EQ(ret, EINVAL);
587 }
588 
589 /**
590  * @tc.name: RecycleSetXattr
591  * @tc.desc: Verify the CloudDiskRdbStore::RecycleSetXattr function
592  * @tc.type: FUNC
593  * @tc.require: SR000HRKKA
594  */
595 HWTEST_F(CloudDiskRdbStoreTest, RecycleSetXattrTest2, TestSize.Level1)
596 {
597     const std::string name = "test";
598     const std::string parentCloudId = "100";
599     const std::string cloudId = "100";
600     const std::string value = "3";
601     const std::string bundleName = "com.ohos.photos";
602     const int32_t userId = 100;
603     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
604     int32_t ret = CloudDiskRdbStore.RecycleSetXattr(name, parentCloudId, cloudId, value);
605     EXPECT_EQ(ret, E_RDB);
606 }
607 
608 /**
609  * @tc.name: RecycleSetXattr
610  * @tc.desc: Verify the CloudDiskRdbStore::RecycleSetXattr function
611  * @tc.type: FUNC
612  * @tc.require: SR000HRKKA
613  */
614 HWTEST_F(CloudDiskRdbStoreTest, RecycleSetXattrTest3, TestSize.Level1)
615 {
616     const std::string name = "test";
617     const std::string parentCloudId = "100";
618     const std::string cloudId = "100";
619     const std::string value = "0";
620     const std::string bundleName = "com.ohos.photos";
621     const int32_t userId = 100;
622     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
623     int32_t ret = CloudDiskRdbStore.RecycleSetXattr(name, parentCloudId, cloudId, value);
624     EXPECT_EQ(ret, E_RDB);
625 }
626 
627 /**
628  * @tc.name: RecycleSetXattr
629  * @tc.desc: Verify the CloudDiskRdbStore::RecycleSetXattr function
630  * @tc.type: FUNC
631  * @tc.require: SR000HRKKA
632  */
633 HWTEST_F(CloudDiskRdbStoreTest, RecycleSetXattrTest4, TestSize.Level1)
634 {
635     const std::string name = "test";
636     const std::string parentCloudId = "100";
637     const std::string cloudId = "100";
638     const std::string value = "3";
639     const std::string bundleName = "com.ohos.photos";
640     const int32_t userId = 100;
641     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
642     int32_t ret = CloudDiskRdbStore.RecycleSetXattr(name, parentCloudId, cloudId, value);
643     EXPECT_EQ(ret, E_RDB);
644 }
645 
646 /**
647  * @tc.name: GetXAttr
648  * @tc.desc: Verify the CloudDiskRdbStore::GetXAttr function
649  * @tc.type: FUNC
650  * @tc.require: SR000HRKKA
651  */
652 HWTEST_F(CloudDiskRdbStoreTest, GetXAttrTest1, TestSize.Level1)
653 {
654     const std::string cloudId = "";
655     const std::string key = CLOUD_FILE_LOCATION;
656     std::string value = "";
657     CacheNode node;
658     node.fileName = "test";
659     node.parentCloudId = "100";
660     const std::string bundleName = "com.ohos.photos";
661     const int32_t userId = 100;
662     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
663     int32_t ret = CloudDiskRdbStore.GetXAttr(cloudId, key, value);
664     EXPECT_EQ(ret, E_OK);
665 }
666 
667 /**
668  * @tc.name: GetXAttr
669  * @tc.desc: Verify the CloudDiskRdbStore::GetXAttr function
670  * @tc.type: FUNC
671  * @tc.require: SR000HRKKA
672  */
673 HWTEST_F(CloudDiskRdbStoreTest, GetXAttrTest2, TestSize.Level1)
674 {
675     const std::string cloudId = "";
676     const std::string key = IS_FAVORITE_XATTR;
677     std::string value = "";
678     const std::string bundleName = "com.ohos.photos";
679     const int32_t userId = 100;
680     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
681     int32_t ret = CloudDiskRdbStore.GetXAttr(cloudId, key, value);
682     EXPECT_EQ(ret, E_RDB);
683 }
684 
685 /**
686  * @tc.name: GetXAttr
687  * @tc.desc: Verify the CloudDiskRdbStore::GetXAttr function
688  * @tc.type: FUNC
689  * @tc.require: SR000HRKKA
690  */
691 HWTEST_F(CloudDiskRdbStoreTest, GetXAttrTest3, TestSize.Level1)
692 {
693     const std::string cloudId = "";
694     const std::string key = IS_FILE_STATUS_XATTR;
695     std::string value = "";
696     const std::string bundleName = "com.ohos.photos";
697     const int32_t userId = 100;
698     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
699     int32_t ret = CloudDiskRdbStore.GetXAttr(cloudId, key, value);
700     EXPECT_EQ(ret, E_RDB);
701 }
702 
703 /**
704  * @tc.name: GetXAttr
705  * @tc.desc: Verify the CloudDiskRdbStore::GetXAttr function
706  * @tc.type: FUNC
707  * @tc.require: SR000HRKKA
708  */
709 HWTEST_F(CloudDiskRdbStoreTest, GetXAttrTest4, TestSize.Level1)
710 {
711     const std::string cloudId = "100";
712     const std::string key = CLOUD_CLOUD_RECYCLE_XATTR;
713     std::string value = "";
714     const std::string bundleName = "com.ohos.photos";
715     const int32_t userId = 100;
716     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
717     int32_t ret = CloudDiskRdbStore.GetXAttr(cloudId, key, value);
718     EXPECT_EQ(ret, E_INVAL_ARG);
719 }
720 
721 /**
722  * @tc.name: SetXAttr
723  * @tc.desc: Verify the CloudDiskRdbStore::SetXAttr function
724  * @tc.type: FUNC
725  * @tc.require: SR000HRKKA
726  */
727 HWTEST_F(CloudDiskRdbStoreTest, SetXAttrTest1, TestSize.Level1)
728 {
729     const std::string cloudId = "100";
730     const std::string key = CLOUD_FILE_LOCATION;
731     const std::string value = "notnum";
732     const std::string name = "test";
733     const std::string parentCloudId = "100";
734     const std::string bundleName = "com.ohos.photos";
735     const int32_t userId = 100;
736     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
737     int32_t ret = CloudDiskRdbStore.SetXAttr(cloudId, key, value, name, parentCloudId);
738     EXPECT_EQ(ret, E_RDB);
739 }
740 
741 /**
742  * @tc.name: SetXAttr
743  * @tc.desc: Verify the CloudDiskRdbStore::SetXAttr function
744  * @tc.type: FUNC
745  * @tc.require: SR000HRKKA
746  */
747 HWTEST_F(CloudDiskRdbStoreTest, SetXAttrTest2, TestSize.Level1)
748 {
749     const std::string cloudId = "100";
750     const std::string key = CLOUD_CLOUD_RECYCLE_XATTR;
751     const std::string value = "notnum";
752     const std::string name = "test";
753     const std::string parentCloudId = "100";
754     const std::string bundleName = "com.ohos.photos";
755     const int32_t userId = 100;
756     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
757     int32_t ret = CloudDiskRdbStore.SetXAttr(cloudId, key, value, name, parentCloudId);
758     EXPECT_EQ(ret, EINVAL);
759 }
760 
761 /**
762  * @tc.name: SetXAttr
763  * @tc.desc: Verify the CloudDiskRdbStore::SetXAttr function
764  * @tc.type: FUNC
765  * @tc.require: SR000HRKKA
766  */
767 HWTEST_F(CloudDiskRdbStoreTest, SetXAttrTest3, TestSize.Level1)
768 {
769     const std::string cloudId = "100";
770     const std::string key = IS_FAVORITE_XATTR;
771     const std::string value = "notnum";
772     const std::string name = "test";
773     const std::string parentCloudId = "100";
774     const std::string bundleName = "com.ohos.photos";
775     const int32_t userId = 100;
776     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
777     int32_t ret = CloudDiskRdbStore.SetXAttr(cloudId, key, value, name, parentCloudId);
778     EXPECT_EQ(ret, EINVAL);
779 }
780 
781 /**
782  * @tc.name: SetXAttr
783  * @tc.desc: Verify the CloudDiskRdbStore::SetXAttr function
784  * @tc.type: FUNC
785  * @tc.require: SR000HRKKA
786  */
787 HWTEST_F(CloudDiskRdbStoreTest, SetXAttrTest4, TestSize.Level1)
788 {
789     const std::string cloudId = "100";
790     const std::string key = IS_FILE_STATUS_XATTR;
791     const std::string value = "notnum";
792     const std::string name = "test";
793     const std::string parentCloudId = "100";
794     const std::string bundleName = "com.ohos.photos";
795     const int32_t userId = 100;
796     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
797     int32_t ret = CloudDiskRdbStore.SetXAttr(cloudId, key, value, name, parentCloudId);
798     EXPECT_EQ(ret, E_INVAL_ARG);
799 }
800 
801 /**
802  * @tc.name: Rename
803  * @tc.desc: Verify the CloudDiskRdbStore::Rename function
804  * @tc.type: FUNC
805  * @tc.require: SR000HRKKA
806  */
807 HWTEST_F(CloudDiskRdbStoreTest, RenameTest1, TestSize.Level1)
808 {
809     const std::string oldParentCloudId = "100";
810     const std::string oldFileName = "test";
811     const std::string newParentCloudId = "100";
812     const std::string newFileName = "";
813     const std::string bundleName = "com.ohos.photos";
814     const int32_t userId = 100;
815     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
816     int32_t ret = CloudDiskRdbStore.Rename(oldParentCloudId, oldFileName, newParentCloudId, newFileName);
817     EXPECT_EQ(ret, EINVAL);
818 }
819 
820 /**
821  * @tc.name: Rename
822  * @tc.desc: Verify the CloudDiskRdbStore::Rename function
823  * @tc.type: FUNC
824  * @tc.require: SR000HRKKA
825  */
826 HWTEST_F(CloudDiskRdbStoreTest, RenameTest2, TestSize.Level1)
827 {
828     const std::string oldParentCloudId = "100";
829     const std::string oldFileName = "";
830     const std::string newParentCloudId = "";
831     const std::string newFileName = "test";
832     const std::string bundleName = "com.ohos.photos";
833     const int32_t userId = 100;
834     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
835     int32_t ret = CloudDiskRdbStore.Rename(oldParentCloudId, oldFileName, newParentCloudId, newFileName);
836     EXPECT_EQ(ret, E_RDB);
837 }
838 
839 /**
840  * @tc.name: Rename
841  * @tc.desc: Verify the CloudDiskRdbStore::Rename function
842  * @tc.type: FUNC
843  * @tc.require: SR000HRKKA
844  */
845 HWTEST_F(CloudDiskRdbStoreTest, RenameTest3, TestSize.Level1)
846 {
847     const std::string oldParentCloudId = "100";
848     const std::string oldFileName = "test";
849     const std::string newParentCloudId = "100";
850     const std::string newFileName = " test";
851     const std::string bundleName = "com.ohos.photos";
852     const int32_t userId = 100;
853     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
854     int32_t ret = CloudDiskRdbStore.Rename(oldParentCloudId, oldFileName, newParentCloudId, newFileName);
855     EXPECT_EQ(ret, EINVAL);
856 }
857 
858 /**
859  * @tc.name: GetHasChild
860  * @tc.desc: Verify the CloudDiskRdbStore::GetHasChild function
861  * @tc.type: FUNC
862  * @tc.require: SR000HRKKA
863  */
864 HWTEST_F(CloudDiskRdbStoreTest, GetHasChildTest1, TestSize.Level1)
865 {
866     const std::string cloudId = "100";
867     bool hasChild = true;
868     const int32_t userId = 100;
869     const std::string bundleName = "com.ohos.photos";
870     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
871     int32_t ret = CloudDiskRdbStore.GetHasChild(cloudId, hasChild);
872     EXPECT_EQ(ret, E_RDB);
873 }
874 
875 /**
876  * @tc.name: UnlinkSynced
877  * @tc.desc: Verify the CloudDiskRdbStore::UnlinkSynced function
878  * @tc.type: FUNC
879  * @tc.require: SR000HRKKA
880  */
881 HWTEST_F(CloudDiskRdbStoreTest, UnlinkSyncedTest1, TestSize.Level1)
882 {
883     const std::string cloudId = "100";
884     const int32_t userId = 100;
885     const std::string bundleName = "com.ohos.photos";
886     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
887     int32_t ret = CloudDiskRdbStore.UnlinkSynced(cloudId);
888     EXPECT_EQ(ret, E_RDB);
889 }
890 
891 /**
892  * @tc.name: UnlinkLocal
893  * @tc.desc: Verify the CloudDiskRdbStore::UnlinkLocal function
894  * @tc.type: FUNC
895  * @tc.require: SR000HRKKA
896  */
897 HWTEST_F(CloudDiskRdbStoreTest, UnlinkLocalTest1, TestSize.Level1)
898 {
899     const std::string cloudId = "100";
900     const int32_t userId = 100;
901     const std::string bundleName = "com.ohos.photos";
902     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
903     int32_t ret = CloudDiskRdbStore.UnlinkLocal(cloudId);
904     EXPECT_EQ(ret, E_RDB);
905 }
906 
907 /**
908  * @tc.name: Unlink
909  * @tc.desc: Verify the CloudDiskRdbStore::Unlink function
910  * @tc.type: FUNC
911  * @tc.require: SR000HRKKA
912  */
913 HWTEST_F(CloudDiskRdbStoreTest, UnlinkTest1, TestSize.Level1)
914 {
915     std::string cloudId = "";
916     const int32_t position = LOCAL;
917     const int32_t userId = 100;
918     const std::string bundleName = "com.ohos.photos";
919     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
920     int32_t ret = CloudDiskRdbStore.Unlink(cloudId, position);
921     EXPECT_EQ(ret, E_RDB);
922 }
923 
924 /**
925  * @tc.name: Unlink
926  * @tc.desc: Verify the CloudDiskRdbStore::Unlink function
927  * @tc.type: FUNC
928  * @tc.require: SR000HRKKA
929  */
930 HWTEST_F(CloudDiskRdbStoreTest, UnlinkTest2, TestSize.Level1)
931 {
932     const int32_t position = LOCAL;
933     std::string cloudId = "100";
934     const int32_t userId = 100;
935     const std::string bundleName = "com.ohos.photos";
936     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
937     int32_t ret = CloudDiskRdbStore.Unlink(cloudId, position);
938     EXPECT_EQ(ret, E_RDB);
939 }
940 
941 /**
942  * @tc.name: Unlink
943  * @tc.desc: Verify the CloudDiskRdbStore::Unlink function
944  * @tc.type: FUNC
945  * @tc.require: SR000HRKKA
946  */
947 HWTEST_F(CloudDiskRdbStoreTest, UnlinkTest3, TestSize.Level1)
948 {
949     const int32_t position = CLOUD;
950     std::string cloudId = "100";
951     const int32_t userId = 100;
952     const std::string bundleName = "com.ohos.photos";
953     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
954     int32_t ret = CloudDiskRdbStore.Unlink(cloudId, position);
955     EXPECT_EQ(ret, E_RDB);
956 }
957 
958 /**
959  * @tc.name: GetCurNode
960  * @tc.desc: Verify the CloudDiskRdbStore::GetCurNode function
961  * @tc.type: FUNC
962  * @tc.require: SR000HRKKA
963  */
964 HWTEST_F(CloudDiskRdbStoreTest, GetCurNodeTest1, TestSize.Level1)
965 {
966     CacheNode curNode;
967     std::string cloudId = "";
968     const int32_t userId = 100;
969     const std::string bundleName = "com.ohos.photos";
970     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
971     int32_t ret = CloudDiskRdbStore.GetCurNode(cloudId, curNode);
972     EXPECT_EQ(ret, E_RDB);
973 }
974 
975 /**
976  * @tc.name: GetCurNode
977  * @tc.desc: Verify the CloudDiskRdbStore::GetCurNode function
978  * @tc.type: FUNC
979  * @tc.require: SR000HRKKA
980  */
981 HWTEST_F(CloudDiskRdbStoreTest, GetCurNodeTest2, TestSize.Level1)
982 {
983     CacheNode curNode;
984     std::string cloudId = "100";
985     const int32_t userId = 100;
986     const std::string bundleName = "com.ohos.photos";
987     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
988     int32_t ret = CloudDiskRdbStore.GetCurNode(cloudId, curNode);
989     EXPECT_EQ(ret, E_RDB);
990 }
991 
992 /**
993  * @tc.name: GetParentNode
994  * @tc.desc: Verify the CloudDiskRdbStore::GetParentNode function
995  * @tc.type: FUNC
996  * @tc.require: SR000HRKKA
997  */
998 HWTEST_F(CloudDiskRdbStoreTest, GetParentNodeTest1, TestSize.Level1)
999 {
1000     const std::string parentCloudId = "";
1001     std::string nextCloudId = "100";
1002     std::string fileName = "test";
1003     const int32_t userId = 100;
1004     const std::string bundleName = "com.ohos.photos";
1005     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1006     int32_t ret = CloudDiskRdbStore.GetParentNode(parentCloudId, nextCloudId, fileName);
1007     EXPECT_EQ(ret, E_RDB);
1008 }
1009 
1010 /**
1011  * @tc.name: GetParentNode
1012  * @tc.desc: Verify the CloudDiskRdbStore::GetParentNode function
1013  * @tc.type: FUNC
1014  * @tc.require: SR000HRKKA
1015  */
1016 HWTEST_F(CloudDiskRdbStoreTest, GetParentNodeTest2, TestSize.Level1)
1017 {
1018     const std::string parentCloudId = "100";
1019     std::string nextCloudId = "100";
1020     std::string fileName = "test";
1021     const int32_t userId = 100;
1022     const std::string bundleName = "com.ohos.photos";
1023     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1024     int32_t ret = CloudDiskRdbStore.GetParentNode(parentCloudId, nextCloudId, fileName);
1025     EXPECT_EQ(ret, E_RDB);
1026 }
1027 
1028 /**
1029  * @tc.name: GetUriFromDB
1030  * @tc.desc: Verify the CloudDiskRdbStore::GetUriFromDB function
1031  * @tc.type: FUNC
1032  * @tc.require: SR000HRKKA
1033  */
1034 HWTEST_F(CloudDiskRdbStoreTest, GetUriFromDBTest1, TestSize.Level1)
1035 {
1036     const std::string parentCloudId = "";
1037     std::string uri = "100";
1038     const int32_t userId = 100;
1039     const std::string bundleName = "com.ohos.photos";
1040     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1041     int32_t ret = CloudDiskRdbStore.GetUriFromDB(parentCloudId, uri);
1042     EXPECT_EQ(ret, E_OK);
1043 }
1044 
1045 /**
1046  * @tc.name: GetUriFromDB
1047  * @tc.desc: Verify the CloudDiskRdbStore::GetUriFromDB function
1048  * @tc.type: FUNC
1049  * @tc.require: SR000HRKKA
1050  */
1051 HWTEST_F(CloudDiskRdbStoreTest, GetUriFromDBTest2, TestSize.Level1)
1052 {
1053     const std::string parentCloudId = "100";
1054     std::string uri = "100";
1055     const int32_t userId = 100;
1056     const std::string bundleName = "com.ohos.photos";
1057     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1058     int32_t ret = CloudDiskRdbStore.GetUriFromDB(parentCloudId, uri);
1059     EXPECT_EQ(ret, E_RDB);
1060 }
1061 
1062 /**
1063  * @tc.name: GetNotifyUri
1064  * @tc.desc: Verify the CloudDiskRdbStore::GetNotifyUri function
1065  * @tc.type: FUNC
1066  * @tc.require: SR000HRKKA
1067  */
1068 HWTEST_F(CloudDiskRdbStoreTest, GetNotifyUriTest1, TestSize.Level1)
1069 {
1070     CacheNode cacheNode;
1071     std::string uri = "100";
1072     const int32_t userId = 100;
1073     const std::string bundleName = "com.ohos.photos";
1074     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1075     int32_t ret = CloudDiskRdbStore.GetNotifyUri(cacheNode, uri);
1076     EXPECT_EQ(ret, E_INVAL_ARG);
1077 }
1078 
1079 /**
1080  * @tc.name: GetNotifyData
1081  * @tc.desc: Verify the CloudDiskRdbStore::GetNotifyData function
1082  * @tc.type: FUNC
1083  * @tc.require: SR000HRKKA
1084  */
1085 HWTEST_F(CloudDiskRdbStoreTest, GetNotifyDataTest1, TestSize.Level1)
1086 {
1087     CacheNode cacheNode;
1088     NotifyData notifyData;
1089     const int32_t userId = 100;
1090     const std::string bundleName = "com.ohos.photos";
1091     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1092     int32_t ret = CloudDiskRdbStore.GetNotifyData(cacheNode, notifyData);
1093     EXPECT_EQ(ret, E_INVAL_ARG);
1094 }
1095 
1096 /**
1097  * @tc.name: FavoriteSetXattr
1098  * @tc.desc: Verify the CloudDiskRdbStore::FavoriteSetXattr function
1099  * @tc.type: FUNC
1100  * @tc.require: SR000HRKKA
1101  */
1102 HWTEST_F(CloudDiskRdbStoreTest, FavoriteSetXattrTest1, TestSize.Level1)
1103 {
1104     const std::string cloudId = "root";
1105     const std::string value = "notnum";
1106     const std::string bundleName = "com.ohos.photos";
1107     const int32_t userId = 100;
1108     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1109     int32_t ret = CloudDiskRdbStore.FavoriteSetXattr(cloudId, value);
1110     EXPECT_EQ(ret, EINVAL);
1111 }
1112 
1113 /**
1114  * @tc.name: FavoriteSetXattr
1115  * @tc.desc: Verify the CloudDiskRdbStore::FavoriteSetXattr function
1116  * @tc.type: FUNC
1117  * @tc.require: SR000HRKKA
1118  */
1119 HWTEST_F(CloudDiskRdbStoreTest, FavoriteSetXattrTest2, TestSize.Level1)
1120 {
1121     const std::string cloudId = "root";
1122     const std::string value = "0";
1123     const std::string bundleName = "com.ohos.photos";
1124     const int32_t userId = 100;
1125     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1126     int32_t ret = CloudDiskRdbStore.FavoriteSetXattr(cloudId, value);
1127     EXPECT_EQ(ret, E_RDB);
1128 }
1129 
1130 /**
1131  * @tc.name: FavoriteSetXattr
1132  * @tc.desc: Verify the CloudDiskRdbStore::FavoriteSetXattr function
1133  * @tc.type: FUNC
1134  * @tc.require: SR000HRKKA
1135  */
1136 HWTEST_F(CloudDiskRdbStoreTest, FavoriteSetXattrTest3, TestSize.Level1)
1137 {
1138     const std::string cloudId = "root";
1139     const std::string value = "1";
1140     const std::string bundleName = "com.ohos.photos";
1141     const int32_t userId = 100;
1142     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1143     int32_t ret = CloudDiskRdbStore.FavoriteSetXattr(cloudId, value);
1144     EXPECT_EQ(ret, E_RDB);
1145 }
1146 
1147 /**
1148  * @tc.name: FavoriteSetXattr
1149  * @tc.desc: Verify the CloudDiskRdbStore::FavoriteSetXattr function
1150  * @tc.type: FUNC
1151  * @tc.require: SR000HRKKA
1152  */
1153 HWTEST_F(CloudDiskRdbStoreTest, FavoriteSetXattrTest4, TestSize.Level1)
1154 {
1155     const std::string cloudId = "root";
1156     const std::string value = "2";
1157     const std::string bundleName = "com.ohos.photos";
1158     const int32_t userId = 100;
1159     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1160     int32_t ret = CloudDiskRdbStore.FavoriteSetXattr(cloudId, value);
1161     EXPECT_EQ(ret, E_RDB);
1162 }
1163 
1164 /**
1165  * @tc.name: LocationGetXattr
1166  * @tc.desc: Verify the CloudDiskRdbStore::LocationGetXattr function
1167  * @tc.type: FUNC
1168  * @tc.require: SR000HRKKA
1169  */
1170 HWTEST_F(CloudDiskRdbStoreTest, LocationGetXattrTest1, TestSize.Level1)
1171 {
1172     const std::string cloudId = "";
1173     const std::string key = IS_FAVORITE_XATTR;
1174     std::string value = "";
1175     const std::string bundleName = "com.ohos.photos";
1176     const std::string name = "test";
1177     const std::string parentCloudId = "rootId";
1178     const int32_t userId = 100;
1179     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1180     int32_t ret = CloudDiskRdbStore.LocationGetXattr(name, key, value, parentCloudId);
1181     EXPECT_EQ(ret, E_INVAL_ARG);
1182 }
1183 
1184 /**
1185  * @tc.name: LocationGetXattr
1186  * @tc.desc: Verify the CloudDiskRdbStore::LocationGetXattr function
1187  * @tc.type: FUNC
1188  * @tc.require: SR000HRKKA
1189  */
1190 HWTEST_F(CloudDiskRdbStoreTest, LocationGetXattrTest2, TestSize.Level1)
1191 {
1192     const std::string cloudId = "";
1193     const std::string key = CLOUD_FILE_LOCATION;
1194     std::string value = "";
1195     const std::string bundleName = "com.ohos.photos";
1196     const std::string name = "test";
1197     const std::string parentCloudId = "rootId";
1198     const int32_t userId = 100;
1199     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1200     int32_t ret = CloudDiskRdbStore.LocationGetXattr(name, key, value, parentCloudId);
1201     EXPECT_EQ(ret, E_OK);
1202 }
1203 
1204 /**
1205  * @tc.name: FavoriteGetXattr
1206  * @tc.desc: Verify the CloudDiskRdbStore::FavoriteGetXattr function
1207  * @tc.type: FUNC
1208  * @tc.require: SR000HRKKA
1209  */
1210 HWTEST_F(CloudDiskRdbStoreTest, FavoriteGetXattrTest1, TestSize.Level1)
1211 {
1212     const std::string cloudId = "";
1213     const std::string key = CLOUD_FILE_LOCATION;
1214     std::string value = "";
1215     const std::string bundleName = "com.ohos.photos";
1216     const int32_t userId = 100;
1217     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1218     int32_t ret = CloudDiskRdbStore.FavoriteGetXattr(cloudId, key, value);
1219     EXPECT_EQ(ret, E_RDB);
1220 }
1221 
1222 /**
1223  * @tc.name: FavoriteGetXattr
1224  * @tc.desc: Verify the CloudDiskRdbStore::FavoriteGetXattr function
1225  * @tc.type: FUNC
1226  * @tc.require: SR000HRKKA
1227  */
1228 HWTEST_F(CloudDiskRdbStoreTest, FavoriteGetXattrTest2, TestSize.Level1)
1229 {
1230     const std::string cloudId = "cloudId";
1231     const std::string key = IS_FAVORITE_XATTR;
1232     std::string value = "";
1233     const std::string bundleName = "com.ohos.photos";
1234     const int32_t userId = 100;
1235     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1236     int32_t ret = CloudDiskRdbStore.FavoriteGetXattr(cloudId, key, value);
1237     EXPECT_EQ(ret, E_RDB);
1238 }
1239 
1240 /**
1241  * @tc.name: FileStatusGetXattr
1242  * @tc.desc: Verify the CloudDiskRdbStore::FileStatusGetXattr function
1243  * @tc.type: FUNC
1244  * @tc.require: SR000HRKKA
1245  */
1246 HWTEST_F(CloudDiskRdbStoreTest, FileStatusGetXattrTest1, TestSize.Level1)
1247 {
1248     const std::string cloudId = "";
1249     const std::string key = IS_FAVORITE_XATTR;
1250     std::string value = "";
1251     const std::string bundleName = "com.ohos.photos";
1252     const int32_t userId = 100;
1253     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1254     int32_t ret = CloudDiskRdbStore.FileStatusGetXattr(cloudId, key, value);
1255     EXPECT_EQ(ret, E_RDB);
1256 }
1257 
1258 /**
1259  * @tc.name: FileStatusGetXattr
1260  * @tc.desc: Verify the CloudDiskRdbStore::FileStatusGetXattr function
1261  * @tc.type: FUNC
1262  * @tc.require: SR000HRKKA
1263  */
1264 HWTEST_F(CloudDiskRdbStoreTest, FileStatusGetXattrTest2, TestSize.Level1)
1265 {
1266     const std::string cloudId = "cloudId";
1267     const std::string key = IS_FILE_STATUS_XATTR;
1268     std::string value = "";
1269     const std::string bundleName = "com.ohos.photos";
1270     const int32_t userId = 100;
1271     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1272     int32_t ret = CloudDiskRdbStore.FileStatusGetXattr(cloudId, key, value);
1273     EXPECT_EQ(ret, E_RDB);
1274 }
1275 
1276 /**
1277  * @tc.name: OnUpgrade
1278  * @tc.desc: Verify the CloudDiskRdbStore::OnUpgrade function
1279  * @tc.type: FUNC
1280  * @tc.require: SR000HRKKA
1281  */
1282 HWTEST_F(CloudDiskRdbStoreTest, OnUpgradeTest1, TestSize.Level1)
1283 {
1284     RdbStoreMock store;
1285     int32_t oldVersion = 8;
1286     int32_t newVersion = 9;
1287     const std::string bundleName = "com.ohos.photos";
1288     const int32_t userId = 100;
1289     CloudDiskDataCallBack CloudDiskDataCallBack;
1290     int32_t ret = CloudDiskDataCallBack.OnUpgrade(store, oldVersion, newVersion);
1291     EXPECT_EQ(ret, E_OK);
1292 }
1293 
1294 /**
1295  * @tc.name: OnUpgrade
1296  * @tc.desc: Verify the CloudDiskRdbStore::OnUpgrade function
1297  * @tc.type: FUNC
1298  */
1299 HWTEST_F(CloudDiskRdbStoreTest, OnUpgradeTest2, TestSize.Level1)
1300 {
1301     RdbStoreMock store;
1302     int32_t oldVersion = 11;
1303     int32_t newVersion = 12;
1304     const std::string bundleName = "com.ohos.photos";
1305     const int32_t userId = 100;
1306     CloudDiskDataCallBack CloudDiskDataCallBack;
1307     int32_t ret = CloudDiskDataCallBack.OnUpgrade(store, oldVersion, newVersion);
1308     EXPECT_EQ(ret, E_OK);
1309 }
1310 
1311 /**
1312  * @tc.name: ExtAttributeSetXattr
1313  * @tc.desc: Verify the CloudDiskRdbStore::ExtAttributeSetXattr function
1314  * @tc.type: FUNC
1315  */
1316 HWTEST_F(CloudDiskRdbStoreTest, ExtAttributeSetXattrTest1, TestSize.Level1)
1317 {
1318     const std::string cloudId = "root";
1319     const std::string key = "user.cloud.test1";
1320     const std::string value = "1";
1321     const std::string bundleName = "com.ohos.photos";
1322     const int32_t userId = 100;
1323     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1324     int32_t ret = CloudDiskRdbStore.ExtAttributeSetXattr(cloudId, value, key);
1325     EXPECT_EQ(ret, E_RDB);
1326 }
1327 
1328 /**
1329  * @tc.name: GetExtAttrValue
1330  * @tc.desc: Verify the CloudDiskRdbStore::ExtAttributeSetXattr function
1331  * @tc.type: FUNC
1332  */
1333 HWTEST_F(CloudDiskRdbStoreTest, GetExtAttrValueTest1, TestSize.Level1)
1334 {
1335     const std::string cloudId = "root";
1336     const std::string key = "user.cloud.test2";
1337     std::string value = "";
1338     const std::string bundleName = "com.ohos.photos";
1339     const int32_t userId = 100;
1340     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1341     int32_t ret = CloudDiskRdbStore.GetExtAttrValue(cloudId, key, value);
1342     EXPECT_EQ(ret, E_RDB);
1343 }
1344 
1345 /**
1346  * @tc.name: GetExtAttr
1347  * @tc.desc: Verify the CloudDiskRdbStore::ExtAttributeSetXattr function
1348  * @tc.type: FUNC
1349  */
1350 HWTEST_F(CloudDiskRdbStoreTest, GetExtAttrTest1, TestSize.Level1)
1351 {
1352     const std::string cloudId = "root";
1353     std::string value = "";
1354     const std::string bundleName = "com.ohos.photos";
1355     const int32_t userId = 100;
1356     int32_t pos = 0;
1357     CloudDiskRdbStore CloudDiskRdbStore(bundleName, userId);
1358     int32_t ret = CloudDiskRdbStore.GetExtAttr(cloudId, value, pos);
1359     EXPECT_EQ(ret, E_RDB);
1360 }
1361 } // namespace OHOS::FileManagement::CloudDisk::Test