1 /*
2  * Copyright (c) 2023 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 MOCK_ICLOUD_SYNC_STORAGE_INTERFACE_H
16 #define MOCK_ICLOUD_SYNC_STORAGE_INTERFACE_H
17 
18 #include <gmock/gmock.h>
19 #include "icloud_sync_storage_interface.h"
20 
21 namespace DistributedDB {
22 class MockICloudSyncStorageInterface : public ICloudSyncStorageInterface {
23 public:
24     MOCK_CONST_METHOD2(GetMetaData, int(const Key &, Value &));
25     MOCK_METHOD2(PutMetaData, int(const Key &, const Value &));
26     MOCK_METHOD1(ChkSchema, int(const TableName &));
27     MOCK_METHOD1(SetCloudDbSchema, int(const DataBaseSchema &));
28     MOCK_METHOD1(GetCloudDbSchema, int(std::shared_ptr<DataBaseSchema> &));
29     MOCK_METHOD2(GetCloudTableSchema, int(const TableName &, TableSchema &));
30     MOCK_METHOD1(StartTransaction, int(TransactType));
31     MOCK_METHOD0(Commit, int(void));
32     MOCK_METHOD0(Rollback, int(void));
33     MOCK_METHOD5(GetUploadCount, int(const QuerySyncObject &, const Timestamp &, bool, bool, int64_t &));
34     MOCK_METHOD5(GetAllUploadCount, int(const QuerySyncObject &, const std::vector<Timestamp> &, bool,
35         bool, int64_t &));
36     MOCK_METHOD5(GetCloudData, int(const TableSchema &, const QuerySyncObject &, const Timestamp &, ContinueToken &,
37         CloudSyncData &));
38     MOCK_METHOD2(GetCloudDataNext, int(ContinueToken &, CloudSyncData &));
39     MOCK_METHOD5(GetCloudGid, int(const TableSchema &, const QuerySyncObject &, bool, bool,
40         std::vector<std::string> &));
41     MOCK_METHOD1(ReleaseCloudDataToken, int(ContinueToken &));
42     MOCK_METHOD4(GetInfoByPrimaryKeyOrGid, int(const std::string &, const VBucket &, DataInfoWithLog &, VBucket &));
43     MOCK_METHOD2(PutCloudSyncData, int(const std::string &, DownloadData &));
44     MOCK_METHOD3(TriggerObserverAction, void(const std::string &, ChangedData &&, bool));
45     MOCK_METHOD4(CleanCloudData, int(ClearMode mode, const std::vector<std::string> &tableNameList,
46         const RelationalSchemaObject &localSchema, std::vector<Asset> &assets));
47     MOCK_METHOD3(FillCloudAssetForDownload, int(const std::string &, VBucket &, bool));
48     MOCK_METHOD1(SetLogTriggerStatus, int(bool));
49     MOCK_METHOD4(FillCloudLogAndAsset, int(OpType, const CloudSyncData &, bool, bool));
50     MOCK_CONST_METHOD0(GetIdentify, std::string());
51     MOCK_METHOD1(CheckQueryValid, int(const QuerySyncObject &));
52     MOCK_METHOD1(IsSharedTable, bool(const std::string &));
53     MOCK_CONST_METHOD0(GetCloudSyncConfig, CloudSyncConfig());
54 };
55 
56 }
57 #endif // #define MOCK_ICLOUD_SYNC_STORAGE_INTERFACE_H
58