• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 #include <gtest/gtest.h>
16 #include <string>
17 #include "distributeddb_nb_cursor_testcase.h"
18 #include "distributeddb_nb_test_tools.h"
19 #include "kv_store_delegate.h"
20 #include "kv_store_nb_delegate.h"
21 #include "kv_store_delegate_manager.h"
22 
23 using namespace testing;
24 #if defined TESTCASES_USING_GTEST_EXT
25 using namespace testing::ext;
26 #endif
27 using namespace std;
28 using namespace DistributedDB;
29 using namespace DistributedDBDataGenerator;
30 namespace DistributeddbNbCursor {
31 KvStoreNbDelegate *g_nbCursorDelegate = nullptr;
32 KvStoreDelegateManager *g_manager = nullptr;
33 class DistributeddbNbCursorTest : public testing::Test {
34 public:
35     static void SetUpTestCase(void);
36     static void TearDownTestCase(void);
37     void SetUp();
38     void TearDown();
39 private:
40 };
41 
SetUpTestCase(void)42 void DistributeddbNbCursorTest::SetUpTestCase(void)
43 {
44 }
45 
TearDownTestCase(void)46 void DistributeddbNbCursorTest::TearDownTestCase(void)
47 {
48 }
49 
SetUp(void)50 void DistributeddbNbCursorTest::SetUp(void)
51 {
52     RemoveDir(DistributedDBConstant::NB_DIRECTOR);
53 
54     UnitTest *test = UnitTest::GetInstance();
55     ASSERT_NE(test, nullptr);
56     const TestInfo *testinfo = test->current_test_info();
57     ASSERT_NE(testinfo, nullptr);
58     string testCaseName = string(testinfo->name());
59     MST_LOG("[SetUp] test case %s is start to run", testCaseName.c_str());
60 
61     g_nbCursorDelegate = DistributedDBNbTestTools::GetNbDelegateSuccess(g_manager, g_dbParameter1, g_option);
62     ASSERT_TRUE(g_manager != nullptr && g_nbCursorDelegate != nullptr);
63 }
64 
TearDown(void)65 void DistributeddbNbCursorTest::TearDown(void)
66 {
67     MST_LOG("TearDownTestCase after case.");
68     ASSERT_NE(g_manager, nullptr);
69     EXPECT_TRUE(EndCaseDeleteDB(g_manager, g_nbCursorDelegate, STORE_ID_1, g_option.isMemoryDb));
70     RemoveDir(DistributedDBConstant::NB_DIRECTOR);
71 }
72 
73 /*
74  * @tc.name: ResultSetDb 001
75  * @tc.desc: test GetCount, GetPosition, MoveToFirst, MoveToLast, IsFirst, IsLast, IsBeforeFirst and
76  *    IsAfterLast interfaces with little data.
77  * @tc.type: FUNC
78  * @tc.require: SR000D08KS
79  * @tc.author: fengxiaoyun
80  */
81 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb001, TestSize.Level1)
82 {
83     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
84     DistributeddbNbCursorTestcase::ResultSetDb001(g_nbCursorDelegate, false);
85 }
86 
87 /*
88  * @tc.name: ResultSetDb 002
89  * @tc.desc: test MoveToNext, MoveToPrevious interfaces with little data.
90  * @tc.type: FUNC
91  * @tc.require: SR000D08KS
92  * @tc.author: fengxiaoyun
93  */
94 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb002, TestSize.Level1)
95 {
96     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
97     DistributeddbNbCursorTestcase::ResultSetDb002(g_nbCursorDelegate, false);
98 }
99 
100 /*
101  * @tc.name: ResultSetDb 003
102  * @tc.desc: test Move interface with little data.
103  * @tc.type: FUNC
104  * @tc.require: SR000D08KS
105  * @tc.author: fengxiaoyun
106  */
107 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb003, TestSize.Level1)
108 {
109     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
110     DistributeddbNbCursorTestcase::ResultSetDb003(g_nbCursorDelegate, false);
111 }
112 
113 /*
114  * @tc.name: ResultSetDb 004
115  * @tc.desc: test MoveToPostions interfaces with little data.
116  * @tc.type: FUNC
117  * @tc.require: SR000D08KS
118  * @tc.author: fengxiaoyun
119  */
120 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb004, TestSize.Level1)
121 {
122     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
123     DistributeddbNbCursorTestcase::ResultSetDb004(g_nbCursorDelegate, false);
124 }
125 
126 /*
127  * @tc.name: ResultSetDb 005
128  * @tc.desc: test GetCount, GetPosition, MoveToFirst, MoveToLast, IsFirst, IsLast, IsBeforeFirst and
129  *    IsAfterLast interfaces with single 4M data.
130  * @tc.type: FUNC
131  * @tc.require: SR000D08KS
132  * @tc.author: fengxiaoyun
133  */
134 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb005, TestSize.Level1)
135 {
136     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
137     DistributeddbNbCursorTestcase::ResultSetDb005(g_nbCursorDelegate, false);
138 }
139 
140 /*
141  * @tc.name: ResultSetDb 006
142  * @tc.desc: test MoveToNext, MoveToPrevious interface with single 4M data.
143  * @tc.type: FUNC
144  * @tc.require: SR000D08KS
145  * @tc.author: fengxiaoyun
146  */
147 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb006, TestSize.Level1)
148 {
149     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
150     DistributeddbNbCursorTestcase::ResultSetDb006(g_nbCursorDelegate, false);
151 }
152 
153 /*
154  * @tc.name: ResultSetDb 007
155  * @tc.desc: test Move interface with single 4M data.
156  * @tc.type: FUNC
157  * @tc.require: SR000D08KS
158  * @tc.author: fengxiaoyun
159  */
160 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb007, TestSize.Level1)
161 {
162     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
163     DistributeddbNbCursorTestcase::ResultSetDb007(g_nbCursorDelegate, false);
164 }
165 
166 /*
167  * @tc.name: ResultSetDb 008
168  * @tc.desc: test MoveToPosition interface with single 4M data.
169  * @tc.type: FUNC
170  * @tc.require: SR000D08KS
171  * @tc.author: fengxiaoyun
172  */
173 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb008, TestSize.Level1)
174 {
175     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
176     DistributeddbNbCursorTestcase::ResultSetDb008(g_nbCursorDelegate, false);
177 }
178 
179 /*
180  * @tc.name: ResultSetDb 009
181  * @tc.desc: test GetCount, GetPosition, MoveToFirst, MoveToLast, IsFirst, IsLast, IsBeforeFirst and
182  *    IsAfterLast interfaces with 100 100k data.
183  * @tc.type: FUNC
184  * @tc.require: SR000D08KS
185  * @tc.author: fengxiaoyun
186  */
187 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb009, TestSize.Level2)
188 {
189     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
190     DistributeddbNbCursorTestcase::ResultSetDb009(g_nbCursorDelegate, false);
191 }
192 
193 /*
194  * @tc.name: ResultSetDb 010
195  * @tc.desc: test MoveToNext, MoveToPrevious interface with 100 100k data.
196  * @tc.type: FUNC
197  * @tc.require: SR000D08KS
198  * @tc.author: fengxiaoyun
199  */
200 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb010, TestSize.Level2)
201 {
202     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
203     DistributeddbNbCursorTestcase::ResultSetDb010(g_nbCursorDelegate, false);
204 }
205 
206 /*
207  * @tc.name: ResultSetDb 011
208  * @tc.desc: test Move interface with 100 100k data.
209  * @tc.type: FUNC
210  * @tc.require: SR000D08KS
211  * @tc.author: fengxiaoyun
212  */
213 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb011, TestSize.Level2)
214 {
215     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
216     DistributeddbNbCursorTestcase::ResultSetDb011(g_nbCursorDelegate, false);
217 }
218 
219 /*
220  * @tc.name: ResultSetDb 012
221  * @tc.desc: test MoveToPosition interface with 100 100k data.
222  * @tc.type: FUNC
223  * @tc.require: SR000D08KS
224  * @tc.author: fengxiaoyun
225  */
226 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb012, TestSize.Level2)
227 {
228     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
229     DistributeddbNbCursorTestcase::ResultSetDb012(g_nbCursorDelegate, false);
230 }
231 
232 /*
233  * @tc.name: ResultSetDb 013
234  * @tc.desc: test MoveToNext and Move interface can be called one record by one record.
235  * @tc.type: FUNC
236  * @tc.require: SR000D08KS
237  * @tc.author: fengxiaoyun
238  */
239 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb013, TestSize.Level2)
240 {
241     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
242     DistributeddbNbCursorTestcase::ResultSetDb013(g_nbCursorDelegate, false);
243 }
244 
245 /*
246  * @tc.name: ResultSetDb 014
247  * @tc.desc: test GetEntries that was not exist in db and if IsFirst, IsLast, MoveToFirst, MoveToLast, IsBeforeFirst
248  *    IsAfterLast, and MoveToPrevious, MoveToNext interface can return rightly.
249  * @tc.type: FUNC
250  * @tc.require: SR000D08KS
251  * @tc.author: fengxiaoyun
252  */
253 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb014, TestSize.Level1)
254 {
255     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
256     DistributeddbNbCursorTestcase::ResultSetDb014(g_nbCursorDelegate, false);
257 }
258 
259 /*
260  * @tc.name: ResultSetDb 015
261  * @tc.desc: test GetEntries that was not exist in db and if Move interface can return rightly.
262  * @tc.type: FUNC
263  * @tc.require: SR000D08KS
264  * @tc.author: fengxiaoyun
265  */
266 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb015, TestSize.Level1)
267 {
268     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
269     DistributeddbNbCursorTestcase::ResultSetDb015(g_nbCursorDelegate, false);
270 }
271 
272 /*
273  * @tc.name: ResultSetDb 016
274  * @tc.desc: test GetEntries that was not exist in db and if MoveToPosition interface can return rightly.
275  * @tc.type: FUNC
276  * @tc.require: SR000D08KS
277  * @tc.author: fengxiaoyun
278  */
279 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb016, TestSize.Level1)
280 {
281     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
282     DistributeddbNbCursorTestcase::ResultSetDb016(g_nbCursorDelegate, false);
283 }
284 
285 /*
286  * @tc.name: ResultSetDb 017
287  * @tc.desc: call CloseResultSet with nullptr returns INVALID_ARGS .
288  * @tc.type: FUNC
289  * @tc.require: SR000D08KS
290  * @tc.author: fengxiaoyun
291  */
292 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb017, TestSize.Level1)
293 {
294     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
295     DistributeddbNbCursorTestcase::ResultSetDb017(g_nbCursorDelegate, false);
296 }
297 
298 /*
299  * @tc.name: ResultSetDb 018
300  * @tc.desc: the count of remainder recordset don't change after close one.
301  * @tc.type: FUNC
302  * @tc.require: SR000D08KS
303  * @tc.author: fengxiaoyun
304  */
305 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb018, TestSize.Level1)
306 {
307     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
308     DistributeddbNbCursorTestcase::ResultSetDb018(g_nbCursorDelegate, false);
309 }
310 
311 /*
312  * @tc.name: ResultSetDb 019
313  * @tc.desc: append, delete, modify operation can change the count of recordset
314  * @tc.type: FUNC
315  * @tc.require: SR000D08KS
316  * @tc.author: fengxiaoyun
317  */
318 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb019, TestSize.Level2)
319 {
320     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
321     DistributeddbNbCursorTestcase::ResultSetDb019(g_nbCursorDelegate, false);
322 }
323 
324 /*
325  * @tc.name: ResultSetDb 020
326  * @tc.desc: GetEntries returns BUSY when the count of recordsets is equal or more than 5.
327  * @tc.type: FUNC
328  * @tc.require: SR000D08KS
329  * @tc.author: fengxiaoyun
330  */
331 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb020, TestSize.Level1)
332 {
333     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
334     DistributeddbNbCursorTestcase::ResultSetDb020(g_nbCursorDelegate, false);
335 }
336 
337 /*
338  * @tc.name: ResultSetDb 021
339  * @tc.desc: CloseKvStore returns BUSY before close all resultSet(s).
340  * @tc.type: FUNC
341  * @tc.require: SR000D08KS
342  * @tc.author: fengxiaoyun
343  */
344 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb021, TestSize.Level1)
345 {
346     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
347     DistributeddbNbCursorTestcase::ResultSetDb021(g_nbCursorDelegate, g_manager, false);
348 }
349 
350 #ifndef LOW_LEVEL_MEM_DEV
351 /*
352  * @tc.name: ResultSetDb 022
353  * @tc.desc: rekey returns BUSY when the size of recordset is larger than 4M
354  * @tc.type: FUNC
355  * @tc.require: SR000D08KS
356  * @tc.author: fengxiaoyun
357  */
358 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb022, TestSize.Level2)
359 {
360     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
361     DistributeddbNbCursorTestcase::ResultSetDb022(false);
362 }
363 #endif
364 
365 /*
366  * @tc.name: ResultSetDb 023
367  * @tc.desc: rekey returns OK when the size of recordset is equal to 4M
368  * @tc.type: FUNC
369  * @tc.require: SR000D08KS
370  * @tc.author: fengxiaoyun
371  */
372 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb023, TestSize.Level1)
373 {
374     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
375     DistributeddbNbCursorTestcase::ResultSetDb023(false);
376 }
377 
378 #ifndef LOW_LEVEL_MEM_DEV
379 /*
380  * @tc.name: ResultSetDb 024
381  * @tc.desc: GetEntries returns BUSY when Rekeying
382  * @tc.type: FUNC
383  * @tc.require: SR000D08KS
384  * @tc.author: fengxiaoyun
385  */
386 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb024, TestSize.Level3)
387 {
388     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
389     DistributeddbNbCursorTestcase::ResultSetDb024(false);
390 }
391 #endif
392 
393 /*
394  * @tc.name: ResultSetDb 025
395  * @tc.desc: Verify that multiple threads can call GetEntries() to get resultSet at the same time.
396  * @tc.type: FUNC
397  * @tc.require: SR000D08KS
398  * @tc.author: fengxiaoyun
399  */
400 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb025, TestSize.Level2)
401 {
402     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
403     DistributeddbNbCursorTestcase::ResultSetDb025(g_nbCursorDelegate, false);
404 }
405 
406 /*
407  * @tc.name: ResultSetDb 026
408  * @tc.desc: Verify that multiple threads can call GetEntries() to get the same resultSet at the same time.
409  * @tc.type: FUNC
410  * @tc.require: SR000D08KS
411  * @tc.author: fengxiaoyun
412  */
413 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb026, TestSize.Level2)
414 {
415     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
416     DistributeddbNbCursorTestcase::ResultSetDb026(g_nbCursorDelegate, false);
417 }
418 
419 /*
420  * @tc.name: ResultSetDb 027
421  * @tc.desc: the interfaces of different delegates opened by the same db doesn't affect each other.
422  * @tc.type: FUNC
423  * @tc.require: SR000D08KS
424  * @tc.author: fengxiaoyun
425  */
426 HWTEST_F(DistributeddbNbCursorTest, ResultSetDb027, TestSize.Level2)
427 {
428     // test with RESULT_SET_CACHE_MODE = CACHE_FULL_ENTRY.
429     DistributeddbNbCursorTestcase::ResultSetDb027(false);
430 }
431 
432 /*
433  * @tc.name: CacheRowIdTest 001
434  * @tc.desc: test GetCount, GetPosition, MoveToFirst, MoveToLast, IsFirst, IsLast, IsBeforeFirst and
435  *    IsAfterLast interfaces with little data.
436  * @tc.type: FUNC
437  * @tc.require: SR000F3L0Q
438  * @tc.author: fengxiaoyun
439  */
440 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest001, TestSize.Level1)
441 {
442     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
443     DistributeddbNbCursorTestcase::ResultSetDb001(g_nbCursorDelegate, true);
444 }
445 
446 /*
447  * @tc.name: CacheRowIdTest 002
448  * @tc.desc: test MoveToNext, MoveToPrevious interfaces with little data.
449  * @tc.type: FUNC
450  * @tc.require: SR000F3L0Q
451  * @tc.author: fengxiaoyun
452  */
453 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest002, TestSize.Level1)
454 {
455     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
456     DistributeddbNbCursorTestcase::ResultSetDb002(g_nbCursorDelegate, true);
457 }
458 
459 /*
460  * @tc.name: CacheRowIdTest 003
461  * @tc.desc: test Move interface with little data.
462  * @tc.type: FUNC
463  * @tc.require: SR000F3L0Q
464  * @tc.author: fengxiaoyun
465  */
466 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest003, TestSize.Level1)
467 {
468     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
469     DistributeddbNbCursorTestcase::ResultSetDb003(g_nbCursorDelegate, true);
470 }
471 
472 /*
473  * @tc.name: CacheRowIdTest 004
474  * @tc.desc: test MoveToPostions interfaces with little data.
475  * @tc.type: FUNC
476  * @tc.require: SR000F3L0Q
477  * @tc.author: fengxiaoyun
478  */
479 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest004, TestSize.Level1)
480 {
481     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
482     DistributeddbNbCursorTestcase::ResultSetDb004(g_nbCursorDelegate, true);
483 }
484 
485 /*
486  * @tc.name: CacheRowIdTest 005
487  * @tc.desc: test GetCount, GetPosition, MoveToFirst, MoveToLast, IsFirst, IsLast, IsBeforeFirst and
488  *    IsAfterLast interfaces with single 4M data.
489  * @tc.type: FUNC
490  * @tc.require: SR000F3L0Q
491  * @tc.author: fengxiaoyun
492  */
493 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest005, TestSize.Level1)
494 {
495     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
496     DistributeddbNbCursorTestcase::ResultSetDb005(g_nbCursorDelegate, true);
497 }
498 
499 /*
500  * @tc.name: CacheRowIdTest 006
501  * @tc.desc: test MoveToNext, MoveToPrevious interface with single 4M data.
502  * @tc.type: FUNC
503  * @tc.require: SR000F3L0Q
504  * @tc.author: fengxiaoyun
505  */
506 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest006, TestSize.Level1)
507 {
508     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
509     DistributeddbNbCursorTestcase::ResultSetDb006(g_nbCursorDelegate, true);
510 }
511 
512 /*
513  * @tc.name: CacheRowIdTest 007
514  * @tc.desc: test Move interface with single 4M data.
515  * @tc.type: FUNC
516  * @tc.require: SR000F3L0Q
517  * @tc.author: fengxiaoyun
518  */
519 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest007, TestSize.Level1)
520 {
521     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
522     DistributeddbNbCursorTestcase::ResultSetDb007(g_nbCursorDelegate, true);
523 }
524 
525 /*
526  * @tc.name: CacheRowIdTest 008
527  * @tc.desc: test MoveToPosition interface with single 4M data.
528  * @tc.type: FUNC
529  * @tc.require: SR000F3L0Q
530  * @tc.author: fengxiaoyun
531  */
532 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest008, TestSize.Level1)
533 {
534     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
535     DistributeddbNbCursorTestcase::ResultSetDb008(g_nbCursorDelegate, true);
536 }
537 
538 /*
539  * @tc.name: CacheRowIdTest 009
540  * @tc.desc: test GetCount, GetPosition, MoveToFirst, MoveToLast, IsFirst, IsLast, IsBeforeFirst and
541  *    IsAfterLast interfaces with 100 100k data.
542  * @tc.type: FUNC
543  * @tc.require: SR000F3L0Q
544  * @tc.author: fengxiaoyun
545  */
546 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest009, TestSize.Level2)
547 {
548     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
549     DistributeddbNbCursorTestcase::ResultSetDb009(g_nbCursorDelegate, true);
550 }
551 
552 /*
553  * @tc.name: CacheRowIdTest 010
554  * @tc.desc: test MoveToNext, MoveToPrevious interface with 100 100k data.
555  * @tc.type: FUNC
556  * @tc.require: SR000F3L0Q
557  * @tc.author: fengxiaoyun
558  */
559 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest010, TestSize.Level2)
560 {
561     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
562     DistributeddbNbCursorTestcase::ResultSetDb010(g_nbCursorDelegate, true);
563 }
564 
565 /*
566  * @tc.name: CacheRowIdTest 011
567  * @tc.desc: test Move interface with 100 100k data.
568  * @tc.type: FUNC
569  * @tc.require: SR000F3L0Q
570  * @tc.author: fengxiaoyun
571  */
572 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest011, TestSize.Level2)
573 {
574     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
575     DistributeddbNbCursorTestcase::ResultSetDb011(g_nbCursorDelegate, true);
576 }
577 
578 /*
579  * @tc.name: CacheRowIdTest 012
580  * @tc.desc: test MoveToPosition interface with 100 100k data.
581  * @tc.type: FUNC
582  * @tc.require: SR000F3L0Q
583  * @tc.author: fengxiaoyun
584  */
585 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest012, TestSize.Level2)
586 {
587     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
588     DistributeddbNbCursorTestcase::ResultSetDb012(g_nbCursorDelegate, true);
589 }
590 
591 /*
592  * @tc.name: CacheRowIdTest 013
593  * @tc.desc: test MoveToNext and Move interface can be called one record by one record.
594  * @tc.type: FUNC
595  * @tc.require: SR000F3L0Q
596  * @tc.author: fengxiaoyun
597  */
598 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest013, TestSize.Level2)
599 {
600     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
601     DistributeddbNbCursorTestcase::ResultSetDb013(g_nbCursorDelegate, true);
602 }
603 
604 /*
605  * @tc.name: CacheRowIdTest 014
606  * @tc.desc: test GetEntries that was not exist in db and if IsFirst, IsLast, MoveToFirst, MoveToLast, IsBeforeFirst
607  *    IsAfterLast, and MoveToPrevious, MoveToNext interface can return rightly.
608  * @tc.type: FUNC
609  * @tc.require: SR000F3L0Q
610  * @tc.author: fengxiaoyun
611  */
612 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest014, TestSize.Level1)
613 {
614     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
615     DistributeddbNbCursorTestcase::ResultSetDb014(g_nbCursorDelegate, true);
616 }
617 
618 /*
619  * @tc.name: CacheRowIdTest 015
620  * @tc.desc: test GetEntries that was not exist in db and if Move interface can return rightly.
621  * @tc.type: FUNC
622  * @tc.require: SR000F3L0Q
623  * @tc.author: fengxiaoyun
624  */
625 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest015, TestSize.Level1)
626 {
627     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
628     DistributeddbNbCursorTestcase::ResultSetDb015(g_nbCursorDelegate, true);
629 }
630 
631 /*
632  * @tc.name: CacheRowIdTest 016
633  * @tc.desc: test GetEntries that was not exist in db and if MoveToPosition interface can return rightly.
634  * @tc.type: FUNC
635  * @tc.require: SR000F3L0Q
636  * @tc.author: fengxiaoyun
637  */
638 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest016, TestSize.Level1)
639 {
640     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
641     DistributeddbNbCursorTestcase::ResultSetDb016(g_nbCursorDelegate, true);
642 }
643 
644 /*
645  * @tc.name: CacheRowIdTest 017
646  * @tc.desc: call CloseResultSet with nullptr returns INVALID_ARGS .
647  * @tc.type: FUNC
648  * @tc.require: SR000F3L0Q
649  * @tc.author: fengxiaoyun
650  */
651 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest017, TestSize.Level1)
652 {
653     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
654     DistributeddbNbCursorTestcase::ResultSetDb017(g_nbCursorDelegate, true);
655 }
656 
657 /*
658  * @tc.name: CacheRowIdTest 018
659  * @tc.desc: the count of remainder recordset don't change after close one.
660  * @tc.type: FUNC
661  * @tc.require: SR000F3L0Q
662  * @tc.author: fengxiaoyun
663  */
664 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest018, TestSize.Level1)
665 {
666     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
667     DistributeddbNbCursorTestcase::ResultSetDb018(g_nbCursorDelegate, true);
668 }
669 
670 /*
671  * @tc.name: CacheRowIdTest 019
672  * @tc.desc: append, delete, modify operation can change the count of recordset
673  * @tc.type: FUNC
674  * @tc.require: SR000F3L0Q
675  * @tc.author: fengxiaoyun
676  */
677 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest019, TestSize.Level2)
678 {
679     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
680     DistributeddbNbCursorTestcase::ResultSetDb019(g_nbCursorDelegate, true);
681 }
682 
683 /*
684  * @tc.name: CacheRowIdTest 020
685  * @tc.desc: GetEntries returns BUSY when the count of recordsets is equal or more than 5.
686  * @tc.type: FUNC
687  * @tc.require: SR000F3L0Q
688  * @tc.author: fengxiaoyun
689  */
690 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest020, TestSize.Level1)
691 {
692     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
693     DistributeddbNbCursorTestcase::ResultSetDb020(g_nbCursorDelegate, true);
694 }
695 
696 /*
697  * @tc.name: CacheRowIdTest 021
698  * @tc.desc: CloseKvStore returns BUSY before close all resultSet(s).
699  * @tc.type: FUNC
700  * @tc.require: SR000F3L0Q
701  * @tc.author: fengxiaoyun
702  */
703 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest021, TestSize.Level1)
704 {
705     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
706     DistributeddbNbCursorTestcase::ResultSetDb021(g_nbCursorDelegate, g_manager, true);
707 }
708 
709 #ifndef LOW_LEVEL_MEM_DEV
710 /*
711  * @tc.name: CacheRowIdTest 022
712  * @tc.desc: rekey returns BUSY when the size of recordset is larger than 4M
713  * @tc.type: FUNC
714  * @tc.require: SR000F3L0Q
715  * @tc.author: fengxiaoyun
716  */
717 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest022, TestSize.Level2)
718 {
719     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
720     DistributeddbNbCursorTestcase::ResultSetDb022(true);
721 }
722 #endif
723 
724 /*
725  * @tc.name: CacheRowIdTest 023
726  * @tc.desc: rekey returns OK when the size of recordset is equal to 4M
727  * @tc.type: FUNC
728  * @tc.require: SR000F3L0Q
729  * @tc.author: fengxiaoyun
730  */
731 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest023, TestSize.Level1)
732 {
733     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
734     DistributeddbNbCursorTestcase::ResultSetDb023(true);
735 }
736 
737 #ifndef LOW_LEVEL_MEM_DEV
738 /*
739  * @tc.name: CacheRowIdTest 024
740  * @tc.desc: GetEntries returns BUSY when Rekeying
741  * @tc.type: FUNC
742  * @tc.require: SR000F3L0Q
743  * @tc.author: fengxiaoyun
744  */
745 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest024, TestSize.Level3)
746 {
747     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
748     DistributeddbNbCursorTestcase::ResultSetDb024(true);
749 }
750 #endif
751 
752 /*
753  * @tc.name: CacheRowIdTest 025
754  * @tc.desc: Verify that multiple threads can call GetEntries() to get resultSet at the same time.
755  * @tc.type: FUNC
756  * @tc.require: SR000F3L0Q
757  * @tc.author: fengxiaoyun
758  */
759 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest025, TestSize.Level2)
760 {
761     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
762     DistributeddbNbCursorTestcase::ResultSetDb025(g_nbCursorDelegate, true);
763 }
764 
765 /*
766  * @tc.name: CacheRowIdTest 026
767  * @tc.desc: Verify that multiple threads can call GetEntries() to get the same resultSet at the same time.
768  * @tc.type: FUNC
769  * @tc.require: SR000F3L0Q
770  * @tc.author: fengxiaoyun
771  */
772 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest026, TestSize.Level2)
773 {
774     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
775     DistributeddbNbCursorTestcase::ResultSetDb026(g_nbCursorDelegate, true);
776 }
777 
778 /*
779  * @tc.name: CacheRowIdTest 027
780  * @tc.desc: the interfaces of different delegates opened by the same db doesn't affect each other.
781  * @tc.type: FUNC
782  * @tc.require: SR000F3L0Q
783  * @tc.author: fengxiaoyun
784  */
785 HWTEST_F(DistributeddbNbCursorTest, CacheRowIdTest027, TestSize.Level2)
786 {
787     // test with RESULT_SET_CACHE_MODE = CACHE_ENTRY_ID_ONLY.
788     DistributeddbNbCursorTestcase::ResultSetDb027(true);
789 }
790 }