• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #ifndef MOCK_SINGLE_VER_KV_SYNCER_H
17 #define MOCK_SINGLE_VER_KV_SYNCER_H
18 #include <gmock/gmock.h>
19 #include "single_ver_kv_syncer.h"
20 
21 namespace DistributedDB {
22 class MockSingleVerKVSyncer : public SingleVerKVSyncer {
23 public:
CallRecordTimeChangeOffset(void * changedOffset)24     void CallRecordTimeChangeOffset(void *changedOffset)
25     {
26         RecordTimeChangeOffset(changedOffset);
27     }
28 
CallQueryAutoSync(const InternalSyncParma & param)29     void CallQueryAutoSync(const InternalSyncParma &param)
30     {
31         SingleVerKVSyncer::QueryAutoSync(param);
32     }
33 
Init(ISyncEngine * engine,ISyncInterface * storage,bool init)34     void Init(ISyncEngine *engine, ISyncInterface *storage, bool init)
35     {
36         syncEngine_ = engine;
37         syncInterface_ = storage;
38         initialized_ = init;
39     }
40 
CallStatusCheck()41     int CallStatusCheck() const
42     {
43         return SingleVerKVSyncer::StatusCheck();
44     }
45 
SetMetadata(const std::shared_ptr<Metadata> & metadata)46     void SetMetadata(const std::shared_ptr<Metadata> &metadata)
47     {
48         metadata_ = metadata;
49     }
50 
TestSyncerLock()51     void TestSyncerLock()
52     {
53         LOGD("begin get lock");
54         std::lock_guard<std::mutex> autoLock(syncerLock_);
55         LOGD("get lock success");
56     }
57 };
58 }
59 #endif // MOCK_SINGLE_VER_KV_SYNCER_H
60