Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generator/integration_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ proto_library(
"common.proto",
"test.proto",
"test2.proto",
"test_deprecated.proto",
"test_request_id.proto",
],
deps = [
Expand Down
1 change: 1 addition & 0 deletions generator/integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ google_cloud_cpp_grpcpp_library(
${PROJECT_SOURCE_DIR}/generator/integration_tests/test.proto
${PROJECT_SOURCE_DIR}/generator/integration_tests/test2.proto
${PROJECT_SOURCE_DIR}/generator/integration_tests/test_request_id.proto
${PROJECT_SOURCE_DIR}/generator/integration_tests/test_deprecated.proto
PROTO_PATH_DIRECTORIES
${PROTO_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}
Expand Down
45 changes: 45 additions & 0 deletions generator/integration_tests/golden/v1/deprecated_client.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test_deprecated.proto

#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "generator/integration_tests/golden/v1/deprecated_client.h"
#include <memory>
#include <utility>

namespace google {
namespace cloud {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

DeprecatedServiceClient::DeprecatedServiceClient(
std::shared_ptr<DeprecatedServiceConnection> connection, Options opts)
: connection_(std::move(connection)),
options_(internal::MergeOptions(std::move(opts),
connection_->options())) {}
DeprecatedServiceClient::~DeprecatedServiceClient() = default;

Status
DeprecatedServiceClient::Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->Noop(request);
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1
} // namespace cloud
} // namespace google
123 changes: 123 additions & 0 deletions generator/integration_tests/golden/v1/deprecated_client.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test_deprecated.proto

#ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H

#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "generator/integration_tests/golden/v1/deprecated_connection.h"
#include "google/cloud/future.h"
#include "google/cloud/options.h"
#include "google/cloud/polling_policy.h"
#include "google/cloud/status_or.h"
#include "google/cloud/version.h"
#include <memory>
#include <string>

namespace google {
namespace cloud {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

///
/// Service to test deprecated services.
///
/// @par Equality
///
/// Instances of this class created via copy-construction or copy-assignment
/// always compare equal. Instances created with equal
/// `std::shared_ptr<*Connection>` objects compare equal. Objects that compare
/// equal share the same underlying resources.
///
/// @par Performance
///
/// Creating a new instance of this class is a relatively expensive operation,
/// new objects establish new connections to the service. In contrast,
/// copy-construction, move-construction, and the corresponding assignment
/// operations are relatively efficient as the copies share all underlying
/// resources.
///
/// @par Thread Safety
///
/// Concurrent access to different instances of this class, even if they compare
/// equal, is guaranteed to work. Two or more threads operating on the same
/// instance of this class is not guaranteed to work. Since copy-construction
/// and move-construction is a relatively efficient operation, consider using
/// such a copy when using this class from multiple threads.
///
class DeprecatedServiceClient {
public:
explicit DeprecatedServiceClient(std::shared_ptr<DeprecatedServiceConnection> connection, Options opts = {});
~DeprecatedServiceClient();

///@{
/// @name Copy and move support
DeprecatedServiceClient(DeprecatedServiceClient const&) = default;
DeprecatedServiceClient& operator=(DeprecatedServiceClient const&) = default;
DeprecatedServiceClient(DeprecatedServiceClient&&) = default;
DeprecatedServiceClient& operator=(DeprecatedServiceClient&&) = default;
///@}

///@{
/// @name Equality
friend bool operator==(DeprecatedServiceClient const& a, DeprecatedServiceClient const& b) {
return a.connection_ == b.connection_;
}
friend bool operator!=(DeprecatedServiceClient const& a, DeprecatedServiceClient const& b) {
return !(a == b);
}
///@}

// clang-format off
///
/// Does nothing.
///
/// @param request Unary RPCs, such as the one wrapped by this
/// function, receive a single `request` proto message which includes all
/// the inputs for the RPC. In this case, the proto message is a
/// [google.test.deprecated.v1.DeprecatedServiceRequest].
/// Proto messages are converted to C++ classes by Protobuf, using the
/// [Protobuf mapping rules].
/// @param opts Optional. Override the class-level options, such as retry and
/// backoff policies.
/// @return a [`Status`] object. If the request failed, the
/// status contains the details of the failure.
///
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
/// [`future`]: @ref google::cloud::future
/// [`StatusOr`]: @ref google::cloud::StatusOr
/// [`Status`]: @ref google::cloud::Status
/// [google.test.deprecated.v1.DeprecatedServiceRequest]: @googleapis_reference_link{generator/integration_tests/test_deprecated.proto#L39}
///
// clang-format on
Status
Noop(google::test::deprecated::v1::DeprecatedServiceRequest const& request, Options opts = {});

private:
std::shared_ptr<DeprecatedServiceConnection> connection_;
Options options_;
};

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1
} // namespace cloud
} // namespace google

#endif // GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_DEPRECATED_CLIENT_H
66 changes: 66 additions & 0 deletions generator/integration_tests/golden/v1/deprecated_connection.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: generator/integration_tests/test_deprecated.proto

#include "google/cloud/internal/disable_deprecation_warnings.inc"
#include "generator/integration_tests/golden/v1/deprecated_connection.h"
#include "generator/integration_tests/golden/v1/deprecated_options.h"
#include "generator/integration_tests/golden/v1/internal/deprecated_connection_impl.h"
#include "generator/integration_tests/golden/v1/internal/deprecated_option_defaults.h"
#include "generator/integration_tests/golden/v1/internal/deprecated_stub_factory.h"
#include "generator/integration_tests/golden/v1/internal/deprecated_tracing_connection.h"
#include "google/cloud/background_threads.h"
#include "google/cloud/common_options.h"
#include "google/cloud/credentials.h"
#include "google/cloud/grpc_options.h"
#include "google/cloud/internal/unified_grpc_credentials.h"
#include <memory>
#include <utility>

namespace google {
namespace cloud {
namespace golden_v1 {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

DeprecatedServiceConnection::~DeprecatedServiceConnection() = default;

Status
DeprecatedServiceConnection::Noop(
google::test::deprecated::v1::DeprecatedServiceRequest const&) {
return Status(StatusCode::kUnimplemented, "not implemented");
}

std::shared_ptr<DeprecatedServiceConnection> MakeDeprecatedServiceConnection(
Options options) {
internal::CheckExpectedOptions<CommonOptionList, GrpcOptionList,
UnifiedCredentialsOptionList,
DeprecatedServicePolicyOptionList>(options, __func__);
options = golden_v1_internal::DeprecatedServiceDefaultOptions(
std::move(options));
auto background = internal::MakeBackgroundThreadsFactory(options)();
auto auth = internal::CreateAuthenticationStrategy(background->cq(), options);
auto stub = golden_v1_internal::CreateDefaultDeprecatedServiceStub(
std::move(auth), options);
return golden_v1_internal::MakeDeprecatedServiceTracingConnection(
std::make_shared<golden_v1_internal::DeprecatedServiceConnectionImpl>(
std::move(background), std::move(stub), std::move(options)));
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1
} // namespace cloud
} // namespace google
Loading
Loading