Skip to content

Commit 7e14d3a

Browse files
authored
cleanup(mixin): add one API test case for location mixin (#14813)
* cleanup(mixin): add one API test case for location mixin * fix format * add test fix nit
1 parent a41a136 commit 7e14d3a

File tree

73 files changed

+734
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+734
-14
lines changed

generator/integration_tests/benchmarks/client_benchmark.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "google/cloud/internal/make_status.h"
2525
#include "google/cloud/log.h"
2626
#include "google/cloud/version.h"
27+
#include <google/cloud/location/locations.grpc.pb.h>
2728
#include <benchmark/benchmark.h>
2829
#include <memory>
2930

@@ -144,6 +145,12 @@ class TestStub : public GoldenKitchenSinkStub {
144145
return Status();
145146
}
146147

148+
StatusOr<::google::cloud::location::Location> GetLocation(
149+
grpc::ClientContext&, Options const&,
150+
::google::cloud::location::GetLocationRequest const&) override {
151+
return internal::UnimplementedError("unimplemented");
152+
}
153+
147154
std::unique_ptr<::google::cloud::internal::AsyncStreamingReadRpc<
148155
google::test::admin::database::v1::Response>>
149156
AsyncStreamingRead(

generator/integration_tests/golden/v1/golden_kitchen_sink_client.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ GoldenKitchenSinkClient::ExplicitRouting2(google::test::admin::database::v1::Exp
181181
return connection_->ExplicitRouting2(request);
182182
}
183183

184+
StatusOr<google::cloud::location::Location>
185+
GoldenKitchenSinkClient::GetLocation(google::cloud::location::GetLocationRequest const& request, Options opts) {
186+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
187+
return connection_->GetLocation(request);
188+
}
189+
184190
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
185191
} // namespace golden_v1
186192
} // namespace cloud

