|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include <gmock/gmock.h> |
| 23 | +#include <gtest/gtest.h> |
| 24 | + |
| 25 | +#include "iceberg/catalog.h" |
| 26 | + |
| 27 | +namespace iceberg { |
| 28 | + |
| 29 | +class MockCatalog : public Catalog { |
| 30 | + public: |
| 31 | + MockCatalog() = default; |
| 32 | + ~MockCatalog() override = default; |
| 33 | + |
| 34 | + MOCK_METHOD(std::string_view, name, (), (const, override)); |
| 35 | + |
| 36 | + MOCK_METHOD(Status, CreateNamespace, |
| 37 | + (const Namespace&, (const std::unordered_map<std::string, std::string>&)), |
| 38 | + (override)); |
| 39 | + |
| 40 | + MOCK_METHOD((Result<std::vector<Namespace>>), ListNamespaces, (const Namespace&), |
| 41 | + (const, override)); |
| 42 | + |
| 43 | + MOCK_METHOD((Result<std::unordered_map<std::string, std::string>>), |
| 44 | + GetNamespaceProperties, (const Namespace&), (const, override)); |
| 45 | + |
| 46 | + MOCK_METHOD(Status, UpdateNamespaceProperties, |
| 47 | + (const Namespace&, (const std::unordered_map<std::string, std::string>&), |
| 48 | + (const std::unordered_set<std::string>&)), |
| 49 | + (override)); |
| 50 | + |
| 51 | + MOCK_METHOD(Status, DropNamespace, (const Namespace&), (override)); |
| 52 | + |
| 53 | + MOCK_METHOD(Result<bool>, NamespaceExists, (const Namespace&), (const, override)); |
| 54 | + |
| 55 | + MOCK_METHOD((Result<std::vector<TableIdentifier>>), ListTables, (const Namespace&), |
| 56 | + (const, override)); |
| 57 | + |
| 58 | + MOCK_METHOD((Result<std::unique_ptr<Table>>), CreateTable, |
| 59 | + (const TableIdentifier&, const Schema&, const PartitionSpec&, |
| 60 | + const std::string&, (const std::unordered_map<std::string, std::string>&)), |
| 61 | + (override)); |
| 62 | + |
| 63 | + MOCK_METHOD((Result<std::unique_ptr<Table>>), UpdateTable, |
| 64 | + (const TableIdentifier&, |
| 65 | + (const std::vector<std::unique_ptr<UpdateRequirement>>&), |
| 66 | + (const std::vector<std::unique_ptr<MetadataUpdate>>&)), |
| 67 | + (override)); |
| 68 | + |
| 69 | + MOCK_METHOD((Result<std::shared_ptr<Transaction>>), StageCreateTable, |
| 70 | + (const TableIdentifier&, const Schema&, const PartitionSpec&, |
| 71 | + const std::string&, (const std::unordered_map<std::string, std::string>&)), |
| 72 | + (override)); |
| 73 | + |
| 74 | + MOCK_METHOD(Result<bool>, TableExists, (const TableIdentifier&), (const, override)); |
| 75 | + |
| 76 | + MOCK_METHOD(Status, DropTable, (const TableIdentifier&, bool), (override)); |
| 77 | + |
| 78 | + MOCK_METHOD((Result<std::unique_ptr<Table>>), LoadTable, (const TableIdentifier&), |
| 79 | + (override)); |
| 80 | + |
| 81 | + MOCK_METHOD((Result<std::shared_ptr<Table>>), RegisterTable, |
| 82 | + (const TableIdentifier&, const std::string&), (override)); |
| 83 | + |
| 84 | + MOCK_METHOD((std::unique_ptr<TableBuilder>), BuildTable, |
| 85 | + (const TableIdentifier&, const Schema&), (const, override)); |
| 86 | +}; |
| 87 | + |
| 88 | +} // namespace iceberg |
0 commit comments