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
16 #include "data_handler.h"
17
18 #include <gtest/gtest.h>
19
20 #include "dfs_error.h"
21
22 namespace OHOS {
23 namespace FileManagement {
24 namespace CloudSync {
25 using namespace std;
26
27 constexpr int32_t TEST_NUM = 100;
28
DataHandler(int32_t userId,const string & bundleName,const std::string & table)29 DataHandler::DataHandler(int32_t userId, const string &bundleName, const std::string &table)
30 : cloudPrefImpl_(userId, bundleName, table)
31 {
32 }
33
GetNextCursor(DriveKit::DKQueryCursor & cursor)34 void DataHandler::GetNextCursor(DriveKit::DKQueryCursor &cursor) {}
35
SetTempStartCursor(const DriveKit::DKQueryCursor & cursor)36 void DataHandler::SetTempStartCursor(const DriveKit::DKQueryCursor &cursor) {}
37
GetTempStartCursor(DriveKit::DKQueryCursor & cursor)38 void DataHandler::GetTempStartCursor(DriveKit::DKQueryCursor &cursor) {}
39
SetTempNextCursor(const DriveKit::DKQueryCursor & cursor,bool isFinish)40 void DataHandler::SetTempNextCursor(const DriveKit::DKQueryCursor &cursor, bool isFinish) {}
41
GetBatchNo()42 int32_t DataHandler::GetBatchNo()
43 {
44 return batchNo_;
45 }
46
IsPullRecords()47 bool DataHandler::IsPullRecords()
48 {
49 return startCursor_.empty();
50 }
51
ClearCursor()52 void DataHandler::ClearCursor() {}
53
FinishPull(const int32_t batchNo)54 void DataHandler::FinishPull(const int32_t batchNo) {}
55
SetRecordSize(const int32_t recordSize)56 void DataHandler::SetRecordSize(const int32_t recordSize) {}
57
GetRecordSize()58 int32_t DataHandler::GetRecordSize()
59 {
60 return recordSize_;
61 }
62
GetCheckFlag()63 bool DataHandler::GetCheckFlag()
64 {
65 return isChecking_;
66 }
67
SetChecking()68 void DataHandler::SetChecking() {}
69
GetCheckRecords(std::vector<DriveKit::DKRecordId> & checkRecords,const std::shared_ptr<std::vector<DriveKit::DKRecord>> & records)70 int32_t DataHandler::GetCheckRecords(std::vector<DriveKit::DKRecordId> &checkRecords,
71 const std::shared_ptr<std::vector<DriveKit::DKRecord>> &records)
72 {
73 return E_OK;
74 }
75
GetFileModifiedRecords(vector<DriveKit::DKRecord> & records)76 int32_t DataHandler::GetFileModifiedRecords(vector<DriveKit::DKRecord> &records)
77 {
78 return E_OK;
79 }
80
OnModifyFdirtyRecords(const map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)81 int32_t DataHandler::OnModifyFdirtyRecords(const map<DriveKit::DKRecordId, DriveKit::DKRecordOperResult> &map)
82 {
83 return E_OK;
84 }
85
GetAssetsToDownload(std::vector<DriveKit::DKDownloadAsset> & outAssetsToDownload)86 int32_t DataHandler::GetAssetsToDownload(std::vector<DriveKit::DKDownloadAsset> &outAssetsToDownload)
87 {
88 return E_OK;
89 }
90
GetDownloadAsset(string cloudId,vector<DriveKit::DKDownloadAsset> & outAssetsToDownload)91 int32_t DataHandler::GetDownloadAsset(string cloudId, vector<DriveKit::DKDownloadAsset> &outAssetsToDownload)
92 {
93 return E_OK;
94 }
95
OnDownloadSuccess(const DriveKit::DKDownloadAsset & asset)96 int32_t DataHandler::OnDownloadSuccess(const DriveKit::DKDownloadAsset &asset)
97 {
98 return E_OK;
99 }
100
OnDownloadThumb(const std::map<DriveKit::DKDownloadAsset,DriveKit::DKDownloadResult> & resultMap)101 int32_t DataHandler::OnDownloadThumb(const std::map<DriveKit::DKDownloadAsset, DriveKit::DKDownloadResult> &resultMap)
102 {
103 return E_OK;
104 }
105
OnDownloadThumb(const DriveKit::DKDownloadAsset & asset)106 int32_t DataHandler::OnDownloadThumb(const DriveKit::DKDownloadAsset &asset)
107 {
108 return E_OK;
109 }
110
Clean(const int action)111 int32_t DataHandler::Clean(const int action)
112 {
113 return E_OK;
114 }
115
GetRetryRecords(std::vector<DriveKit::DKRecordId> & records)116 int32_t DataHandler::GetRetryRecords(std::vector<DriveKit::DKRecordId> &records)
117 {
118 if (recordSize_ == TEST_NUM) {
119 return 1;
120 }
121 return E_OK;
122 }
123
OnModifyMdirtyRecords(const map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)124 int32_t DataHandler::OnModifyMdirtyRecords(const map<DriveKit::DKRecordId, DriveKit::DKRecordOperResult> &map)
125 {
126 return E_OK;
127 }
128
OnDeleteRecords(const map<DriveKit::DKRecordId,DriveKit::DKRecordOperResult> & map)129 int32_t DataHandler::OnDeleteRecords(const map<DriveKit::DKRecordId, DriveKit::DKRecordOperResult> &map)
130 {
131 return E_OK;
132 }
133 } // namespace CloudSync
134 } // namespace FileManagement
135 } // namespace OHOS