Skip to content

Commit f0d92a0

Browse files
authored
cleanup(mixin): add more test cases (#14818)
1 parent 6ab4a8c commit f0d92a0

File tree

72 files changed

+1519
-106
lines changed

Some content is hidden

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

72 files changed

+1519
-106
lines changed

generator/integration_tests/benchmarks/client_benchmark.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "google/cloud/log.h"
2626
#include "google/cloud/version.h"
2727
#include <google/cloud/location/locations.grpc.pb.h>
28+
#include <google/iam/v1/iam_policy.grpc.pb.h>
29+
#include <google/longrunning/operations.grpc.pb.h>
2830
#include <benchmark/benchmark.h>
2931
#include <memory>
3032

@@ -151,6 +153,18 @@ class TestStub : public GoldenKitchenSinkStub {
151153
return internal::UnimplementedError("unimplemented");
152154
}
153155

156+
StatusOr<google::iam::v1::Policy> GetIamPolicy(
157+
grpc::ClientContext&, Options const&,
158+
google::iam::v1::GetIamPolicyRequest const&) override {
159+
return internal::UnimplementedError("unimplemented");
160+
}
161+
162+
StatusOr<google::longrunning::ListOperationsResponse> ListOperations(
163+
grpc::ClientContext&, Options const&,
164+
google::longrunning::ListOperationsRequest const&) override {
165+
return internal::UnimplementedError("unimplemented");
166+
}
167+
154168
std::unique_ptr<::google::cloud::internal::AsyncStreamingReadRpc<
155169
google::test::admin::database::v1::Response>>
156170
AsyncStreamingRead(

generator/integration_tests/golden/v1/golden_kitchen_sink_client.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,27 @@ GoldenKitchenSinkClient::GetLocation(google::cloud::location::GetLocationRequest
187187
return connection_->GetLocation(request);
188188
}
189189

190+
StatusOr<google::iam::v1::Policy>
191+
GoldenKitchenSinkClient::GetIamPolicy(google::iam::v1::GetIamPolicyRequest const& request, Options opts) {
192+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
193+
return connection_->GetIamPolicy(request);
194+
}
195+
196+
StreamRange<google::longrunning::Operation>
197+
GoldenKitchenSinkClient::ListOperations(std::string const& name, std::string const& filter, Options opts) {
198+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
199+
google::longrunning::ListOperationsRequest request;
200+
request.set_name(name);
201+
request.set_filter(filter);
202+
return connection_->ListOperations(request);
203+
}
204+
205+
StreamRange<google::longrunning::Operation>
206+
GoldenKitchenSinkClient::ListOperations(google::longrunning::ListOperationsRequest request, Options opts) {
207+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
208+
return connection_->ListOperations(std::move(request));
209+
}
210+
190211
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
191212
} // namespace golden_v1
192213
} // namespace cloud

