1 /*
2  * Copyright (c) 2024 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 OHOS_DISTRIBUTEDDATA_SERVICE_TEST_GENERAL_WATCH_MOCK_H
16 #define OHOS_DISTRIBUTEDDATA_SERVICE_TEST_GENERAL_WATCH_MOCK_H
17 
18 #include "store/general_value.h"
19 #include "store/general_watcher.h"
20 
21 namespace OHOS::DistributedData {
22 class MockQuery : public GenQuery {
23 public:
24     ~MockQuery() = default;
25     static constexpr uint64_t TYPE_ID = 0x20000001;
26     std::vector<std::string> tables_;
27     bool lastResult = false;
28     bool IsEqual(uint64_t tid) override;
29 
30     std::vector<std::string> GetTables() override;
31 };
32 
33 class MockGeneralWatcher : public DistributedData::GeneralWatcher {
34 public:
35     int32_t OnChange(const Origin &origin, const PRIFields &primaryFields, ChangeInfo &&values) override;
36 
37     int32_t OnChange(const Origin &origin, const Fields &fields, ChangeData &&datas) override;
38 };
39 } // OHOS::DistributedData
40 #endif