Google Cloud Spanner C++ Client  1.32.0
A C++ Client Library for Google Cloud Spanner
mock_database_admin_connection.h
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
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 GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_MOCKS_MOCK_DATABASE_ADMIN_CONNECTION_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_MOCKS_MOCK_DATABASE_ADMIN_CONNECTION_H
17 
18 #include "google/cloud/spanner/database_admin_connection.h"
19 #include "google/cloud/spanner/version.h"
20 #include <gmock/gmock.h>
21 
22 namespace google {
23 namespace cloud {
24 namespace spanner_mocks {
25 inline namespace SPANNER_CLIENT_NS {
26 
27 /**
28  * A class to mock `google::cloud::spanner::DatabaseAdminConnection`.
29  *
30  * Application developers may want to test their code with simulated responses,
31  * including errors from a `spanner::DatabaseAdminClient`. To do so, construct a
32  * `spanner::DatabaseAdminClient` with an instance of this class. Then use the
33  * Google Test framework functions to program the behavior of this mock.
34  */
37  public:
38  MOCK_METHOD(future<StatusOr<google::spanner::admin::database::v1::Database>>,
39  CreateDatabase, (CreateDatabaseParams), (override));
40  MOCK_METHOD(StatusOr<google::spanner::admin::database::v1::Database>,
41  GetDatabase, (GetDatabaseParams), (override));
42  MOCK_METHOD(
43  StatusOr<google::spanner::admin::database::v1::GetDatabaseDdlResponse>,
44  GetDatabaseDdl, (GetDatabaseDdlParams), (override));
45  MOCK_METHOD(
46  future<StatusOr<
47  google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata>>,
48  UpdateDatabase, (UpdateDatabaseParams), (override));
49  MOCK_METHOD(Status, DropDatabase, (DropDatabaseParams), (override));
50  MOCK_METHOD(spanner::ListDatabaseRange, ListDatabases, (ListDatabasesParams),
51  (override));
52  MOCK_METHOD(future<StatusOr<google::spanner::admin::database::v1::Database>>,
53  RestoreDatabase, (RestoreDatabaseParams), (override));
54  MOCK_METHOD(StatusOr<google::iam::v1::Policy>, GetIamPolicy,
56  MOCK_METHOD(StatusOr<google::iam::v1::Policy>, SetIamPolicy,
58  MOCK_METHOD(StatusOr<google::iam::v1::TestIamPermissionsResponse>,
59  TestIamPermissions, (TestIamPermissionsParams), (override));
60  MOCK_METHOD(future<StatusOr<google::spanner::admin::database::v1::Backup>>,
61  CreateBackup, (CreateBackupParams), (override));
62  MOCK_METHOD(StatusOr<google::spanner::admin::database::v1::Backup>, GetBackup,
64  MOCK_METHOD(Status, DeleteBackup, (DeleteBackupParams), (override));
65  MOCK_METHOD(spanner::ListBackupsRange, ListBackups, (ListBackupsParams),
66  (override));
67  MOCK_METHOD(StatusOr<google::spanner::admin::database::v1::Backup>,
68  UpdateBackup, (UpdateBackupParams), (override));
69  MOCK_METHOD(spanner::ListBackupOperationsRange, ListBackupOperations,
71  MOCK_METHOD(spanner::ListDatabaseOperationsRange, ListDatabaseOperations,
73 };
74 
75 } // namespace SPANNER_CLIENT_NS
76 } // namespace spanner_mocks
77 } // namespace cloud
78 } // namespace google
79 
80 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_MOCKS_MOCK_DATABASE_ADMIN_CONNECTION_H