generator/integration_tests/golden/v1/golden_kitchen_sink_client.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,36 @@ class GoldenKitchenSinkClient {
746746
Status
747747
ExplicitRouting2(google::test::admin::database::v1::ExplicitRoutingRequest const& request, Options opts = {});
748748

749+
// clang-format off
750+
///
751+
/// Gets information about a location.
752+
///
753+
/// @param request Unary RPCs, such as the one wrapped by this
754+
/// function, receive a single `request` proto message which includes all
755+
/// the inputs for the RPC. In this case, the proto message is a
756+
/// [google.cloud.location.GetLocationRequest].
757+
/// Proto messages are converted to C++ classes by Protobuf, using the
758+
/// [Protobuf mapping rules].
759+
/// @param opts Optional. Override the class-level options, such as retry and
760+
/// backoff policies.
761+
/// @return the result of the RPC. The response message type
762+
/// ([google.cloud.location.Location])
763+
/// is mapped to a C++ class using the [Protobuf mapping rules].
764+
/// If the request fails, the [`StatusOr`] contains the error details.
765+
///
766+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
767+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
768+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
769+
/// [`future`]: @ref google::cloud::future
770+
/// [`StatusOr`]: @ref google::cloud::StatusOr
771+
/// [`Status`]: @ref google::cloud::Status
772+
/// [google.cloud.location.GetLocationRequest]: @googleapis_reference_link{google/cloud/location/locations.proto#L82}
773+
/// [google.cloud.location.Location]: @googleapis_reference_link{google/cloud/location/locations.proto#L88}
774+
///
775+
// clang-format on
776+
StatusOr<google::cloud::location::Location>
777+
GetLocation(google::cloud::location::GetLocationRequest const& request, Options opts = {});
778+
749779
private:
750780
std::shared_ptr<GoldenKitchenSinkConnection> connection_;
751781
Options options_;

generator/integration_tests/golden/v1/golden_kitchen_sink_connection.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ GoldenKitchenSinkConnection::ExplicitRouting2(
113113
return Status(StatusCode::kUnimplemented, "not implemented");
114114
}
115115

116+
StatusOr<google::cloud::location::Location>
117+
GoldenKitchenSinkConnection::GetLocation(
118+
google::cloud::location::GetLocationRequest const&) {
119+
return Status(StatusCode::kUnimplemented, "not implemented");
120+
}
121+
116122
std::shared_ptr<GoldenKitchenSinkConnection> MakeGoldenKitchenSinkConnection(
117123
Options options) {
118124
internal::CheckExpectedOptions<CommonOptionList, GrpcOptionList,

generator/integration_tests/golden/v1/golden_kitchen_sink_connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ class GoldenKitchenSinkConnection {
214214

215215
virtual Status
216216
ExplicitRouting2(google::test::admin::database::v1::ExplicitRoutingRequest const& request);
217+
218+
virtual StatusOr<google::cloud::location::Location>
219+
GetLocation(google::cloud::location::GetLocationRequest const& request);
217220
};
218221

219222
/**

generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ Idempotency GoldenKitchenSinkConnectionIdempotencyPolicy::ExplicitRouting2(googl
6969
return Idempotency::kNonIdempotent;
7070
}
7171

72+
Idempotency GoldenKitchenSinkConnectionIdempotencyPolicy::GetLocation(google::cloud::location::GetLocationRequest const&) {
73+
return Idempotency::kIdempotent;
74+
}
75+
7276
std::unique_ptr<GoldenKitchenSinkConnectionIdempotencyPolicy>
7377
MakeDefaultGoldenKitchenSinkConnectionIdempotencyPolicy() {
7478
return std::make_unique<GoldenKitchenSinkConnectionIdempotencyPolicy>();

generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "google/cloud/idempotency.h"
2323
#include "google/cloud/version.h"
2424
#include <generator/integration_tests/test.grpc.pb.h>
25+
#include <google/cloud/location/locations.grpc.pb.h>
2526
#include <memory>
2627

2728
namespace google {
@@ -62,6 +63,9 @@ class GoldenKitchenSinkConnectionIdempotencyPolicy {
6263

6364
virtual google::cloud::Idempotency
6465
ExplicitRouting2(google::test::admin::database::v1::ExplicitRoutingRequest const& request);
66+
67+
virtual google::cloud::Idempotency
68+
GetLocation(google::cloud::location::GetLocationRequest const& request);
6569
};
6670

6771
std::unique_ptr<GoldenKitchenSinkConnectionIdempotencyPolicy>

generator/integration_tests/golden/v1/golden_thing_admin_client.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,12 @@ GoldenThingAdminClient::LongRunningWithoutRouting(google::longrunning::Operation
419419
return connection_->LongRunningWithoutRouting(operation);
420420
}
421421

422+
StatusOr<google::cloud::location::Location>
423+
GoldenThingAdminClient::GetLocation(google::cloud::location::GetLocationRequest const& request, Options opts) {
424+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
425+
return connection_->GetLocation(request);
426+
}
427+
422428
future<StatusOr<google::test::admin::database::v1::Database>>
423429
GoldenThingAdminClient::AsyncGetDatabase(std::string const& name, Options opts) {
424430
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));

generator/integration_tests/golden/v1/golden_thing_admin_client.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "google/cloud/version.h"
3030
#include "google/cloud/iam_updater.h"
3131
#include <google/longrunning/operations.grpc.pb.h>
32+
#include <map>
3233
#include <memory>
3334
#include <string>
3435

@@ -1658,6 +1659,36 @@ class GoldenThingAdminClient {
16581659
future<StatusOr<google::test::admin::database::v1::Database>>
16591660
LongRunningWithoutRouting(google::longrunning::Operation const& operation, Options opts = {});
16601661

1662+
// clang-format off
1663+
///
1664+
/// Gets information about a location.
1665+
///
1666+
/// @param request Unary RPCs, such as the one wrapped by this
1667+
/// function, receive a single `request` proto message which includes all
1668+
/// the inputs for the RPC. In this case, the proto message is a
1669+
/// [google.cloud.location.GetLocationRequest].
1670+
/// Proto messages are converted to C++ classes by Protobuf, using the
1671+
/// [Protobuf mapping rules].
1672+
/// @param opts Optional. Override the class-level options, such as retry and
1673+
/// backoff policies.
1674+
/// @return the result of the RPC. The response message type
1675+
/// ([google.cloud.location.Location])
1676+
/// is mapped to a C++ class using the [Protobuf mapping rules].
1677+
/// If the request fails, the [`StatusOr`] contains the error details.
1678+
///
1679+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
1680+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
1681+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
1682+
/// [`future`]: @ref google::cloud::future
1683+
/// [`StatusOr`]: @ref google::cloud::StatusOr
1684+
/// [`Status`]: @ref google::cloud::Status
1685+
/// [google.cloud.location.GetLocationRequest]: @googleapis_reference_link{google/cloud/location/locations.proto#L82}
1686+
/// [google.cloud.location.Location]: @googleapis_reference_link{google/cloud/location/locations.proto#L88}
1687+
///
1688+
// clang-format on
1689+
StatusOr<google::cloud::location::Location>
1690+
GetLocation(google::cloud::location::GetLocationRequest const& request, Options opts = {});
1691+
16611692
// clang-format off
16621693
///
16631694
/// Gets the state of a Cloud Test database.

generator/integration_tests/golden/v1/golden_thing_admin_connection.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ GoldenThingAdminConnection::LongRunningWithoutRouting(
236236
Status(StatusCode::kUnimplemented, "not implemented"));
237237
}
238238

239+
StatusOr<google::cloud::location::Location>
240+
GoldenThingAdminConnection::GetLocation(
241+
google::cloud::location::GetLocationRequest const&) {
242+
return Status(StatusCode::kUnimplemented, "not implemented");
243+
}
244+
239245
future<StatusOr<google::test::admin::database::v1::Database>>
240246
GoldenThingAdminConnection::AsyncGetDatabase(
241247
google::test::admin::database::v1::GetDatabaseRequest const&) {

0 commit comments

Comments
 (0)