generator/integration_tests/golden/v1/golden_kitchen_sink_client.h

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,130 @@ class GoldenKitchenSinkClient {
776776
StatusOr<google::cloud::location::Location>
777777
GetLocation(google::cloud::location::GetLocationRequest const& request, Options opts = {});
778778

779+
// clang-format off
780+
///
781+
/// Gets the access control policy for a resource.
782+
/// Returns an empty policy if the resource exists and does not have a policy
783+
/// set.
784+
///
785+
/// @param request Unary RPCs, such as the one wrapped by this
786+
/// function, receive a single `request` proto message which includes all
787+
/// the inputs for the RPC. In this case, the proto message is a
788+
/// [google.iam.v1.GetIamPolicyRequest].
789+
/// Proto messages are converted to C++ classes by Protobuf, using the
790+
/// [Protobuf mapping rules].
791+
/// @param opts Optional. Override the class-level options, such as retry and
792+
/// backoff policies.
793+
/// @return the result of the RPC. The response message type
794+
/// ([google.iam.v1.Policy])
795+
/// is mapped to a C++ class using the [Protobuf mapping rules].
796+
/// If the request fails, the [`StatusOr`] contains the error details.
797+
///
798+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
799+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
800+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
801+
/// [`future`]: @ref google::cloud::future
802+
/// [`StatusOr`]: @ref google::cloud::StatusOr
803+
/// [`Status`]: @ref google::cloud::Status
804+
/// [google.iam.v1.GetIamPolicyRequest]: @googleapis_reference_link{google/iam/v1/iam_policy.proto#L123}
805+
/// [google.iam.v1.Policy]: @googleapis_reference_link{google/iam/v1/policy.proto#L102}
806+
///
807+
// clang-format on
808+
StatusOr<google::iam::v1::Policy>
809+
GetIamPolicy(google::iam::v1::GetIamPolicyRequest const& request, Options opts = {});
810+
811+
// clang-format off
812+
///
813+
/// Lists operations that match the specified filter in the request. If the
814+
/// server doesn't support this method, it returns `UNIMPLEMENTED`.
815+
///
816+
/// NOTE: the `name` binding allows API services to override the binding
817+
/// to use different resource name schemes, such as `users/*/operations`. To
818+
/// override the binding, API services can add a binding such as
819+
/// `"/v1/{name=users/*}/operations"` to their service configuration.
820+
/// For backwards compatibility, the default name includes the operations
821+
/// collection id, however overriding users must ensure the name binding
822+
/// is the parent resource, without the operations collection id.
823+
///
824+
/// @param name The name of the operation's parent resource.
825+
/// @param filter The standard list filter.
826+
/// @param opts Optional. Override the class-level options, such as retry and
827+
/// backoff policies.
828+
/// @return a [StreamRange](@ref google::cloud::StreamRange)
829+
/// to iterate of the results. See the documentation of this type for
830+
/// details. In brief, this class has `begin()` and `end()` member
831+
/// functions returning a iterator class meeting the
832+
/// [input iterator requirements]. The value type for this iterator is a
833+
/// [`StatusOr`] as the iteration may fail even after some values are
834+
/// retrieved successfully, for example, if there is a network disconnect.
835+
/// An empty set of results does not indicate an error, it indicates
836+
/// that there are no resources meeting the request criteria.
837+
/// On a successful iteration the `StatusOr<T>` contains elements of type
838+
/// [google.longrunning.Operation], or rather,
839+
/// the C++ class generated by Protobuf from that type. Please consult the
840+
/// Protobuf documentation for details on the [Protobuf mapping rules].
841+
///
842+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
843+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
844+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
845+
/// [`future`]: @ref google::cloud::future
846+
/// [`StatusOr`]: @ref google::cloud::StatusOr
847+
/// [`Status`]: @ref google::cloud::Status
848+
/// [google.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L171}
849+
/// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L128}
850+
///
851+
// clang-format on
852+
StreamRange<google::longrunning::Operation>
853+
ListOperations(std::string const& name, std::string const& filter, Options opts = {});
854+
855+
// clang-format off
856+
///
857+
/// Lists operations that match the specified filter in the request. If the
858+
/// server doesn't support this method, it returns `UNIMPLEMENTED`.
859+
///
860+
/// NOTE: the `name` binding allows API services to override the binding
861+
/// to use different resource name schemes, such as `users/*/operations`. To
862+
/// override the binding, API services can add a binding such as
863+
/// `"/v1/{name=users/*}/operations"` to their service configuration.
864+
/// For backwards compatibility, the default name includes the operations
865+
/// collection id, however overriding users must ensure the name binding
866+
/// is the parent resource, without the operations collection id.
867+
///
868+
/// @param request Unary RPCs, such as the one wrapped by this
869+
/// function, receive a single `request` proto message which includes all
870+
/// the inputs for the RPC. In this case, the proto message is a
871+
/// [google.longrunning.ListOperationsRequest].
872+
/// Proto messages are converted to C++ classes by Protobuf, using the
873+
/// [Protobuf mapping rules].
874+
/// @param opts Optional. Override the class-level options, such as retry and
875+
/// backoff policies.
876+
/// @return a [StreamRange](@ref google::cloud::StreamRange)
877+
/// to iterate of the results. See the documentation of this type for
878+
/// details. In brief, this class has `begin()` and `end()` member
879+
/// functions returning a iterator class meeting the
880+
/// [input iterator requirements]. The value type for this iterator is a
881+
/// [`StatusOr`] as the iteration may fail even after some values are
882+
/// retrieved successfully, for example, if there is a network disconnect.
883+
/// An empty set of results does not indicate an error, it indicates
884+
/// that there are no resources meeting the request criteria.
885+
/// On a successful iteration the `StatusOr<T>` contains elements of type
886+
/// [google.longrunning.Operation], or rather,
887+
/// the C++ class generated by Protobuf from that type. Please consult the
888+
/// Protobuf documentation for details on the [Protobuf mapping rules].
889+
///
890+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
891+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
892+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
893+
/// [`future`]: @ref google::cloud::future
894+
/// [`StatusOr`]: @ref google::cloud::StatusOr
895+
/// [`Status`]: @ref google::cloud::Status
896+
/// [google.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L171}
897+
/// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L128}
898+
///
899+
// clang-format on
900+
StreamRange<google::longrunning::Operation>
901+
ListOperations(google::longrunning::ListOperationsRequest request, Options opts = {});
902+
779903
private:
780904
std::shared_ptr<GoldenKitchenSinkConnection> connection_;
781905
Options options_;

generator/integration_tests/golden/v1/golden_kitchen_sink_connection.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ GoldenKitchenSinkConnection::GetLocation(
119119
return Status(StatusCode::kUnimplemented, "not implemented");
120120
}
121121

122+
StatusOr<google::iam::v1::Policy>
123+
GoldenKitchenSinkConnection::GetIamPolicy(
124+
google::iam::v1::GetIamPolicyRequest const&) {
125+
return Status(StatusCode::kUnimplemented, "not implemented");
126+
}
127+
128+
StreamRange<google::longrunning::Operation> GoldenKitchenSinkConnection::ListOperations(
129+
google::longrunning::ListOperationsRequest) { // NOLINT(performance-unnecessary-value-param)
130+
return google::cloud::internal::MakeUnimplementedPaginationRange<
131+
StreamRange<google::longrunning::Operation>>();
132+
}
133+
122134
std::shared_ptr<GoldenKitchenSinkConnection> MakeGoldenKitchenSinkConnection(
123135
Options options) {
124136
internal::CheckExpectedOptions<CommonOptionList, GrpcOptionList,

generator/integration_tests/golden/v1/golden_kitchen_sink_connection.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ class GoldenKitchenSinkConnection {
217217

218218
virtual StatusOr<google::cloud::location::Location>
219219
GetLocation(google::cloud::location::GetLocationRequest const& request);
220+
221+
virtual StatusOr<google::iam::v1::Policy>
222+
GetIamPolicy(google::iam::v1::GetIamPolicyRequest const& request);
223+
224+
virtual StreamRange<google::longrunning::Operation>
225+
ListOperations(google::longrunning::ListOperationsRequest request);
220226
};
221227

222228
/**

generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ Idempotency GoldenKitchenSinkConnectionIdempotencyPolicy::GetLocation(google::cl
7373
return Idempotency::kIdempotent;
7474
}
7575

76+
Idempotency GoldenKitchenSinkConnectionIdempotencyPolicy::GetIamPolicy(google::iam::v1::GetIamPolicyRequest const&) {
77+
return Idempotency::kIdempotent;
78+
}
79+
80+
Idempotency GoldenKitchenSinkConnectionIdempotencyPolicy::ListOperations(google::longrunning::ListOperationsRequest) { // NOLINT
81+
return Idempotency::kIdempotent;
82+
}
83+
7684
std::unique_ptr<GoldenKitchenSinkConnectionIdempotencyPolicy>
7785
MakeDefaultGoldenKitchenSinkConnectionIdempotencyPolicy() {
7886
return std::make_unique<GoldenKitchenSinkConnectionIdempotencyPolicy>();

generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "google/cloud/version.h"
2424
#include <generator/integration_tests/test.grpc.pb.h>
2525
#include <google/cloud/location/locations.grpc.pb.h>
26+
#include <google/iam/v1/iam_policy.grpc.pb.h>
27+
#include <google/longrunning/operations.grpc.pb.h>
2628
#include <memory>
2729

2830
namespace google {
@@ -66,6 +68,12 @@ class GoldenKitchenSinkConnectionIdempotencyPolicy {
6668

6769
virtual google::cloud::Idempotency
6870
GetLocation(google::cloud::location::GetLocationRequest const& request);
71+
72+
virtual google::cloud::Idempotency
73+
GetIamPolicy(google::iam::v1::GetIamPolicyRequest const& request);
74+
75+
virtual google::cloud::Idempotency
76+
ListOperations(google::longrunning::ListOperationsRequest request);
6977
};
7078

7179
std::unique_ptr<GoldenKitchenSinkConnectionIdempotencyPolicy>

generator/integration_tests/golden/v1/golden_thing_admin_client.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,21 @@ GoldenThingAdminClient::GetLocation(google::cloud::location::GetLocationRequest
425425
return connection_->GetLocation(request);
426426
}
427427

428+
StreamRange<google::longrunning::Operation>
429+
GoldenThingAdminClient::ListOperations(std::string const& name, std::string const& filter, Options opts) {
430+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
431+
google::longrunning::ListOperationsRequest request;
432+
request.set_name(name);
433+
request.set_filter(filter);
434+
return connection_->ListOperations(request);
435+
}
436+
437+
StreamRange<google::longrunning::Operation>
438+
GoldenThingAdminClient::ListOperations(google::longrunning::ListOperationsRequest request, Options opts) {
439+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
440+
return connection_->ListOperations(std::move(request));
441+
}
442+
428443
future<StatusOr<google::test::admin::database::v1::Database>>
429444
GoldenThingAdminClient::AsyncGetDatabase(std::string const& name, Options opts) {
430445
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));

generator/integration_tests/golden/v1/golden_thing_admin_client.h

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,98 @@ class GoldenThingAdminClient {
16891689
StatusOr<google::cloud::location::Location>
16901690
GetLocation(google::cloud::location::GetLocationRequest const& request, Options opts = {});
16911691

1692+
// clang-format off
1693+
///
1694+
/// Lists operations that match the specified filter in the request. If the
1695+
/// server doesn't support this method, it returns `UNIMPLEMENTED`.
1696+
///
1697+
/// NOTE: the `name` binding allows API services to override the binding
1698+
/// to use different resource name schemes, such as `users/*/operations`. To
1699+
/// override the binding, API services can add a binding such as
1700+
/// `"/v1/{name=users/*}/operations"` to their service configuration.
1701+
/// For backwards compatibility, the default name includes the operations
1702+
/// collection id, however overriding users must ensure the name binding
1703+
/// is the parent resource, without the operations collection id.
1704+
///
1705+
/// @param name The name of the operation's parent resource.
1706+
/// @param filter The standard list filter.
1707+
/// @param opts Optional. Override the class-level options, such as retry and
1708+
/// backoff policies.
1709+
/// @return a [StreamRange](@ref google::cloud::StreamRange)
1710+
/// to iterate of the results. See the documentation of this type for
1711+
/// details. In brief, this class has `begin()` and `end()` member
1712+
/// functions returning a iterator class meeting the
1713+
/// [input iterator requirements]. The value type for this iterator is a
1714+
/// [`StatusOr`] as the iteration may fail even after some values are
1715+
/// retrieved successfully, for example, if there is a network disconnect.
1716+
/// An empty set of results does not indicate an error, it indicates
1717+
/// that there are no resources meeting the request criteria.
1718+
/// On a successful iteration the `StatusOr<T>` contains elements of type
1719+
/// [google.longrunning.Operation], or rather,
1720+
/// the C++ class generated by Protobuf from that type. Please consult the
1721+
/// Protobuf documentation for details on the [Protobuf mapping rules].
1722+
///
1723+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
1724+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
1725+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
1726+
/// [`future`]: @ref google::cloud::future
1727+
/// [`StatusOr`]: @ref google::cloud::StatusOr
1728+
/// [`Status`]: @ref google::cloud::Status
1729+
/// [google.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L171}
1730+
/// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L128}
1731+
///
1732+
// clang-format on
1733+
StreamRange<google::longrunning::Operation>
1734+
ListOperations(std::string const& name, std::string const& filter, Options opts = {});
1735+
1736+
// clang-format off
1737+
///
1738+
/// Lists operations that match the specified filter in the request. If the
1739+
/// server doesn't support this method, it returns `UNIMPLEMENTED`.
1740+
///
1741+
/// NOTE: the `name` binding allows API services to override the binding
1742+
/// to use different resource name schemes, such as `users/*/operations`. To
1743+
/// override the binding, API services can add a binding such as
1744+
/// `"/v1/{name=users/*}/operations"` to their service configuration.
1745+
/// For backwards compatibility, the default name includes the operations
1746+
/// collection id, however overriding users must ensure the name binding
1747+
/// is the parent resource, without the operations collection id.
1748+
///
1749+
/// @param request Unary RPCs, such as the one wrapped by this
1750+
/// function, receive a single `request` proto message which includes all
1751+
/// the inputs for the RPC. In this case, the proto message is a
1752+
/// [google.longrunning.ListOperationsRequest].
1753+
/// Proto messages are converted to C++ classes by Protobuf, using the
1754+
/// [Protobuf mapping rules].
1755+
/// @param opts Optional. Override the class-level options, such as retry and
1756+
/// backoff policies.
1757+
/// @return a [StreamRange](@ref google::cloud::StreamRange)
1758+
/// to iterate of the results. See the documentation of this type for
1759+
/// details. In brief, this class has `begin()` and `end()` member
1760+
/// functions returning a iterator class meeting the
1761+
/// [input iterator requirements]. The value type for this iterator is a
1762+
/// [`StatusOr`] as the iteration may fail even after some values are
1763+
/// retrieved successfully, for example, if there is a network disconnect.
1764+
/// An empty set of results does not indicate an error, it indicates
1765+
/// that there are no resources meeting the request criteria.
1766+
/// On a successful iteration the `StatusOr<T>` contains elements of type
1767+
/// [google.longrunning.Operation], or rather,
1768+
/// the C++ class generated by Protobuf from that type. Please consult the
1769+
/// Protobuf documentation for details on the [Protobuf mapping rules].
1770+
///
1771+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
1772+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
1773+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
1774+
/// [`future`]: @ref google::cloud::future
1775+
/// [`StatusOr`]: @ref google::cloud::StatusOr
1776+
/// [`Status`]: @ref google::cloud::Status
1777+
/// [google.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L171}
1778+
/// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L128}
1779+
///
1780+
// clang-format on
1781+
StreamRange<google::longrunning::Operation>
1782+
ListOperations(google::longrunning::ListOperationsRequest request, Options opts = {});
1783+
16921784
// clang-format off
16931785
///
16941786
/// 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
@@ -242,6 +242,12 @@ GoldenThingAdminConnection::GetLocation(
242242
return Status(StatusCode::kUnimplemented, "not implemented");
243243
}
244244

245+
StreamRange<google::longrunning::Operation> GoldenThingAdminConnection::ListOperations(
246+
google::longrunning::ListOperationsRequest) { // NOLINT(performance-unnecessary-value-param)
247+
return google::cloud::internal::MakeUnimplementedPaginationRange<
248+
StreamRange<google::longrunning::Operation>>();
249+
}
250+
245251
future<StatusOr<google::test::admin::database::v1::Database>>
246252
GoldenThingAdminConnection::AsyncGetDatabase(
247253
google::test::admin::database::v1::GetDatabaseRequest const&) {

0 commit comments

Comments
 (0)