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 #ifndef DISTRIBUTEDDB_INTERFACES_TRANSACTION_TESTCASE_H
16 #define DISTRIBUTEDDB_INTERFACES_TRANSACTION_TESTCASE_H
17 
18 #ifndef OMIT_MULTI_VER
19 #include <gtest/gtest.h>
20 #include "distributeddb_data_generate_unit_test.h"
21 #include "distributeddb_tools_unit_test.h"
22 
23 class DistributedDBInterfacesTransactionTestCase final {
24 public:
DistributedDBInterfacesTransactionTestCase()25     DistributedDBInterfacesTransactionTestCase() {};
~DistributedDBInterfacesTransactionTestCase()26     ~DistributedDBInterfacesTransactionTestCase() {};
27 
28     static void StartTransaction001(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
29 
30     static void StartTransaction002(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
31 
32     static void StartTransaction003(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
33 
34     static void StartTransaction004(DistributedDB::KvStoreDelegate *&kvDelegatePtr, const std::string &storeId,
35         bool localOnly, DistributedDB::KvStoreDelegateManager &mgr,
36         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
37 
38     static void StartTransaction005(DistributedDB::KvStoreDelegate *&kvDelegatePtr, const std::string &storeId,
39         bool localOnly, DistributedDB::KvStoreDelegateManager &mgr);
40 
41     static void Commit001(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
42 
43     static void Commit002(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
44 
45     static void Commit003(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
46         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
47 
48     static void Commit004(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
49         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
50 
51     static void Commit005(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
52         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
53 
54     static void Commit006(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
55         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
56 
57     static void Commit007(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
58         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
59 
60     static void Commit008(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
61         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
62 
63     static void RollBack001(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
64 
65     static void RollBack002(DistributedDB::KvStoreDelegate *&kvDelegatePtr);
66 
67     static void RollBack003(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
68         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
69 
70     static void RollBack004(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
71         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
72 
73     static void RollBack005(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
74         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
75 
76     static void RollBack006(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
77         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
78 
79     static void RollBack007(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
80         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
81 
82     static void RollBack008(DistributedDB::KvStoreDelegate *&kvDelegatePtr,
83         DistributedDB::KvStoreSnapshotDelegate *&snapshotDelegatePtr);
84 };
85 #endif // OMIT_MULTI_VER
86 #endif // DISTRIBUTEDDB_INTERFACES_TRANSACTION_TESTCASE_H
87