Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
mock_spanner_stub.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_SPANNER_GOOGLE_CLOUD_SPANNER_TESTING_MOCK_SPANNER_STUB_H_
16 #define GOOGLE_CLOUD_CPP_SPANNER_GOOGLE_CLOUD_SPANNER_TESTING_MOCK_SPANNER_STUB_H_
17 
18 #include "google/cloud/spanner/internal/spanner_stub.h"
20 #include <gmock/gmock.h>
21 
22 namespace google {
23 namespace cloud {
24 namespace spanner_testing {
25 inline namespace SPANNER_CLIENT_NS {
26 
27 class MockSpannerStub : public google::cloud::spanner::internal::SpannerStub {
28  public:
29  MOCK_METHOD2(CreateSession,
30  StatusOr<google::spanner::v1::Session>(
31  grpc::ClientContext&,
32  google::spanner::v1::CreateSessionRequest const&));
33 
34  MOCK_METHOD2(GetSession, StatusOr<google::spanner::v1::Session>(
35  grpc::ClientContext&,
36  google::spanner::v1::GetSessionRequest const&));
37 
38  MOCK_METHOD2(ListSessions,
39  StatusOr<google::spanner::v1::ListSessionsResponse>(
40  grpc::ClientContext&,
41  google::spanner::v1::ListSessionsRequest const&));
42 
43  MOCK_METHOD2(DeleteSession,
44  Status(grpc::ClientContext&,
45  google::spanner::v1::DeleteSessionRequest const&));
46 
47  MOCK_METHOD2(ExecuteSql, StatusOr<google::spanner::v1::ResultSet>(
48  grpc::ClientContext&,
49  google::spanner::v1::ExecuteSqlRequest const&));
50 
51  MOCK_METHOD2(
52  ExecuteStreamingSql,
53  std::unique_ptr<
54  grpc::ClientReaderInterface<google::spanner::v1::PartialResultSet>>(
55  grpc::ClientContext&, google::spanner::v1::ExecuteSqlRequest const&));
56 
57  MOCK_METHOD2(ExecuteBatchDml,
58  StatusOr<google::spanner::v1::ExecuteBatchDmlResponse>(
59  grpc::ClientContext&,
60  google::spanner::v1::ExecuteBatchDmlRequest const&));
61 
62  MOCK_METHOD2(Read, StatusOr<google::spanner::v1::ResultSet>(
63  grpc::ClientContext&,
64  google::spanner::v1::ReadRequest const&));
65 
66  MOCK_METHOD2(
67  StreamingRead,
68  std::unique_ptr<
69  grpc::ClientReaderInterface<google::spanner::v1::PartialResultSet>>(
70  grpc::ClientContext&, google::spanner::v1::ReadRequest const&));
71 
72  MOCK_METHOD2(BeginTransaction,
73  StatusOr<google::spanner::v1::Transaction>(
74  grpc::ClientContext&,
75  google::spanner::v1::BeginTransactionRequest const&));
76 
77  MOCK_METHOD2(Commit, StatusOr<google::spanner::v1::CommitResponse>(
78  grpc::ClientContext&,
79  google::spanner::v1::CommitRequest const&));
80 
81  MOCK_METHOD2(Rollback, Status(grpc::ClientContext&,
82  google::spanner::v1::RollbackRequest const&));
83 
84  MOCK_METHOD2(PartitionQuery,
85  StatusOr<google::spanner::v1::PartitionResponse>(
86  grpc::ClientContext&,
87  google::spanner::v1::PartitionQueryRequest const&));
88 
89  MOCK_METHOD2(PartitionRead,
90  StatusOr<google::spanner::v1::PartitionResponse>(
91  grpc::ClientContext&,
92  google::spanner::v1::PartitionReadRequest const&));
93 };
94 
95 } // namespace SPANNER_CLIENT_NS
96 } // namespace spanner_testing
97 } // namespace cloud
98 } // namespace google
99 
100 #endif // GOOGLE_CLOUD_CPP_SPANNER_GOOGLE_CLOUD_SPANNER_TESTING_MOCK_SPANNER_STUB_H_
#define SPANNER_CLIENT_NS
Definition: version.h:22