1/**
2 * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * \author guonix
17 * \date Nov 2020
18 * \brief
19 */
20#pragma once
21#include <gmock/gmock.h>
22#include "index/index_service.h"
23
24using namespace proxima::be;
25using namespace proxima::be::index;
26
27class MockSegment : public Segment {
28 public:
29 ~MockSegment() override = default;
30
31 MOCK_METHOD(size_t, doc_count, (), (const, override));
32
33 MOCK_METHOD(ForwardReaderPtr, get_forward_reader, (), (const, override));
34
35 MOCK_METHOD(ColumnReaderPtr, get_column_reader,
36 (const std::string &column_name), (const, override));
37
38 MOCK_METHOD(int, remove_column, (const std::string &column_name), (override));
39
40 MOCK_METHOD(int, add_column, (const meta::ColumnMetaPtr &column_meta),
41 (override));
42
43 MOCK_METHOD(int, knn_search,
44 (const std::string &column_name, const std::string &query,
45 const QueryParams &query_params, QueryResultList *results),
46 (override));
47 MOCK_METHOD(int, knn_search,
48 (const std::string &column_name, const std::string &query,
49 const QueryParams &query_params, uint32_t batch_count,
50 std::vector<QueryResultList> *results),
51 (override));
52 MOCK_METHOD(int, kv_search, (uint64_t primary_key, QueryResult *result),
53 (override));
54};
55