From 8096dbddf0a73c0fa86aa421f7f763f56c5f37c3 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 24 May 2023 18:44:24 -0400 Subject: [PATCH 01/18] test: uncomment showcase-extended setup --- showcase/BUILD.bazel | 26 +++++++++---------- .../gapic-showcase-extended/proto/BUILD.bazel | 10 +++---- showcase/scripts/update.sh | 4 +-- showcase/scripts/verify.sh | 4 +-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/showcase/BUILD.bazel b/showcase/BUILD.bazel index 9c893230e0..a503736539 100644 --- a/showcase/BUILD.bazel +++ b/showcase/BUILD.bazel @@ -17,7 +17,7 @@ proto_library_with_info( name = "showcase_proto_with_info", deps = [ "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_proto", -# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", + "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", "@com_google_googleapis//google/cloud:common_resources_proto", "@com_google_googleapis//google/cloud/location:location_proto" ], @@ -27,7 +27,7 @@ java_proto_library( name = "showcase_java_proto", deps = [ "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_proto", -# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended" + "//showcase/gapic-showcase-extended/proto:showcase_proto_extended" ], ) @@ -37,13 +37,13 @@ java_grpc_library( deps = [":showcase_java_proto"], ) -#java_grpc_library( -# name = "showcase_java_grpc_extended", -# srcs = [ -# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", -# ], -# deps = [":showcase_java_proto"], -#) +java_grpc_library( + name = "showcase_java_grpc_extended", + srcs = [ + "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", + ], + deps = [":showcase_java_proto"], +) java_gapic_library( name = "showcase_java_gapic", @@ -56,7 +56,7 @@ java_gapic_library( service_yaml = "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_v1beta1.yaml", test_deps = [ ":showcase_java_grpc", -# ":showcase_java_grpc_extended", + ":showcase_java_grpc_extended", "@com_google_googleapis//google/cloud/location:location_java_grpc" ], transport = "grpc+rest", @@ -121,10 +121,10 @@ sh_binary( # GRPC Showcase : Update and Verify GRPC_DATA = [ "libshowcase_java_grpc-src.jar", -# "libshowcase_java_grpc_extended-src.jar", + "libshowcase_java_grpc_extended-src.jar", ":grpc_gapic_showcase_files", ":showcase_java_grpc", -# ":showcase_java_grpc_extended" + ":showcase_java_grpc_extended" ] sh_binary( @@ -146,7 +146,7 @@ PROTO_DATA = [ "proto-google-cloud-showcase-v1beta1-java.tar.gz", ":proto_gapic_showcase_files", ":showcase_java_proto", -# ":showcase_java_proto_extended", + ":showcase_java_proto_extended", ] sh_binary( diff --git a/showcase/gapic-showcase-extended/proto/BUILD.bazel b/showcase/gapic-showcase-extended/proto/BUILD.bazel index bc57596d1b..cdad5e509a 100644 --- a/showcase/gapic-showcase-extended/proto/BUILD.bazel +++ b/showcase/gapic-showcase-extended/proto/BUILD.bazel @@ -27,8 +27,8 @@ package(default_visibility = ["//visibility:public"]) # gapic-showcase project is used to test the generated client behavior with a showcase server # gapic-showcase-extension project is used to test the generator's behavior -#proto_library( -# name = "showcase_proto_extended", -# srcs = [], -# deps = [] -#) \ No newline at end of file +proto_library( + name = "showcase_proto_extended", + srcs = [], + deps = [] +) \ No newline at end of file diff --git a/showcase/scripts/update.sh b/showcase/scripts/update.sh index f7b7e4ee7a..ad94efb740 100755 --- a/showcase/scripts/update.sh +++ b/showcase/scripts/update.sh @@ -40,13 +40,13 @@ case $1 in grpc) GRPC_PROJECT_DIR=grpc-gapic-showcase-v1beta1 GRPC_JAR=$(find . -name 'libshowcase_java_grpc-src.jar') -# GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') + GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') clear_existing $GRPC_PROJECT_DIR create_unpack_dir grpc_unpacked GRPC_UNPACK_DIR=$PWD jar xf "$BAZEL_ROOT/$GRPC_JAR" -# jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" + jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" cd "$BUILD_WORKSPACE_DIRECTORY/showcase/$GRPC_PROJECT_DIR" mkdir -p ./src/main/java/com cp -r "$GRPC_UNPACK_DIR"/com/* ./src/main/java/com diff --git a/showcase/scripts/verify.sh b/showcase/scripts/verify.sh index 80cac43cad..6c4865b84c 100755 --- a/showcase/scripts/verify.sh +++ b/showcase/scripts/verify.sh @@ -39,12 +39,12 @@ case $1 in grpc) GRPC_PROJECT_DIR=grpc-gapic-showcase-v1beta1 GRPC_JAR=$(find . -name 'libshowcase_java_grpc-src.jar') -# GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') + GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') create_unpack_dir grpc_unpacked GRPC_UNPACK_DIR=$PWD jar xf "$BAZEL_ROOT/$GRPC_JAR" -# jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" + jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" delete_unneeded diff -ru "$SHOWCASE_DIR/$GRPC_PROJECT_DIR"/src/main/java/com "$GRPC_UNPACK_DIR"/com ;; From c5e0b3015df3c14aa209a44fe302fe84e5808d1c Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Thu, 25 May 2023 16:05:46 -0400 Subject: [PATCH 02/18] test: adjustments for showcase-extended setup --- showcase/BUILD.bazel | 2 +- showcase/gapic-showcase-extended/proto/BUILD.bazel | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/showcase/BUILD.bazel b/showcase/BUILD.bazel index a503736539..e83cd1fe90 100644 --- a/showcase/BUILD.bazel +++ b/showcase/BUILD.bazel @@ -146,7 +146,7 @@ PROTO_DATA = [ "proto-google-cloud-showcase-v1beta1-java.tar.gz", ":proto_gapic_showcase_files", ":showcase_java_proto", - ":showcase_java_proto_extended", + # ":showcase_java_proto_extended", ] sh_binary( diff --git a/showcase/gapic-showcase-extended/proto/BUILD.bazel b/showcase/gapic-showcase-extended/proto/BUILD.bazel index cdad5e509a..23577e8061 100644 --- a/showcase/gapic-showcase-extended/proto/BUILD.bazel +++ b/showcase/gapic-showcase-extended/proto/BUILD.bazel @@ -29,6 +29,8 @@ package(default_visibility = ["//visibility:public"]) proto_library( name = "showcase_proto_extended", - srcs = [], - deps = [] + srcs = [":wicked.proto"], + deps = [ + "@com_google_googleapis//google/api:client_proto", + ] ) \ No newline at end of file From ca740ba66f4cb16d9e2658e7b5db95beac27f179 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Thu, 25 May 2023 16:18:48 -0400 Subject: [PATCH 03/18] test: add proto to reproduce type collision issue --- .../gapic-showcase-extended/proto/BUILD.bazel | 19 ++++--- .../proto/collisions.proto | 49 +++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 showcase/gapic-showcase-extended/proto/collisions.proto diff --git a/showcase/gapic-showcase-extended/proto/BUILD.bazel b/showcase/gapic-showcase-extended/proto/BUILD.bazel index 23577e8061..91de49e161 100644 --- a/showcase/gapic-showcase-extended/proto/BUILD.bazel +++ b/showcase/gapic-showcase-extended/proto/BUILD.bazel @@ -16,7 +16,8 @@ Provides proto_library target Exports grpc service config """ -load ("@rules_proto//proto:defs.bzl", "proto_library") + +load("@rules_proto//proto:defs.bzl", "proto_library") # This is an API workspace, having public visibility by default makes perfect sense. package(default_visibility = ["//visibility:public"]) @@ -28,9 +29,13 @@ package(default_visibility = ["//visibility:public"]) # gapic-showcase-extension project is used to test the generator's behavior proto_library( - name = "showcase_proto_extended", - srcs = [":wicked.proto"], - deps = [ - "@com_google_googleapis//google/api:client_proto", - ] -) \ No newline at end of file + name = "showcase_proto_extended", + srcs = [ + ":collisions.proto", + ":wicked.proto", + ], + deps = [ + "@com_google_googleapis//google/api:client_proto", + "@com_google_googleapis//google/longrunning:operations_proto", + ], +) diff --git a/showcase/gapic-showcase-extended/proto/collisions.proto b/showcase/gapic-showcase-extended/proto/collisions.proto new file mode 100644 index 0000000000..009fcd77f9 --- /dev/null +++ b/showcase/gapic-showcase-extended/proto/collisions.proto @@ -0,0 +1,49 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +import "google/api/client.proto"; +import "google/longrunning/operations.proto"; + +package google.showcase.v1beta1; + +option java_package = "com.google.showcase.v1beta1"; +option java_multiple_files = true; + +service Collisions { + + option (google.api.default_host) = "localhost:7469"; + + rpc doSomething(Request) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + response_type: "Annotation" + metadata_type: "Location" + }; + } +} + +message Request { + string name = 1; + Annotation annotation = 2; + Location location = 3; +} + +message Annotation { + string name = 1; +} + +message Location { + string name = 1; +} \ No newline at end of file From 7ce408463c32c28cba63cc6e9a2d427a95cdd3f3 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Tue, 30 May 2023 21:43:09 -0400 Subject: [PATCH 04/18] test: add golden generated files for wicked and collisions protos --- .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 39 + .../create/SyncCreateSetEndpoint.java | 41 + .../dosomething/AsyncDoSomething.java | 52 ++ .../dosomething/AsyncDoSomethingLRO.java | 55 ++ .../dosomething/SyncDoSomething.java | 50 + .../getlocation/AsyncGetLocation.java | 45 + .../getlocation/SyncGetLocation.java | 42 + .../listlocations/AsyncListLocations.java | 54 ++ .../AsyncListLocationsPaged.java | 61 ++ .../listlocations/SyncListLocations.java | 50 + .../getlocation/SyncGetLocation.java | 48 + .../getlocation/SyncGetLocation.java | 48 + .../craftevilplan/SyncCraftEvilPlan.java | 48 + .../AsyncBrainstormEvilPlans.java | 49 + .../craftevilplan/AsyncCraftEvilPlan.java | 46 + .../craftevilplan/SyncCraftEvilPlan.java | 43 + .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 39 + .../wicked/create/SyncCreateSetEndpoint.java | 40 + .../wicked/getlocation/AsyncGetLocation.java | 45 + .../wicked/getlocation/SyncGetLocation.java | 42 + .../listlocations/AsyncListLocations.java | 53 ++ .../AsyncListLocationsPaged.java | 61 ++ .../listlocations/SyncListLocations.java | 50 + .../AsyncPersuadeEvilPlan.java | 63 ++ .../craftevilplan/SyncCraftEvilPlan.java | 48 + .../showcase/v1beta1/CollisionsClient.java | 557 +++++++++++ .../showcase/v1beta1/CollisionsSettings.java | 256 +++++ .../google/showcase/v1beta1/WickedClient.java | 554 +++++++++++ .../showcase/v1beta1/WickedSettings.java | 256 +++++ .../showcase/v1beta1/gapic_metadata.json | 42 + .../google/showcase/v1beta1/package-info.java | 38 + .../showcase/v1beta1/stub/CollisionsStub.java | 80 ++ .../v1beta1/stub/CollisionsStubSettings.java | 492 ++++++++++ .../stub/GrpcCollisionsCallableFactory.java | 115 +++ .../v1beta1/stub/GrpcCollisionsStub.java | 251 +++++ .../stub/GrpcWickedCallableFactory.java | 115 +++ .../showcase/v1beta1/stub/GrpcWickedStub.java | 274 ++++++ .../HttpJsonCollisionsCallableFactory.java | 105 +++ .../v1beta1/stub/HttpJsonCollisionsStub.java | 295 ++++++ .../stub/HttpJsonWickedCallableFactory.java | 105 +++ .../v1beta1/stub/HttpJsonWickedStub.java | 274 ++++++ .../showcase/v1beta1/stub/WickedStub.java | 71 ++ .../v1beta1/stub/WickedStubSettings.java | 458 +++++++++ .../v1beta1/CollisionsClientHttpJsonTest.java | 204 ++++ .../v1beta1/CollisionsClientTest.java | 257 ++++++ .../showcase/v1beta1/MockCollisions.java | 59 ++ .../showcase/v1beta1/MockCollisionsImpl.java | 81 ++ .../google/showcase/v1beta1/MockWicked.java | 59 ++ .../showcase/v1beta1/MockWickedImpl.java | 154 ++++ .../v1beta1/WickedClientHttpJsonTest.java | 216 +++++ .../showcase/v1beta1/WickedClientTest.java | 326 +++++++ .../showcase/v1beta1/CollisionsGrpc.java | 293 ++++++ .../google/showcase/v1beta1/WickedGrpc.java | 409 ++++++++ .../google/showcase/v1beta1/Annotation.java | 509 ++++++++++ .../showcase/v1beta1/AnnotationOrBuilder.java | 21 + .../v1beta1/CollisionsOuterClass.java | 90 ++ .../google/showcase/v1beta1/EvilRequest.java | 509 ++++++++++ .../v1beta1/EvilRequestOrBuilder.java | 21 + .../google/showcase/v1beta1/EvilResponse.java | 509 ++++++++++ .../v1beta1/EvilResponseOrBuilder.java | 21 + .../com/google/showcase/v1beta1/Location.java | 509 ++++++++++ .../showcase/v1beta1/LocationOrBuilder.java | 21 + .../com/google/showcase/v1beta1/Request.java | 871 ++++++++++++++++++ .../showcase/v1beta1/RequestOrBuilder.java | 51 + .../showcase/v1beta1/WickedOuterClass.java | 79 ++ 67 files changed, 10907 insertions(+) create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java create mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java create mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java create mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java create mode 100644 showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java create mode 100644 showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java create mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 0000000000..507734e8e2 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.showcase.v1beta1.CollisionsClient; +import com.google.showcase.v1beta1.CollisionsSettings; +import com.google.showcase.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CollisionsSettings collisionsSettings = + CollisionsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings); + } +} +// [END localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 0000000000..a60f10c365 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider1_sync] +import com.google.showcase.v1beta1.CollisionsClient; +import com.google.showcase.v1beta1.CollisionsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CollisionsSettings collisionsSettings = CollisionsSettings.newHttpJsonBuilder().build(); + CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings); + } +} +// [END localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider1_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java new file mode 100644 index 0000000000..45bf928ae6 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_Create_SetEndpoint_sync] +import com.google.showcase.v1beta1.CollisionsClient; +import com.google.showcase.v1beta1.CollisionsSettings; +import com.google.showcase.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CollisionsSettings collisionsSettings = + CollisionsSettings.newBuilder().setEndpoint(myEndpoint).build(); + CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings); + } +} +// [END localhost7469_v1beta1_generated_Collisions_Create_SetEndpoint_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java new file mode 100644 index 0000000000..8cdc664bbd --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_DoSomething_async] +import com.google.api.core.ApiFuture; +import com.google.longrunning.Operation; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.CollisionsClient; +import com.google.showcase.v1beta1.Location; +import com.google.showcase.v1beta1.Request; + +public class AsyncDoSomething { + + public static void main(String[] args) throws Exception { + asyncDoSomething(); + } + + public static void asyncDoSomething() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + Request request = + Request.newBuilder() + .setName("name3373707") + .setAnnotation(Annotation.newBuilder().build()) + .setLocation(Location.newBuilder().build()) + .build(); + ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_DoSomething_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java new file mode 100644 index 0000000000..0db7250549 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.CollisionsClient; +import com.google.showcase.v1beta1.Location; +import com.google.showcase.v1beta1.Request; + +public class AsyncDoSomethingLRO { + + public static void main(String[] args) throws Exception { + asyncDoSomethingLRO(); + } + + public static void asyncDoSomethingLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + Request request = + Request.newBuilder() + .setName("name3373707") + .setAnnotation(Annotation.newBuilder().build()) + .setLocation(Location.newBuilder().build()) + .build(); + OperationFuture< + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + future = collisionsClient.doSomethingOperationCallable().futureCall(request); + // Do something. + DescriptorProtos.GeneratedCodeInfo.Annotation response = future.get(); + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java new file mode 100644 index 0000000000..dbc79d6476 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_DoSomething_sync] +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.CollisionsClient; +import com.google.showcase.v1beta1.Location; +import com.google.showcase.v1beta1.Request; + +public class SyncDoSomething { + + public static void main(String[] args) throws Exception { + syncDoSomething(); + } + + public static void syncDoSomething() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + Request request = + Request.newBuilder() + .setName("name3373707") + .setAnnotation(Annotation.newBuilder().build()) + .setLocation(Location.newBuilder().build()) + .build(); + DescriptorProtos.GeneratedCodeInfo.Annotation response = + collisionsClient.doSomethingAsync(request).get(); + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_DoSomething_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java new file mode 100644 index 0000000000..2ec2689e0e --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.CollisionsClient; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = collisionsClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_GetLocation_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java new file mode 100644 index 0000000000..fb594b8e79 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_GetLocation_sync] +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.CollisionsClient; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = collisionsClient.getLocation(request); + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_GetLocation_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java new file mode 100644 index 0000000000..83716796aa --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.CollisionsClient; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + collisionsClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_ListLocations_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 0000000000..817d99ba25 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_ListLocations_Paged_async] +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; +import com.google.showcase.v1beta1.CollisionsClient; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = collisionsClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_ListLocations_Paged_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java new file mode 100644 index 0000000000..a37b330b89 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Collisions_ListLocations_sync] +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.CollisionsClient; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (CollisionsClient collisionsClient = CollisionsClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : collisionsClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END localhost7469_v1beta1_generated_Collisions_ListLocations_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java new file mode 100644 index 0000000000..f9dfd67664 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_CollisionsSettings_GetLocation_sync] +import com.google.showcase.v1beta1.CollisionsSettings; +import java.time.Duration; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CollisionsSettings.Builder collisionsSettingsBuilder = CollisionsSettings.newBuilder(); + collisionsSettingsBuilder + .getLocationSettings() + .setRetrySettings( + collisionsSettingsBuilder + .getLocationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CollisionsSettings collisionsSettings = collisionsSettingsBuilder.build(); + } +} +// [END localhost7469_v1beta1_generated_CollisionsSettings_GetLocation_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java new file mode 100644 index 0000000000..dce0590ab3 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub.samples; + +// [START localhost7469_v1beta1_generated_CollisionsStubSettings_GetLocation_sync] +import com.google.showcase.v1beta1.stub.CollisionsStubSettings; +import java.time.Duration; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + CollisionsStubSettings.Builder collisionsSettingsBuilder = CollisionsStubSettings.newBuilder(); + collisionsSettingsBuilder + .getLocationSettings() + .setRetrySettings( + collisionsSettingsBuilder + .getLocationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CollisionsStubSettings collisionsSettings = collisionsSettingsBuilder.build(); + } +} +// [END localhost7469_v1beta1_generated_CollisionsStubSettings_GetLocation_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java new file mode 100644 index 0000000000..de6207f682 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub.samples; + +// [START localhost7469_v1beta1_generated_WickedStubSettings_CraftEvilPlan_sync] +import com.google.showcase.v1beta1.stub.WickedStubSettings; +import java.time.Duration; + +public class SyncCraftEvilPlan { + + public static void main(String[] args) throws Exception { + syncCraftEvilPlan(); + } + + public static void syncCraftEvilPlan() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + WickedStubSettings.Builder wickedSettingsBuilder = WickedStubSettings.newBuilder(); + wickedSettingsBuilder + .craftEvilPlanSettings() + .setRetrySettings( + wickedSettingsBuilder + .craftEvilPlanSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + WickedStubSettings wickedSettings = wickedSettingsBuilder.build(); + } +} +// [END localhost7469_v1beta1_generated_WickedStubSettings_CraftEvilPlan_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java new file mode 100644 index 0000000000..8bcb58afbb --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_BrainstormEvilPlans_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import com.google.showcase.v1beta1.WickedClient; + +public class AsyncBrainstormEvilPlans { + + public static void main(String[] args) throws Exception { + asyncBrainstormEvilPlans(); + } + + public static void asyncBrainstormEvilPlans() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + BidiStream bidiStream = + wickedClient.brainstormEvilPlansCallable().call(); + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + bidiStream.send(request); + for (EvilResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_BrainstormEvilPlans_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java new file mode 100644 index 0000000000..8be0e67e7c --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_async] +import com.google.api.core.ApiFuture; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import com.google.showcase.v1beta1.WickedClient; + +public class AsyncCraftEvilPlan { + + public static void main(String[] args) throws Exception { + asyncCraftEvilPlan(); + } + + public static void asyncCraftEvilPlan() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + ApiFuture future = wickedClient.craftEvilPlanCallable().futureCall(request); + // Do something. + EvilResponse response = future.get(); + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java new file mode 100644 index 0000000000..4b7aeb0f9c --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_sync] +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import com.google.showcase.v1beta1.WickedClient; + +public class SyncCraftEvilPlan { + + public static void main(String[] args) throws Exception { + syncCraftEvilPlan(); + } + + public static void syncCraftEvilPlan() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + EvilResponse response = wickedClient.craftEvilPlan(request); + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 0000000000..c4eb08016b --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.showcase.v1beta1.WickedClient; +import com.google.showcase.v1beta1.WickedSettings; +import com.google.showcase.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + WickedSettings wickedSettings = + WickedSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + WickedClient wickedClient = WickedClient.create(wickedSettings); + } +} +// [END localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 0000000000..904ca354a6 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider1_sync] +import com.google.showcase.v1beta1.WickedClient; +import com.google.showcase.v1beta1.WickedSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + WickedSettings wickedSettings = WickedSettings.newHttpJsonBuilder().build(); + WickedClient wickedClient = WickedClient.create(wickedSettings); + } +} +// [END localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider1_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java new file mode 100644 index 0000000000..bff6d56f2b --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_Create_SetEndpoint_sync] +import com.google.showcase.v1beta1.WickedClient; +import com.google.showcase.v1beta1.WickedSettings; +import com.google.showcase.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + WickedSettings wickedSettings = WickedSettings.newBuilder().setEndpoint(myEndpoint).build(); + WickedClient wickedClient = WickedClient.create(wickedSettings); + } +} +// [END localhost7469_v1beta1_generated_Wicked_Create_SetEndpoint_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java new file mode 100644 index 0000000000..e2228a9939 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_GetLocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.WickedClient; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = wickedClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_GetLocation_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java new file mode 100644 index 0000000000..9a30312e45 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_GetLocation_sync] +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.WickedClient; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = wickedClient.getLocation(request); + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_GetLocation_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java new file mode 100644 index 0000000000..0ea2d5884a --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_ListLocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.WickedClient; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = wickedClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_ListLocations_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 0000000000..c68cc6191a --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_ListLocations_Paged_async] +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.base.Strings; +import com.google.showcase.v1beta1.WickedClient; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = wickedClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_ListLocations_Paged_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java new file mode 100644 index 0000000000..f17136c827 --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_ListLocations_sync] +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.WickedClient; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : wickedClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_ListLocations_sync] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java new file mode 100644 index 0000000000..88d9d4f18e --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java @@ -0,0 +1,63 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_Wicked_PersuadeEvilPlan_async] +import com.google.api.gax.rpc.ApiStreamObserver; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import com.google.showcase.v1beta1.WickedClient; + +public class AsyncPersuadeEvilPlan { + + public static void main(String[] args) throws Exception { + asyncPersuadeEvilPlan(); + } + + public static void asyncPersuadeEvilPlan() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (WickedClient wickedClient = WickedClient.create()) { + ApiStreamObserver responseObserver = + new ApiStreamObserver() { + @Override + public void onNext(EvilResponse response) { + // Do something when a response is received. + } + + @Override + public void onError(Throwable t) { + // Add error-handling + } + + @Override + public void onCompleted() { + // Do something when complete. + } + }; + ApiStreamObserver requestObserver = + wickedClient.persuadeEvilPlan().clientStreamingCall(responseObserver); + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + requestObserver.onNext(request); + } + } +} +// [END localhost7469_v1beta1_generated_Wicked_PersuadeEvilPlan_async] diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java new file mode 100644 index 0000000000..ee9bc599ad --- /dev/null +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.samples; + +// [START localhost7469_v1beta1_generated_WickedSettings_CraftEvilPlan_sync] +import com.google.showcase.v1beta1.WickedSettings; +import java.time.Duration; + +public class SyncCraftEvilPlan { + + public static void main(String[] args) throws Exception { + syncCraftEvilPlan(); + } + + public static void syncCraftEvilPlan() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + WickedSettings.Builder wickedSettingsBuilder = WickedSettings.newBuilder(); + wickedSettingsBuilder + .craftEvilPlanSettings() + .setRetrySettings( + wickedSettingsBuilder + .craftEvilPlanSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + WickedSettings wickedSettings = wickedSettingsBuilder.build(); + } +} +// [END localhost7469_v1beta1_generated_WickedSettings_CraftEvilPlan_sync] diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java new file mode 100644 index 0000000000..133186ef2a --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java @@ -0,0 +1,557 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.stub.CollisionsStub; +import com.google.showcase.v1beta1.stub.CollisionsStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * This class provides the ability to make remote calls to the backing service through method calls + * that map to API methods. Sample code to get started: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+ *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ *   Location response = collisionsClient.getLocation(request);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the CollisionsClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of CollisionsSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * CollisionsSettings collisionsSettings =
+ *     CollisionsSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * CollisionsSettings collisionsSettings =
+ *     CollisionsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * CollisionsSettings collisionsSettings = CollisionsSettings.newHttpJsonBuilder().build();
+ * CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class CollisionsClient implements BackgroundResource { + private final CollisionsSettings settings; + private final CollisionsStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of CollisionsClient with default settings. */ + public static final CollisionsClient create() throws IOException { + return create(CollisionsSettings.newBuilder().build()); + } + + /** + * Constructs an instance of CollisionsClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final CollisionsClient create(CollisionsSettings settings) throws IOException { + return new CollisionsClient(settings); + } + + /** + * Constructs an instance of CollisionsClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(CollisionsSettings). + */ + public static final CollisionsClient create(CollisionsStub stub) { + return new CollisionsClient(stub); + } + + /** + * Constructs an instance of CollisionsClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected CollisionsClient(CollisionsSettings settings) throws IOException { + this.settings = settings; + this.stub = ((CollisionsStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected CollisionsClient(CollisionsStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final CollisionsSettings getSettings() { + return settings; + } + + public CollisionsStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   Request request =
+   *       Request.newBuilder()
+   *           .setName("name3373707")
+   *           .setAnnotation(Annotation.newBuilder().build())
+   *           .setLocation(Location.newBuilder().build())
+   *           .build();
+   *   DescriptorProtos.GeneratedCodeInfo.Annotation response =
+   *       collisionsClient.doSomethingAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture< + DescriptorProtos.GeneratedCodeInfo.Annotation, DescriptorProtos.SourceCodeInfo.Location> + doSomethingAsync(Request request) { + return doSomethingOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   Request request =
+   *       Request.newBuilder()
+   *           .setName("name3373707")
+   *           .setAnnotation(Annotation.newBuilder().build())
+   *           .setLocation(Location.newBuilder().build())
+   *           .build();
+   *   OperationFuture<
+   *           DescriptorProtos.GeneratedCodeInfo.Annotation,
+   *           DescriptorProtos.SourceCodeInfo.Location>
+   *       future = collisionsClient.doSomethingOperationCallable().futureCall(request);
+   *   // Do something.
+   *   DescriptorProtos.GeneratedCodeInfo.Annotation response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationCallable() { + return stub.doSomethingOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   Request request =
+   *       Request.newBuilder()
+   *           .setName("name3373707")
+   *           .setAnnotation(Annotation.newBuilder().build())
+   *           .setLocation(Location.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable doSomethingCallable() { + return stub.doSomethingCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : collisionsClient.listLocations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       collisionsClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = collisionsClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = collisionsClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = collisionsClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java new file mode 100644 index 0000000000..b097ebb056 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java @@ -0,0 +1,256 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.longrunning.Operation; +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.stub.CollisionsStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link CollisionsClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (localhost) and default port (7469) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getLocation to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * CollisionsSettings.Builder collisionsSettingsBuilder = CollisionsSettings.newBuilder();
+ * collisionsSettingsBuilder
+ *     .getLocationSettings()
+ *     .setRetrySettings(
+ *         collisionsSettingsBuilder
+ *             .getLocationSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * CollisionsSettings collisionsSettings = collisionsSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class CollisionsSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to doSomething. */ + public UnaryCallSettings doSomethingSettings() { + return ((CollisionsStubSettings) getStubSettings()).doSomethingSettings(); + } + + /** Returns the object with the settings used for calls to doSomething. */ + public OperationCallSettings< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationSettings() { + return ((CollisionsStubSettings) getStubSettings()).doSomethingOperationSettings(); + } + + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((CollisionsStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((CollisionsStubSettings) getStubSettings()).getLocationSettings(); + } + + public static final CollisionsSettings create(CollisionsStubSettings stub) throws IOException { + return new CollisionsSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return CollisionsStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return CollisionsStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return CollisionsStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return CollisionsStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return CollisionsStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return CollisionsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return CollisionsStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CollisionsStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected CollisionsSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for CollisionsSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(CollisionsStubSettings.newBuilder(clientContext)); + } + + protected Builder(CollisionsSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(CollisionsStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(CollisionsStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(CollisionsStubSettings.newHttpJsonBuilder()); + } + + public CollisionsStubSettings.Builder getStubSettingsBuilder() { + return ((CollisionsStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to doSomething. */ + public UnaryCallSettings.Builder doSomethingSettings() { + return getStubSettingsBuilder().doSomethingSettings(); + } + + /** Returns the builder for the settings used for calls to doSomething. */ + public OperationCallSettings.Builder< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationSettings() { + return getStubSettingsBuilder().doSomethingOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + + @Override + public CollisionsSettings build() throws IOException { + return new CollisionsSettings(this); + } + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java new file mode 100644 index 0000000000..9a4fc0ec99 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java @@ -0,0 +1,554 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.showcase.v1beta1.stub.WickedStub; +import com.google.showcase.v1beta1.stub.WickedStubSettings; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: This service is used to show a Service with either non-enabled or + * non-eligible RPCs for HttpJson (Http 1.1). Non-Enabled: Missing the (google.api.http) annotation + * to enabled it Non-Eligible: BIDI and Client side streaming are not supported with Http 1.1 + * Service name is reference to `No REST for the Wicked` + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (WickedClient wickedClient = WickedClient.create()) {
+ *   EvilRequest request =
+ *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
+ *   EvilResponse response = wickedClient.craftEvilPlan(request);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the WickedClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of WickedSettings to create(). + * For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * WickedSettings wickedSettings =
+ *     WickedSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * WickedClient wickedClient = WickedClient.create(wickedSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * WickedSettings wickedSettings = WickedSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * WickedClient wickedClient = WickedClient.create(wickedSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * WickedSettings wickedSettings = WickedSettings.newHttpJsonBuilder().build();
+ * WickedClient wickedClient = WickedClient.create(wickedSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class WickedClient implements BackgroundResource { + private final WickedSettings settings; + private final WickedStub stub; + + /** Constructs an instance of WickedClient with default settings. */ + public static final WickedClient create() throws IOException { + return create(WickedSettings.newBuilder().build()); + } + + /** + * Constructs an instance of WickedClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final WickedClient create(WickedSettings settings) throws IOException { + return new WickedClient(settings); + } + + /** + * Constructs an instance of WickedClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(WickedSettings). + */ + public static final WickedClient create(WickedStub stub) { + return new WickedClient(stub); + } + + /** + * Constructs an instance of WickedClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected WickedClient(WickedSettings settings) throws IOException { + this.settings = settings; + this.stub = ((WickedStubSettings) settings.getStubSettings()).createStub(); + } + + protected WickedClient(WickedStub stub) { + this.settings = null; + this.stub = stub; + } + + public final WickedSettings getSettings() { + return settings; + } + + public WickedStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   EvilRequest request =
+   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
+   *   EvilResponse response = wickedClient.craftEvilPlan(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EvilResponse craftEvilPlan(EvilRequest request) { + return craftEvilPlanCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   EvilRequest request =
+   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
+   *   ApiFuture future = wickedClient.craftEvilPlanCallable().futureCall(request);
+   *   // Do something.
+   *   EvilResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable craftEvilPlanCallable() { + return stub.craftEvilPlanCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   BidiStream bidiStream =
+   *       wickedClient.brainstormEvilPlansCallable().call();
+   *   EvilRequest request =
+   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
+   *   bidiStream.send(request);
+   *   for (EvilResponse response : bidiStream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final BidiStreamingCallable brainstormEvilPlansCallable() { + return stub.brainstormEvilPlansCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sample code: + * + *
{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   ApiStreamObserver responseObserver =
+   *       new ApiStreamObserver() {
+   *         {@literal @}Override
+   *         public void onNext(EvilResponse response) {
+   *           // Do something when a response is received.
+   *         }
+   *
+   *         {@literal @}Override
+   *         public void onError(Throwable t) {
+   *           // Add error-handling
+   *         }
+   *
+   *         {@literal @}Override
+   *         public void onCompleted() {
+   *           // Do something when complete.
+   *         }
+   *       };
+   *   ApiStreamObserver requestObserver =
+   *       wickedClient.persuadeEvilPlan().clientStreamingCall(responseObserver);
+   *   EvilRequest request =
+   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
+   *   requestObserver.onNext(request);
+   * }
+   * }
+ */ + public final ClientStreamingCallable persuadeEvilPlanCallable() { + return stub.persuadeEvilPlanCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Location element : wickedClient.listLocations(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = wickedClient.listLocationsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Location element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listLocationsPagedCallable() { + return stub.listLocationsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   ListLocationsRequest request =
+   *       ListLocationsRequest.newBuilder()
+   *           .setName("name3373707")
+   *           .setFilter("filter-1274492040")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListLocationsResponse response = wickedClient.listLocationsCallable().call(request);
+   *     for (Location element : response.getLocationsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listLocationsCallable() { + return stub.listLocationsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   Location response = wickedClient.getLocation(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (WickedClient wickedClient = WickedClient.create()) {
+   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = wickedClient.getLocationCallable().futureCall(request);
+   *   // Do something.
+   *   Location response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getLocationCallable() { + return stub.getLocationCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListLocationsPagedResponse + extends AbstractPagedListResponse< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListLocationsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListLocationsPagedResponse(ListLocationsPage page) { + super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListLocationsPage + extends AbstractPage< + ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { + + private ListLocationsPage( + PageContext context, + ListLocationsResponse response) { + super(context, response); + } + + private static ListLocationsPage createEmptyPage() { + return new ListLocationsPage(null, null); + } + + @Override + protected ListLocationsPage createPage( + PageContext context, + ListLocationsResponse response) { + return new ListLocationsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListLocationsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListLocationsRequest, + ListLocationsResponse, + Location, + ListLocationsPage, + ListLocationsFixedSizeCollection> { + + private ListLocationsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListLocationsFixedSizeCollection createEmptyCollection() { + return new ListLocationsFixedSizeCollection(null, 0); + } + + @Override + protected ListLocationsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListLocationsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java new file mode 100644 index 0000000000..d818e2a2bf --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java @@ -0,0 +1,256 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.stub.WickedStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link WickedClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (localhost) and default port (7469) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of craftEvilPlan to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * WickedSettings.Builder wickedSettingsBuilder = WickedSettings.newBuilder();
+ * wickedSettingsBuilder
+ *     .craftEvilPlanSettings()
+ *     .setRetrySettings(
+ *         wickedSettingsBuilder
+ *             .craftEvilPlanSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * WickedSettings wickedSettings = wickedSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class WickedSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to craftEvilPlan. */ + public UnaryCallSettings craftEvilPlanSettings() { + return ((WickedStubSettings) getStubSettings()).craftEvilPlanSettings(); + } + + /** Returns the object with the settings used for calls to brainstormEvilPlans. */ + public StreamingCallSettings brainstormEvilPlansSettings() { + return ((WickedStubSettings) getStubSettings()).brainstormEvilPlansSettings(); + } + + /** Returns the object with the settings used for calls to persuadeEvilPlan. */ + public StreamingCallSettings persuadeEvilPlanSettings() { + return ((WickedStubSettings) getStubSettings()).persuadeEvilPlanSettings(); + } + + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return ((WickedStubSettings) getStubSettings()).listLocationsSettings(); + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return ((WickedStubSettings) getStubSettings()).getLocationSettings(); + } + + public static final WickedSettings create(WickedStubSettings stub) throws IOException { + return new WickedSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return WickedStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return WickedStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return WickedStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return WickedStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return WickedStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return WickedStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return WickedStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return WickedStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected WickedSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for WickedSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(WickedStubSettings.newBuilder(clientContext)); + } + + protected Builder(WickedSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(WickedStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(WickedStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(WickedStubSettings.newHttpJsonBuilder()); + } + + public WickedStubSettings.Builder getStubSettingsBuilder() { + return ((WickedStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to craftEvilPlan. */ + public UnaryCallSettings.Builder craftEvilPlanSettings() { + return getStubSettingsBuilder().craftEvilPlanSettings(); + } + + /** Returns the builder for the settings used for calls to brainstormEvilPlans. */ + public StreamingCallSettings.Builder brainstormEvilPlansSettings() { + return getStubSettingsBuilder().brainstormEvilPlansSettings(); + } + + /** Returns the builder for the settings used for calls to persuadeEvilPlan. */ + public StreamingCallSettings.Builder persuadeEvilPlanSettings() { + return getStubSettingsBuilder().persuadeEvilPlanSettings(); + } + + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return getStubSettingsBuilder().listLocationsSettings(); + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getStubSettingsBuilder().getLocationSettings(); + } + + @Override + public WickedSettings build() throws IOException { + return new WickedSettings(this); + } + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json index b79bfb905f..ec839e018f 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json @@ -250,6 +250,48 @@ } } } + }, + "Collisions": { + "clients": { + "grpc": { + "libraryClient": "CollisionsClient", + "rpcs": { + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, + "doSomething": { + "methods": ["doSomethingAsync", "doSomethingOperationCallable", "doSomethingCallable"] + } + } + } + } + }, + "Wicked": { + "clients": { + "grpc": { + "libraryClient": "WickedClient", + "rpcs": { + "BrainstormEvilPlans": { + "methods": ["brainstormEvilPlansCallable"] + }, + "CraftEvilPlan": { + "methods": ["craftEvilPlan", "craftEvilPlanCallable"] + }, + "GetLocation": { + "methods": ["getLocation", "getLocationCallable"] + }, + "ListLocations": { + "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] + }, + "PersuadeEvilPlan": { + "methods": ["persuadeEvilPlanCallable"] + } + } + } + } } } } \ No newline at end of file diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java index be1926a090..c198371fb0 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java @@ -155,6 +155,44 @@ * Session response = testingClient.createSession(request); * } * } + * + *

======================= CollisionsClient ======================= + * + *

Sample for CollisionsClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
+ *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ *   Location response = collisionsClient.getLocation(request);
+ * }
+ * }
+ * + *

======================= WickedClient ======================= + * + *

Service Description: This service is used to show a Service with either non-enabled or + * non-eligible RPCs for HttpJson (Http 1.1). Non-Enabled: Missing the (google.api.http) annotation + * to enabled it Non-Eligible: BIDI and Client side streaming are not supported with Http 1.1 + * Service name is reference to `No REST for the Wicked` + * + *

Sample for WickedClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (WickedClient wickedClient = WickedClient.create()) {
+ *   EvilRequest request =
+ *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
+ *   EvilResponse response = wickedClient.craftEvilPlan(request);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.showcase.v1beta1; diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java new file mode 100644 index 0000000000..efdbba6e54 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java @@ -0,0 +1,80 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Request; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Collisions service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public abstract class CollisionsStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public OperationCallable< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationCallable() { + throw new UnsupportedOperationException("Not implemented: doSomethingOperationCallable()"); + } + + public UnaryCallable doSomethingCallable() { + throw new UnsupportedOperationException("Not implemented: doSomethingCallable()"); + } + + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java new file mode 100644 index 0000000000..202c08ae6a --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java @@ -0,0 +1,492 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Request; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link CollisionsStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (localhost) and default port (7469) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getLocation to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * CollisionsStubSettings.Builder collisionsSettingsBuilder = CollisionsStubSettings.newBuilder();
+ * collisionsSettingsBuilder
+ *     .getLocationSettings()
+ *     .setRetrySettings(
+ *         collisionsSettingsBuilder
+ *             .getLocationSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * CollisionsStubSettings collisionsSettings = collisionsSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class CollisionsStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().build(); + + private final UnaryCallSettings doSomethingSettings; + private final OperationCallSettings< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to doSomething. */ + public UnaryCallSettings doSomethingSettings() { + return doSomethingSettings; + } + + /** Returns the object with the settings used for calls to doSomething. */ + public OperationCallSettings< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationSettings() { + return doSomethingOperationSettings; + } + + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + + public CollisionsStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcCollisionsStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonCollisionsStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "localhost:7469"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "localhost:7469"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(CollisionsStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(CollisionsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CollisionsStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected CollisionsStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + doSomethingSettings = settingsBuilder.doSomethingSettings().build(); + doSomethingOperationSettings = settingsBuilder.doSomethingOperationSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); + } + + /** Builder for CollisionsStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder doSomethingSettings; + private final OperationCallSettings.Builder< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + doSomethingSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + doSomethingOperationSettings = OperationCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + doSomethingSettings, listLocationsSettings, getLocationSettings); + initDefaults(this); + } + + protected Builder(CollisionsStubSettings settings) { + super(settings); + + doSomethingSettings = settings.doSomethingSettings.toBuilder(); + doSomethingOperationSettings = settings.doSomethingOperationSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + doSomethingSettings, listLocationsSettings, getLocationSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .doSomethingSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .doSomethingOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create( + DescriptorProtos.GeneratedCodeInfo.Annotation.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create( + DescriptorProtos.SourceCodeInfo.Location.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to doSomething. */ + public UnaryCallSettings.Builder doSomethingSettings() { + return doSomethingSettings; + } + + /** Returns the builder for the settings used for calls to doSomething. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationSettings() { + return doSomethingOperationSettings; + } + + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + + @Override + public CollisionsStubSettings build() throws IOException { + return new CollisionsStubSettings(this); + } + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java new file mode 100644 index 0000000000..6c39ee28b5 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Collisions service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcCollisionsCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java new file mode 100644 index 0000000000..04db440b44 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java @@ -0,0 +1,251 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Request; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Collisions service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcCollisionsStub extends CollisionsStub { + private static final MethodDescriptor doSomethingMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.showcase.v1beta1.Collisions/doSomething") + .setRequestMarshaller(ProtoUtils.marshaller(Request.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + + private final UnaryCallable doSomethingCallable; + private final OperationCallable< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcCollisionsStub create(CollisionsStubSettings settings) + throws IOException { + return new GrpcCollisionsStub(settings, ClientContext.create(settings)); + } + + public static final GrpcCollisionsStub create(ClientContext clientContext) throws IOException { + return new GrpcCollisionsStub(CollisionsStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcCollisionsStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcCollisionsStub( + CollisionsStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcCollisionsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcCollisionsStub(CollisionsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcCollisionsCallableFactory()); + } + + /** + * Constructs an instance of GrpcCollisionsStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcCollisionsStub( + CollisionsStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings doSomethingTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(doSomethingMethodDescriptor) + .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + + this.doSomethingCallable = + callableFactory.createUnaryCallable( + doSomethingTransportSettings, settings.doSomethingSettings(), clientContext); + this.doSomethingOperationCallable = + callableFactory.createOperationCallable( + doSomethingTransportSettings, + settings.doSomethingOperationSettings(), + clientContext, + operationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable doSomethingCallable() { + return doSomethingCallable; + } + + @Override + public OperationCallable< + Request, + DescriptorProtos.GeneratedCodeInfo.Annotation, + DescriptorProtos.SourceCodeInfo.Location> + doSomethingOperationCallable() { + return doSomethingOperationCallable; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java new file mode 100644 index 0000000000..a98141bc97 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Wicked service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcWickedCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java new file mode 100644 index 0000000000..94dd0e4d01 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java @@ -0,0 +1,274 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Wicked service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcWickedStub extends WickedStub { + private static final MethodDescriptor craftEvilPlanMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.showcase.v1beta1.Wicked/CraftEvilPlan") + .setRequestMarshaller(ProtoUtils.marshaller(EvilRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EvilResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + brainstormEvilPlansMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName("google.showcase.v1beta1.Wicked/BrainstormEvilPlans") + .setRequestMarshaller(ProtoUtils.marshaller(EvilRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EvilResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + persuadeEvilPlanMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.CLIENT_STREAMING) + .setFullMethodName("google.showcase.v1beta1.Wicked/PersuadeEvilPlan") + .setRequestMarshaller(ProtoUtils.marshaller(EvilRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EvilResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listLocationsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setRequestMarshaller( + ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getLocationMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) + .build(); + + private final UnaryCallable craftEvilPlanCallable; + private final BidiStreamingCallable brainstormEvilPlansCallable; + private final ClientStreamingCallable persuadeEvilPlanCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcWickedStub create(WickedStubSettings settings) throws IOException { + return new GrpcWickedStub(settings, ClientContext.create(settings)); + } + + public static final GrpcWickedStub create(ClientContext clientContext) throws IOException { + return new GrpcWickedStub(WickedStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcWickedStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcWickedStub( + WickedStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcWickedStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected GrpcWickedStub(WickedStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcWickedCallableFactory()); + } + + /** + * Constructs an instance of GrpcWickedStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected GrpcWickedStub( + WickedStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings craftEvilPlanTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(craftEvilPlanMethodDescriptor) + .build(); + GrpcCallSettings brainstormEvilPlansTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(brainstormEvilPlansMethodDescriptor) + .build(); + GrpcCallSettings persuadeEvilPlanTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(persuadeEvilPlanMethodDescriptor) + .build(); + GrpcCallSettings listLocationsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getLocationTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + + this.craftEvilPlanCallable = + callableFactory.createUnaryCallable( + craftEvilPlanTransportSettings, settings.craftEvilPlanSettings(), clientContext); + this.brainstormEvilPlansCallable = + callableFactory.createBidiStreamingCallable( + brainstormEvilPlansTransportSettings, + settings.brainstormEvilPlansSettings(), + clientContext); + this.persuadeEvilPlanCallable = + callableFactory.createClientStreamingCallable( + persuadeEvilPlanTransportSettings, settings.persuadeEvilPlanSettings(), clientContext); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable craftEvilPlanCallable() { + return craftEvilPlanCallable; + } + + @Override + public BidiStreamingCallable brainstormEvilPlansCallable() { + return brainstormEvilPlansCallable; + } + + @Override + public ClientStreamingCallable persuadeEvilPlanCallable() { + return persuadeEvilPlanCallable; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java new file mode 100644 index 0000000000..749d6cd828 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Collisions service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonCollisionsCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java new file mode 100644 index 0000000000..58d397e5bb --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java @@ -0,0 +1,295 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.HttpRule; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.protobuf.DescriptorProtos; +import com.google.protobuf.TypeRegistry; +import com.google.showcase.v1beta1.Request; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Collisions service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonCollisionsStub extends CollisionsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(DescriptorProtos.GeneratedCodeInfo.Annotation.getDescriptor()) + .add(DescriptorProtos.SourceCodeInfo.Location.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonCollisionsStub create(CollisionsStubSettings settings) + throws IOException { + return new HttpJsonCollisionsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonCollisionsStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonCollisionsStub( + CollisionsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonCollisionsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonCollisionsStub( + CollisionsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonCollisionsStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonCollisionsStub(CollisionsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonCollisionsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonCollisionsStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonCollisionsStub( + CollisionsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create( + clientContext, + callableFactory, + typeRegistry, + ImmutableMap.builder() + .put( + "google.longrunning.Operations.CancelOperation", + HttpRule.newBuilder().setPost("/v1beta1/{name=operations/**}:cancel").build()) + .put( + "google.longrunning.Operations.DeleteOperation", + HttpRule.newBuilder().setDelete("/v1beta1/{name=operations/**}").build()) + .put( + "google.longrunning.Operations.GetOperation", + HttpRule.newBuilder().setGet("/v1beta1/{name=operations/**}").build()) + .put( + "google.longrunning.Operations.ListOperations", + HttpRule.newBuilder().setGet("/v1beta1/operations").build()) + .build()); + + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public UnaryCallable doSomethingCallable() { + throw new UnsupportedOperationException( + "Not implemented: doSomethingCallable(). REST transport is not implemented for this method yet."); + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java new file mode 100644 index 0000000000..16dde24678 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Wicked service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonWickedCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java new file mode 100644 index 0000000000..78e03df937 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java @@ -0,0 +1,274 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.protobuf.TypeRegistry; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Wicked service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonWickedStub extends WickedStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*}/locations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonWickedStub create(WickedStubSettings settings) throws IOException { + return new HttpJsonWickedStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonWickedStub create(ClientContext clientContext) throws IOException { + return new HttpJsonWickedStub(WickedStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonWickedStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonWickedStub( + WickedStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonWickedStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonWickedStub(WickedStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonWickedCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonWickedStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonWickedStub( + WickedStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public UnaryCallable craftEvilPlanCallable() { + throw new UnsupportedOperationException( + "Not implemented: craftEvilPlanCallable(). REST transport is not implemented for this method yet."); + } + + @Override + public BidiStreamingCallable brainstormEvilPlansCallable() { + throw new UnsupportedOperationException( + "Not implemented: brainstormEvilPlansCallable(). REST transport is not implemented for this method yet."); + } + + @Override + public ClientStreamingCallable persuadeEvilPlanCallable() { + throw new UnsupportedOperationException( + "Not implemented: persuadeEvilPlanCallable(). REST transport is not implemented for this method yet."); + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java new file mode 100644 index 0000000000..cd9f5d2fee --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java @@ -0,0 +1,71 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Wicked service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public abstract class WickedStub implements BackgroundResource { + + public UnaryCallable craftEvilPlanCallable() { + throw new UnsupportedOperationException("Not implemented: craftEvilPlanCallable()"); + } + + public BidiStreamingCallable brainstormEvilPlansCallable() { + throw new UnsupportedOperationException("Not implemented: brainstormEvilPlansCallable()"); + } + + public ClientStreamingCallable persuadeEvilPlanCallable() { + throw new UnsupportedOperationException("Not implemented: persuadeEvilPlanCallable()"); + } + + public UnaryCallable + listLocationsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); + } + + public UnaryCallable listLocationsCallable() { + throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); + } + + public UnaryCallable getLocationCallable() { + throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java new file mode 100644 index 0000000000..4f0d92cd66 --- /dev/null +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java @@ -0,0 +1,458 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1.stub; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.showcase.v1beta1.EvilRequest; +import com.google.showcase.v1beta1.EvilResponse; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link WickedStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (localhost) and default port (7469) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of craftEvilPlan to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * WickedStubSettings.Builder wickedSettingsBuilder = WickedStubSettings.newBuilder();
+ * wickedSettingsBuilder
+ *     .craftEvilPlanSettings()
+ *     .setRetrySettings(
+ *         wickedSettingsBuilder
+ *             .craftEvilPlanSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * WickedStubSettings wickedSettings = wickedSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class WickedStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().build(); + + private final UnaryCallSettings craftEvilPlanSettings; + private final StreamingCallSettings brainstormEvilPlansSettings; + private final StreamingCallSettings persuadeEvilPlanSettings; + private final PagedCallSettings< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings getLocationSettings; + + private static final PagedListDescriptor + LIST_LOCATIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { + return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { + return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListLocationsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListLocationsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListLocationsResponse payload) { + return payload.getLocationsList() == null + ? ImmutableList.of() + : payload.getLocationsList(); + } + }; + + private static final PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + LIST_LOCATIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListLocationsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to craftEvilPlan. */ + public UnaryCallSettings craftEvilPlanSettings() { + return craftEvilPlanSettings; + } + + /** Returns the object with the settings used for calls to brainstormEvilPlans. */ + public StreamingCallSettings brainstormEvilPlansSettings() { + return brainstormEvilPlansSettings; + } + + /** Returns the object with the settings used for calls to persuadeEvilPlan. */ + public StreamingCallSettings persuadeEvilPlanSettings() { + return persuadeEvilPlanSettings; + } + + /** Returns the object with the settings used for calls to listLocations. */ + public PagedCallSettings + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the object with the settings used for calls to getLocation. */ + public UnaryCallSettings getLocationSettings() { + return getLocationSettings; + } + + public WickedStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcWickedStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonWickedStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "localhost:7469"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "localhost:7469"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(WickedStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(WickedStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return WickedStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected WickedStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + craftEvilPlanSettings = settingsBuilder.craftEvilPlanSettings().build(); + brainstormEvilPlansSettings = settingsBuilder.brainstormEvilPlansSettings().build(); + persuadeEvilPlanSettings = settingsBuilder.persuadeEvilPlanSettings().build(); + listLocationsSettings = settingsBuilder.listLocationsSettings().build(); + getLocationSettings = settingsBuilder.getLocationSettings().build(); + } + + /** Builder for WickedStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder craftEvilPlanSettings; + private final StreamingCallSettings.Builder + brainstormEvilPlansSettings; + private final StreamingCallSettings.Builder persuadeEvilPlanSettings; + private final PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings; + private final UnaryCallSettings.Builder getLocationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + craftEvilPlanSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + brainstormEvilPlansSettings = StreamingCallSettings.newBuilder(); + persuadeEvilPlanSettings = StreamingCallSettings.newBuilder(); + listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); + getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + craftEvilPlanSettings, listLocationsSettings, getLocationSettings); + initDefaults(this); + } + + protected Builder(WickedStubSettings settings) { + super(settings); + + craftEvilPlanSettings = settings.craftEvilPlanSettings.toBuilder(); + brainstormEvilPlansSettings = settings.brainstormEvilPlansSettings.toBuilder(); + persuadeEvilPlanSettings = settings.persuadeEvilPlanSettings.toBuilder(); + listLocationsSettings = settings.listLocationsSettings.toBuilder(); + getLocationSettings = settings.getLocationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + craftEvilPlanSettings, listLocationsSettings, getLocationSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .craftEvilPlanSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listLocationsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getLocationSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to craftEvilPlan. */ + public UnaryCallSettings.Builder craftEvilPlanSettings() { + return craftEvilPlanSettings; + } + + /** Returns the builder for the settings used for calls to brainstormEvilPlans. */ + public StreamingCallSettings.Builder brainstormEvilPlansSettings() { + return brainstormEvilPlansSettings; + } + + /** Returns the builder for the settings used for calls to persuadeEvilPlan. */ + public StreamingCallSettings.Builder persuadeEvilPlanSettings() { + return persuadeEvilPlanSettings; + } + + /** Returns the builder for the settings used for calls to listLocations. */ + public PagedCallSettings.Builder< + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> + listLocationsSettings() { + return listLocationsSettings; + } + + /** Returns the builder for the settings used for calls to getLocation. */ + public UnaryCallSettings.Builder getLocationSettings() { + return getLocationSettings; + } + + @Override + public WickedStubSettings build() throws IOException { + return new WickedStubSettings(this); + } + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java new file mode 100644 index 0000000000..8b3d33fd56 --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java @@ -0,0 +1,204 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; +import com.google.showcase.v1beta1.stub.HttpJsonCollisionsStub; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class CollisionsClientHttpJsonTest { + private static MockHttpService mockService; + private static CollisionsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonCollisionsStub.getMethodDescriptors(), CollisionsSettings.getDefaultEndpoint()); + CollisionsSettings settings = + CollisionsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + CollisionsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CollisionsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void doSomethingUnsupportedMethodTest() throws Exception { + // The doSomething() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java new file mode 100644 index 0000000000..8c0876664f --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java @@ -0,0 +1,257 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.DescriptorProtos; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class CollisionsClientTest { + private static MockCollisions mockCollisions; + private static MockLocations mockLocations; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private CollisionsClient client; + + @BeforeClass + public static void startStaticServer() { + mockCollisions = new MockCollisions(); + mockLocations = new MockLocations(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockCollisions, mockLocations)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + CollisionsSettings settings = + CollisionsSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CollisionsClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void doSomethingTest() throws Exception { + DescriptorProtos.GeneratedCodeInfo.Annotation expectedResponse = + DescriptorProtos.GeneratedCodeInfo.Annotation.newBuilder() + .addAllPath(new ArrayList()) + .setSourceFile("sourceFile-1111864265") + .setBegin(93616297) + .setEnd(100571) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("doSomethingTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockCollisions.addResponse(resultOperation); + + Request request = + Request.newBuilder() + .setName("name3373707") + .setAnnotation(Annotation.newBuilder().build()) + .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) + .build(); + + DescriptorProtos.GeneratedCodeInfo.Annotation actualResponse = + client.doSomethingAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCollisions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + Request actualRequest = ((Request) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getAnnotation(), actualRequest.getAnnotation()); + Assert.assertEquals(request.getLocation(), actualRequest.getLocation()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void doSomethingExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockCollisions.addException(exception); + + try { + Request request = + Request.newBuilder() + .setName("name3373707") + .setAnnotation(Annotation.newBuilder().build()) + .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) + .build(); + client.doSomethingAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java new file mode 100644 index 0000000000..a078fda36d --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockCollisions implements MockGrpcService { + private final MockCollisionsImpl serviceImpl; + + public MockCollisions() { + serviceImpl = new MockCollisionsImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java new file mode 100644 index 0000000000..2f06a674dc --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java @@ -0,0 +1,81 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.showcase.v1beta1.CollisionsGrpc.CollisionsImplBase; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockCollisionsImpl extends CollisionsImplBase { + private List requests; + private Queue responses; + + public MockCollisionsImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void doSomething(Request request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method doSomething, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java new file mode 100644 index 0000000000..94a2d21499 --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockWicked implements MockGrpcService { + private final MockWickedImpl serviceImpl; + + public MockWicked() { + serviceImpl = new MockWickedImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java new file mode 100644 index 0000000000..0db01ba8a6 --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java @@ -0,0 +1,154 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.protobuf.AbstractMessage; +import com.google.showcase.v1beta1.WickedGrpc.WickedImplBase; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockWickedImpl extends WickedImplBase { + private List requests; + private Queue responses; + + public MockWickedImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void craftEvilPlan(EvilRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof EvilResponse) { + requests.add(request); + responseObserver.onNext(((EvilResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CraftEvilPlan, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + EvilResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public StreamObserver brainstormEvilPlans( + final StreamObserver responseObserver) { + StreamObserver requestObserver = + new StreamObserver() { + @Override + public void onNext(EvilRequest value) { + requests.add(value); + final Object response = responses.remove(); + if (response instanceof EvilResponse) { + responseObserver.onNext(((EvilResponse) response)); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method BrainstormEvilPlans, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + EvilResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onCompleted(); + } + }; + return requestObserver; + } + + @Override + public StreamObserver persuadeEvilPlan( + final StreamObserver responseObserver) { + StreamObserver requestObserver = + new StreamObserver() { + @Override + public void onNext(EvilRequest value) { + requests.add(value); + final Object response = responses.remove(); + if (response instanceof EvilResponse) { + responseObserver.onNext(((EvilResponse) response)); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method PersuadeEvilPlan, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + EvilResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onCompleted(); + } + }; + return requestObserver; + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java new file mode 100644 index 0000000000..6b68fca732 --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java @@ -0,0 +1,216 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.Any; +import com.google.showcase.v1beta1.stub.HttpJsonWickedStub; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class WickedClientHttpJsonTest { + private static MockHttpService mockService; + private static WickedClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonWickedStub.getMethodDescriptors(), WickedSettings.getDefaultEndpoint()); + WickedSettings settings = + WickedSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + WickedSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = WickedClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void craftEvilPlanUnsupportedMethodTest() throws Exception { + // The craftEvilPlan() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void brainstormEvilPlansUnsupportedMethodTest() throws Exception { + // The brainstormEvilPlans() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void persuadeEvilPlanUnsupportedMethodTest() throws Exception { + // The persuadeEvilPlan() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java new file mode 100644 index 0000000000..2ed4e3bad5 --- /dev/null +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java @@ -0,0 +1,326 @@ +/* + * Copyright 2022 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. + */ + +package com.google.showcase.v1beta1; + +import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.grpc.testing.MockStreamObserver; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiStreamObserver; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class WickedClientTest { + private static MockLocations mockLocations; + private static MockServiceHelper mockServiceHelper; + private static MockWicked mockWicked; + private LocalChannelProvider channelProvider; + private WickedClient client; + + @BeforeClass + public static void startStaticServer() { + mockWicked = new MockWicked(); + mockLocations = new MockLocations(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockWicked, mockLocations)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + WickedSettings settings = + WickedSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = WickedClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void craftEvilPlanTest() throws Exception { + EvilResponse expectedResponse = + EvilResponse.newBuilder().setMaliciousPlan("maliciousPlan712757759").build(); + mockWicked.addResponse(expectedResponse); + + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + + EvilResponse actualResponse = client.craftEvilPlan(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockWicked.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + EvilRequest actualRequest = ((EvilRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getMaliciousIdea(), actualRequest.getMaliciousIdea()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void craftEvilPlanExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWicked.addException(exception); + + try { + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + client.craftEvilPlan(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void brainstormEvilPlansTest() throws Exception { + EvilResponse expectedResponse = + EvilResponse.newBuilder().setMaliciousPlan("maliciousPlan712757759").build(); + mockWicked.addResponse(expectedResponse); + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.brainstormEvilPlansCallable(); + ApiStreamObserver requestObserver = callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + requestObserver.onCompleted(); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void brainstormEvilPlansExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWicked.addException(exception); + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.brainstormEvilPlansCallable(); + ApiStreamObserver requestObserver = callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void persuadeEvilPlanTest() throws Exception { + EvilResponse expectedResponse = + EvilResponse.newBuilder().setMaliciousPlan("maliciousPlan712757759").build(); + mockWicked.addResponse(expectedResponse); + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ClientStreamingCallable callable = client.persuadeEvilPlanCallable(); + ApiStreamObserver requestObserver = callable.clientStreamingCall(responseObserver); + + requestObserver.onNext(request); + requestObserver.onCompleted(); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void persuadeEvilPlanExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockWicked.addException(exception); + EvilRequest request = + EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + ClientStreamingCallable callable = client.persuadeEvilPlanCallable(); + ApiStreamObserver requestObserver = callable.clientStreamingCall(responseObserver); + + requestObserver.onNext(request); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockLocations.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listLocationsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockLocations.addResponse(expectedResponse); + + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + + Location actualResponse = client.getLocation(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLocations.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getLocationExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLocations.addException(exception); + + try { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java b/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java new file mode 100644 index 0000000000..ad352a06e0 --- /dev/null +++ b/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java @@ -0,0 +1,293 @@ +package com.google.showcase.v1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: showcase/gapic-showcase-extended/proto/collisions.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class CollisionsGrpc { + + private CollisionsGrpc() {} + + public static final String SERVICE_NAME = "google.showcase.v1beta1.Collisions"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getDoSomethingMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "doSomething", + requestType = com.google.showcase.v1beta1.Request.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getDoSomethingMethod() { + io.grpc.MethodDescriptor getDoSomethingMethod; + if ((getDoSomethingMethod = CollisionsGrpc.getDoSomethingMethod) == null) { + synchronized (CollisionsGrpc.class) { + if ((getDoSomethingMethod = CollisionsGrpc.getDoSomethingMethod) == null) { + CollisionsGrpc.getDoSomethingMethod = getDoSomethingMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "doSomething")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.Request.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new CollisionsMethodDescriptorSupplier("doSomething")) + .build(); + } + } + } + return getDoSomethingMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static CollisionsStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public CollisionsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CollisionsStub(channel, callOptions); + } + }; + return CollisionsStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static CollisionsBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public CollisionsBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CollisionsBlockingStub(channel, callOptions); + } + }; + return CollisionsBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static CollisionsFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public CollisionsFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CollisionsFutureStub(channel, callOptions); + } + }; + return CollisionsFutureStub.newStub(factory, channel); + } + + /** + */ + public interface AsyncService { + + /** + */ + default void doSomething(com.google.showcase.v1beta1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDoSomethingMethod(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service Collisions. + */ + public static abstract class CollisionsImplBase + implements io.grpc.BindableService, AsyncService { + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return CollisionsGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service Collisions. + */ + public static final class CollisionsStub + extends io.grpc.stub.AbstractAsyncStub { + private CollisionsStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CollisionsStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CollisionsStub(channel, callOptions); + } + + /** + */ + public void doSomething(com.google.showcase.v1beta1.Request request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDoSomethingMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service Collisions. + */ + public static final class CollisionsBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private CollisionsBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CollisionsBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CollisionsBlockingStub(channel, callOptions); + } + + /** + */ + public com.google.longrunning.Operation doSomething(com.google.showcase.v1beta1.Request request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDoSomethingMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service Collisions. + */ + public static final class CollisionsFutureStub + extends io.grpc.stub.AbstractFutureStub { + private CollisionsFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CollisionsFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CollisionsFutureStub(channel, callOptions); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture doSomething( + com.google.showcase.v1beta1.Request request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDoSomethingMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_DO_SOMETHING = 0; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_DO_SOMETHING: + serviceImpl.doSomething((com.google.showcase.v1beta1.Request) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getDoSomethingMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.showcase.v1beta1.Request, + com.google.longrunning.Operation>( + service, METHODID_DO_SOMETHING))) + .build(); + } + + private static abstract class CollisionsBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + CollisionsBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Collisions"); + } + } + + private static final class CollisionsFileDescriptorSupplier + extends CollisionsBaseDescriptorSupplier { + CollisionsFileDescriptorSupplier() {} + } + + private static final class CollisionsMethodDescriptorSupplier + extends CollisionsBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + CollisionsMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (CollisionsGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new CollisionsFileDescriptorSupplier()) + .addMethod(getDoSomethingMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java b/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java new file mode 100644 index 0000000000..babc778d11 --- /dev/null +++ b/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java @@ -0,0 +1,409 @@ +package com.google.showcase.v1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: showcase/gapic-showcase-extended/proto/wicked.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class WickedGrpc { + + private WickedGrpc() {} + + public static final String SERVICE_NAME = "google.showcase.v1beta1.Wicked"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getCraftEvilPlanMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CraftEvilPlan", + requestType = com.google.showcase.v1beta1.EvilRequest.class, + responseType = com.google.showcase.v1beta1.EvilResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCraftEvilPlanMethod() { + io.grpc.MethodDescriptor getCraftEvilPlanMethod; + if ((getCraftEvilPlanMethod = WickedGrpc.getCraftEvilPlanMethod) == null) { + synchronized (WickedGrpc.class) { + if ((getCraftEvilPlanMethod = WickedGrpc.getCraftEvilPlanMethod) == null) { + WickedGrpc.getCraftEvilPlanMethod = getCraftEvilPlanMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CraftEvilPlan")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.EvilRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.EvilResponse.getDefaultInstance())) + .setSchemaDescriptor(new WickedMethodDescriptorSupplier("CraftEvilPlan")) + .build(); + } + } + } + return getCraftEvilPlanMethod; + } + + private static volatile io.grpc.MethodDescriptor getBrainstormEvilPlansMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "BrainstormEvilPlans", + requestType = com.google.showcase.v1beta1.EvilRequest.class, + responseType = com.google.showcase.v1beta1.EvilResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor getBrainstormEvilPlansMethod() { + io.grpc.MethodDescriptor getBrainstormEvilPlansMethod; + if ((getBrainstormEvilPlansMethod = WickedGrpc.getBrainstormEvilPlansMethod) == null) { + synchronized (WickedGrpc.class) { + if ((getBrainstormEvilPlansMethod = WickedGrpc.getBrainstormEvilPlansMethod) == null) { + WickedGrpc.getBrainstormEvilPlansMethod = getBrainstormEvilPlansMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "BrainstormEvilPlans")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.EvilRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.EvilResponse.getDefaultInstance())) + .setSchemaDescriptor(new WickedMethodDescriptorSupplier("BrainstormEvilPlans")) + .build(); + } + } + } + return getBrainstormEvilPlansMethod; + } + + private static volatile io.grpc.MethodDescriptor getPersuadeEvilPlanMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "PersuadeEvilPlan", + requestType = com.google.showcase.v1beta1.EvilRequest.class, + responseType = com.google.showcase.v1beta1.EvilResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) + public static io.grpc.MethodDescriptor getPersuadeEvilPlanMethod() { + io.grpc.MethodDescriptor getPersuadeEvilPlanMethod; + if ((getPersuadeEvilPlanMethod = WickedGrpc.getPersuadeEvilPlanMethod) == null) { + synchronized (WickedGrpc.class) { + if ((getPersuadeEvilPlanMethod = WickedGrpc.getPersuadeEvilPlanMethod) == null) { + WickedGrpc.getPersuadeEvilPlanMethod = getPersuadeEvilPlanMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PersuadeEvilPlan")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.EvilRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.showcase.v1beta1.EvilResponse.getDefaultInstance())) + .setSchemaDescriptor(new WickedMethodDescriptorSupplier("PersuadeEvilPlan")) + .build(); + } + } + } + return getPersuadeEvilPlanMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static WickedStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public WickedStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WickedStub(channel, callOptions); + } + }; + return WickedStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static WickedBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public WickedBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WickedBlockingStub(channel, callOptions); + } + }; + return WickedBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static WickedFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public WickedFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WickedFutureStub(channel, callOptions); + } + }; + return WickedFutureStub.newStub(factory, channel); + } + + /** + */ + public interface AsyncService { + + /** + */ + default void craftEvilPlan(com.google.showcase.v1beta1.EvilRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCraftEvilPlanMethod(), responseObserver); + } + + /** + */ + default io.grpc.stub.StreamObserver brainstormEvilPlans( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getBrainstormEvilPlansMethod(), responseObserver); + } + + /** + */ + default io.grpc.stub.StreamObserver persuadeEvilPlan( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getPersuadeEvilPlanMethod(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service Wicked. + */ + public static abstract class WickedImplBase + implements io.grpc.BindableService, AsyncService { + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return WickedGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service Wicked. + */ + public static final class WickedStub + extends io.grpc.stub.AbstractAsyncStub { + private WickedStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected WickedStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WickedStub(channel, callOptions); + } + + /** + */ + public void craftEvilPlan(com.google.showcase.v1beta1.EvilRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCraftEvilPlanMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public io.grpc.stub.StreamObserver brainstormEvilPlans( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getBrainstormEvilPlansMethod(), getCallOptions()), responseObserver); + } + + /** + */ + public io.grpc.stub.StreamObserver persuadeEvilPlan( + io.grpc.stub.StreamObserver responseObserver) { + return io.grpc.stub.ClientCalls.asyncClientStreamingCall( + getChannel().newCall(getPersuadeEvilPlanMethod(), getCallOptions()), responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service Wicked. + */ + public static final class WickedBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private WickedBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected WickedBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WickedBlockingStub(channel, callOptions); + } + + /** + */ + public com.google.showcase.v1beta1.EvilResponse craftEvilPlan(com.google.showcase.v1beta1.EvilRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCraftEvilPlanMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service Wicked. + */ + public static final class WickedFutureStub + extends io.grpc.stub.AbstractFutureStub { + private WickedFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected WickedFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new WickedFutureStub(channel, callOptions); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture craftEvilPlan( + com.google.showcase.v1beta1.EvilRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCraftEvilPlanMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CRAFT_EVIL_PLAN = 0; + private static final int METHODID_BRAINSTORM_EVIL_PLANS = 1; + private static final int METHODID_PERSUADE_EVIL_PLAN = 2; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CRAFT_EVIL_PLAN: + serviceImpl.craftEvilPlan((com.google.showcase.v1beta1.EvilRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_BRAINSTORM_EVIL_PLANS: + return (io.grpc.stub.StreamObserver) serviceImpl.brainstormEvilPlans( + (io.grpc.stub.StreamObserver) responseObserver); + case METHODID_PERSUADE_EVIL_PLAN: + return (io.grpc.stub.StreamObserver) serviceImpl.persuadeEvilPlan( + (io.grpc.stub.StreamObserver) responseObserver); + default: + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCraftEvilPlanMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.showcase.v1beta1.EvilRequest, + com.google.showcase.v1beta1.EvilResponse>( + service, METHODID_CRAFT_EVIL_PLAN))) + .addMethod( + getBrainstormEvilPlansMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.showcase.v1beta1.EvilRequest, + com.google.showcase.v1beta1.EvilResponse>( + service, METHODID_BRAINSTORM_EVIL_PLANS))) + .addMethod( + getPersuadeEvilPlanMethod(), + io.grpc.stub.ServerCalls.asyncClientStreamingCall( + new MethodHandlers< + com.google.showcase.v1beta1.EvilRequest, + com.google.showcase.v1beta1.EvilResponse>( + service, METHODID_PERSUADE_EVIL_PLAN))) + .build(); + } + + private static abstract class WickedBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + WickedBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.showcase.v1beta1.WickedOuterClass.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Wicked"); + } + } + + private static final class WickedFileDescriptorSupplier + extends WickedBaseDescriptorSupplier { + WickedFileDescriptorSupplier() {} + } + + private static final class WickedMethodDescriptorSupplier + extends WickedBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + WickedMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (WickedGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new WickedFileDescriptorSupplier()) + .addMethod(getCraftEvilPlanMethod()) + .addMethod(getBrainstormEvilPlansMethod()) + .addMethod(getPersuadeEvilPlanMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java new file mode 100644 index 0000000000..420df938ec --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java @@ -0,0 +1,509 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +/** + * Protobuf type {@code google.showcase.v1beta1.Annotation} + */ +public final class Annotation extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Annotation) + AnnotationOrBuilder { +private static final long serialVersionUID = 0L; + // Use Annotation.newBuilder() to construct. + private Annotation(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Annotation() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Annotation(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.Annotation.class, com.google.showcase.v1beta1.Annotation.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.showcase.v1beta1.Annotation)) { + return super.equals(obj); + } + com.google.showcase.v1beta1.Annotation other = (com.google.showcase.v1beta1.Annotation) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.showcase.v1beta1.Annotation parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Annotation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Annotation parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.showcase.v1beta1.Annotation parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.showcase.v1beta1.Annotation parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.Annotation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.showcase.v1beta1.Annotation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code google.showcase.v1beta1.Annotation} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Annotation) + com.google.showcase.v1beta1.AnnotationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.Annotation.class, com.google.showcase.v1beta1.Annotation.Builder.class); + } + + // Construct using com.google.showcase.v1beta1.Annotation.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Annotation getDefaultInstanceForType() { + return com.google.showcase.v1beta1.Annotation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.showcase.v1beta1.Annotation build() { + com.google.showcase.v1beta1.Annotation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Annotation buildPartial() { + com.google.showcase.v1beta1.Annotation result = new com.google.showcase.v1beta1.Annotation(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.showcase.v1beta1.Annotation result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.showcase.v1beta1.Annotation) { + return mergeFrom((com.google.showcase.v1beta1.Annotation)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.showcase.v1beta1.Annotation other) { + if (other == com.google.showcase.v1beta1.Annotation.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Annotation) + } + + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Annotation) + private static final com.google.showcase.v1beta1.Annotation DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Annotation(); + } + + public static com.google.showcase.v1beta1.Annotation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Annotation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Annotation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java new file mode 100644 index 0000000000..6801f02095 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java @@ -0,0 +1,21 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +public interface AnnotationOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Annotation) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java new file mode 100644 index 0000000000..326d872182 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java @@ -0,0 +1,90 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +public final class CollisionsOuterClass { + private CollisionsOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_showcase_v1beta1_Request_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_showcase_v1beta1_Request_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_showcase_v1beta1_Annotation_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_showcase_v1beta1_Location_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_showcase_v1beta1_Location_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n7showcase/gapic-showcase-extended/proto" + + "/collisions.proto\022\027google.showcase.v1bet" + + "a1\032\027google/api/client.proto\032#google/long" + + "running/operations.proto\"\205\001\n\007Request\022\014\n\004" + + "name\030\001 \001(\t\0227\n\nannotation\030\002 \001(\0132#.google." + + "showcase.v1beta1.Annotation\0223\n\010location\030" + + "\003 \001(\0132!.google.showcase.v1beta1.Location" + + "\"\032\n\nAnnotation\022\014\n\004name\030\001 \001(\t\"\030\n\010Location" + + "\022\014\n\004name\030\001 \001(\t2\212\001\n\nCollisions\022i\n\013doSomet" + + "hing\022 .google.showcase.v1beta1.Request\032\035" + + ".google.longrunning.Operation\"\031\312A\026\n\nAnno" + + "tation\022\010Location\032\021\312A\016localhost:7469B\037\n\033c" + + "om.google.showcase.v1beta1P\001b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.ClientProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + }); + internal_static_google_showcase_v1beta1_Request_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_showcase_v1beta1_Request_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_showcase_v1beta1_Request_descriptor, + new java.lang.String[] { "Name", "Annotation", "Location", }); + internal_static_google_showcase_v1beta1_Annotation_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_showcase_v1beta1_Annotation_descriptor, + new java.lang.String[] { "Name", }); + internal_static_google_showcase_v1beta1_Location_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_showcase_v1beta1_Location_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_showcase_v1beta1_Location_descriptor, + new java.lang.String[] { "Name", }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor + .internalUpdateFileDescriptor(descriptor, registry); + com.google.api.ClientProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java new file mode 100644 index 0000000000..e41c78284c --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java @@ -0,0 +1,509 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/wicked.proto + +package com.google.showcase.v1beta1; + +/** + * Protobuf type {@code google.showcase.v1beta1.EvilRequest} + */ +public final class EvilRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.EvilRequest) + EvilRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use EvilRequest.newBuilder() to construct. + private EvilRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EvilRequest() { + maliciousIdea_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new EvilRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.EvilRequest.class, com.google.showcase.v1beta1.EvilRequest.Builder.class); + } + + public static final int MALICIOUS_IDEA_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object maliciousIdea_ = ""; + /** + * string malicious_idea = 1; + * @return The maliciousIdea. + */ + @java.lang.Override + public java.lang.String getMaliciousIdea() { + java.lang.Object ref = maliciousIdea_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + maliciousIdea_ = s; + return s; + } + } + /** + * string malicious_idea = 1; + * @return The bytes for maliciousIdea. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMaliciousIdeaBytes() { + java.lang.Object ref = maliciousIdea_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + maliciousIdea_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousIdea_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, maliciousIdea_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousIdea_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, maliciousIdea_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.showcase.v1beta1.EvilRequest)) { + return super.equals(obj); + } + com.google.showcase.v1beta1.EvilRequest other = (com.google.showcase.v1beta1.EvilRequest) obj; + + if (!getMaliciousIdea() + .equals(other.getMaliciousIdea())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MALICIOUS_IDEA_FIELD_NUMBER; + hash = (53 * hash) + getMaliciousIdea().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.showcase.v1beta1.EvilRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.showcase.v1beta1.EvilRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.EvilRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.showcase.v1beta1.EvilRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code google.showcase.v1beta1.EvilRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.EvilRequest) + com.google.showcase.v1beta1.EvilRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.EvilRequest.class, com.google.showcase.v1beta1.EvilRequest.Builder.class); + } + + // Construct using com.google.showcase.v1beta1.EvilRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + maliciousIdea_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilRequest getDefaultInstanceForType() { + return com.google.showcase.v1beta1.EvilRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilRequest build() { + com.google.showcase.v1beta1.EvilRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilRequest buildPartial() { + com.google.showcase.v1beta1.EvilRequest result = new com.google.showcase.v1beta1.EvilRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.showcase.v1beta1.EvilRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.maliciousIdea_ = maliciousIdea_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.showcase.v1beta1.EvilRequest) { + return mergeFrom((com.google.showcase.v1beta1.EvilRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.showcase.v1beta1.EvilRequest other) { + if (other == com.google.showcase.v1beta1.EvilRequest.getDefaultInstance()) return this; + if (!other.getMaliciousIdea().isEmpty()) { + maliciousIdea_ = other.maliciousIdea_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + maliciousIdea_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object maliciousIdea_ = ""; + /** + * string malicious_idea = 1; + * @return The maliciousIdea. + */ + public java.lang.String getMaliciousIdea() { + java.lang.Object ref = maliciousIdea_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + maliciousIdea_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string malicious_idea = 1; + * @return The bytes for maliciousIdea. + */ + public com.google.protobuf.ByteString + getMaliciousIdeaBytes() { + java.lang.Object ref = maliciousIdea_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + maliciousIdea_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string malicious_idea = 1; + * @param value The maliciousIdea to set. + * @return This builder for chaining. + */ + public Builder setMaliciousIdea( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + maliciousIdea_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string malicious_idea = 1; + * @return This builder for chaining. + */ + public Builder clearMaliciousIdea() { + maliciousIdea_ = getDefaultInstance().getMaliciousIdea(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string malicious_idea = 1; + * @param value The bytes for maliciousIdea to set. + * @return This builder for chaining. + */ + public Builder setMaliciousIdeaBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + maliciousIdea_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.EvilRequest) + } + + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.EvilRequest) + private static final com.google.showcase.v1beta1.EvilRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.EvilRequest(); + } + + public static com.google.showcase.v1beta1.EvilRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EvilRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java new file mode 100644 index 0000000000..3b9d11f981 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java @@ -0,0 +1,21 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/wicked.proto + +package com.google.showcase.v1beta1; + +public interface EvilRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.EvilRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * string malicious_idea = 1; + * @return The maliciousIdea. + */ + java.lang.String getMaliciousIdea(); + /** + * string malicious_idea = 1; + * @return The bytes for maliciousIdea. + */ + com.google.protobuf.ByteString + getMaliciousIdeaBytes(); +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java new file mode 100644 index 0000000000..d9c0a7a380 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java @@ -0,0 +1,509 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/wicked.proto + +package com.google.showcase.v1beta1; + +/** + * Protobuf type {@code google.showcase.v1beta1.EvilResponse} + */ +public final class EvilResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.EvilResponse) + EvilResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use EvilResponse.newBuilder() to construct. + private EvilResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EvilResponse() { + maliciousPlan_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new EvilResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.EvilResponse.class, com.google.showcase.v1beta1.EvilResponse.Builder.class); + } + + public static final int MALICIOUS_PLAN_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object maliciousPlan_ = ""; + /** + * string malicious_plan = 1; + * @return The maliciousPlan. + */ + @java.lang.Override + public java.lang.String getMaliciousPlan() { + java.lang.Object ref = maliciousPlan_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + maliciousPlan_ = s; + return s; + } + } + /** + * string malicious_plan = 1; + * @return The bytes for maliciousPlan. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMaliciousPlanBytes() { + java.lang.Object ref = maliciousPlan_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + maliciousPlan_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousPlan_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, maliciousPlan_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousPlan_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, maliciousPlan_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.showcase.v1beta1.EvilResponse)) { + return super.equals(obj); + } + com.google.showcase.v1beta1.EvilResponse other = (com.google.showcase.v1beta1.EvilResponse) obj; + + if (!getMaliciousPlan() + .equals(other.getMaliciousPlan())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MALICIOUS_PLAN_FIELD_NUMBER; + hash = (53 * hash) + getMaliciousPlan().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.showcase.v1beta1.EvilResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.showcase.v1beta1.EvilResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.EvilResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.showcase.v1beta1.EvilResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code google.showcase.v1beta1.EvilResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.EvilResponse) + com.google.showcase.v1beta1.EvilResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.EvilResponse.class, com.google.showcase.v1beta1.EvilResponse.Builder.class); + } + + // Construct using com.google.showcase.v1beta1.EvilResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + maliciousPlan_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilResponse getDefaultInstanceForType() { + return com.google.showcase.v1beta1.EvilResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilResponse build() { + com.google.showcase.v1beta1.EvilResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilResponse buildPartial() { + com.google.showcase.v1beta1.EvilResponse result = new com.google.showcase.v1beta1.EvilResponse(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.showcase.v1beta1.EvilResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.maliciousPlan_ = maliciousPlan_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.showcase.v1beta1.EvilResponse) { + return mergeFrom((com.google.showcase.v1beta1.EvilResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.showcase.v1beta1.EvilResponse other) { + if (other == com.google.showcase.v1beta1.EvilResponse.getDefaultInstance()) return this; + if (!other.getMaliciousPlan().isEmpty()) { + maliciousPlan_ = other.maliciousPlan_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + maliciousPlan_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object maliciousPlan_ = ""; + /** + * string malicious_plan = 1; + * @return The maliciousPlan. + */ + public java.lang.String getMaliciousPlan() { + java.lang.Object ref = maliciousPlan_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + maliciousPlan_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string malicious_plan = 1; + * @return The bytes for maliciousPlan. + */ + public com.google.protobuf.ByteString + getMaliciousPlanBytes() { + java.lang.Object ref = maliciousPlan_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + maliciousPlan_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string malicious_plan = 1; + * @param value The maliciousPlan to set. + * @return This builder for chaining. + */ + public Builder setMaliciousPlan( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + maliciousPlan_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string malicious_plan = 1; + * @return This builder for chaining. + */ + public Builder clearMaliciousPlan() { + maliciousPlan_ = getDefaultInstance().getMaliciousPlan(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string malicious_plan = 1; + * @param value The bytes for maliciousPlan to set. + * @return This builder for chaining. + */ + public Builder setMaliciousPlanBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + maliciousPlan_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.EvilResponse) + } + + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.EvilResponse) + private static final com.google.showcase.v1beta1.EvilResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.EvilResponse(); + } + + public static com.google.showcase.v1beta1.EvilResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EvilResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.showcase.v1beta1.EvilResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java new file mode 100644 index 0000000000..4c78259881 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java @@ -0,0 +1,21 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/wicked.proto + +package com.google.showcase.v1beta1; + +public interface EvilResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.EvilResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * string malicious_plan = 1; + * @return The maliciousPlan. + */ + java.lang.String getMaliciousPlan(); + /** + * string malicious_plan = 1; + * @return The bytes for maliciousPlan. + */ + com.google.protobuf.ByteString + getMaliciousPlanBytes(); +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java new file mode 100644 index 0000000000..df879e8365 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java @@ -0,0 +1,509 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +/** + * Protobuf type {@code google.showcase.v1beta1.Location} + */ +public final class Location extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Location) + LocationOrBuilder { +private static final long serialVersionUID = 0L; + // Use Location.newBuilder() to construct. + private Location(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Location() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Location(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.showcase.v1beta1.Location)) { + return super.equals(obj); + } + com.google.showcase.v1beta1.Location other = (com.google.showcase.v1beta1.Location) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.showcase.v1beta1.Location parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Location parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Location parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Location parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Location parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Location parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Location parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.Location parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.showcase.v1beta1.Location parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.showcase.v1beta1.Location parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.showcase.v1beta1.Location parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.Location parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.showcase.v1beta1.Location prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code google.showcase.v1beta1.Location} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Location) + com.google.showcase.v1beta1.LocationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); + } + + // Construct using com.google.showcase.v1beta1.Location.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { + return com.google.showcase.v1beta1.Location.getDefaultInstance(); + } + + @java.lang.Override + public com.google.showcase.v1beta1.Location build() { + com.google.showcase.v1beta1.Location result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Location buildPartial() { + com.google.showcase.v1beta1.Location result = new com.google.showcase.v1beta1.Location(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.showcase.v1beta1.Location result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.showcase.v1beta1.Location) { + return mergeFrom((com.google.showcase.v1beta1.Location)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.showcase.v1beta1.Location other) { + if (other == com.google.showcase.v1beta1.Location.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Location) + } + + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Location) + private static final com.google.showcase.v1beta1.Location DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Location(); + } + + public static com.google.showcase.v1beta1.Location getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Location parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java new file mode 100644 index 0000000000..37f73be8aa --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java @@ -0,0 +1,21 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +public interface LocationOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Location) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java new file mode 100644 index 0000000000..9374b40128 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java @@ -0,0 +1,871 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +/** + * Protobuf type {@code google.showcase.v1beta1.Request} + */ +public final class Request extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Request) + RequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use Request.newBuilder() to construct. + private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Request() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Request(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.Request.class, com.google.showcase.v1beta1.Request.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ANNOTATION_FIELD_NUMBER = 2; + private com.google.showcase.v1beta1.Annotation annotation_; + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + * @return Whether the annotation field is set. + */ + @java.lang.Override + public boolean hasAnnotation() { + return annotation_ != null; + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + * @return The annotation. + */ + @java.lang.Override + public com.google.showcase.v1beta1.Annotation getAnnotation() { + return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + @java.lang.Override + public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() { + return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; + } + + public static final int LOCATION_FIELD_NUMBER = 3; + private com.google.showcase.v1beta1.Location location_; + /** + * .google.showcase.v1beta1.Location location = 3; + * @return Whether the location field is set. + */ + @java.lang.Override + public boolean hasLocation() { + return location_ != null; + } + /** + * .google.showcase.v1beta1.Location location = 3; + * @return The location. + */ + @java.lang.Override + public com.google.showcase.v1beta1.Location getLocation() { + return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + @java.lang.Override + public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { + return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (annotation_ != null) { + output.writeMessage(2, getAnnotation()); + } + if (location_ != null) { + output.writeMessage(3, getLocation()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (annotation_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getAnnotation()); + } + if (location_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getLocation()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.showcase.v1beta1.Request)) { + return super.equals(obj); + } + com.google.showcase.v1beta1.Request other = (com.google.showcase.v1beta1.Request) obj; + + if (!getName() + .equals(other.getName())) return false; + if (hasAnnotation() != other.hasAnnotation()) return false; + if (hasAnnotation()) { + if (!getAnnotation() + .equals(other.getAnnotation())) return false; + } + if (hasLocation() != other.hasLocation()) return false; + if (hasLocation()) { + if (!getLocation() + .equals(other.getLocation())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasAnnotation()) { + hash = (37 * hash) + ANNOTATION_FIELD_NUMBER; + hash = (53 * hash) + getAnnotation().hashCode(); + } + if (hasLocation()) { + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.showcase.v1beta1.Request parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Request parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Request parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Request parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Request parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.showcase.v1beta1.Request parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.showcase.v1beta1.Request parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.Request parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static com.google.showcase.v1beta1.Request parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.showcase.v1beta1.Request parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.showcase.v1beta1.Request parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.showcase.v1beta1.Request parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.showcase.v1beta1.Request prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code google.showcase.v1beta1.Request} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Request) + com.google.showcase.v1beta1.RequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.showcase.v1beta1.Request.class, com.google.showcase.v1beta1.Request.Builder.class); + } + + // Construct using com.google.showcase.v1beta1.Request.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + annotation_ = null; + if (annotationBuilder_ != null) { + annotationBuilder_.dispose(); + annotationBuilder_ = null; + } + location_ = null; + if (locationBuilder_ != null) { + locationBuilder_.dispose(); + locationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Request getDefaultInstanceForType() { + return com.google.showcase.v1beta1.Request.getDefaultInstance(); + } + + @java.lang.Override + public com.google.showcase.v1beta1.Request build() { + com.google.showcase.v1beta1.Request result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Request buildPartial() { + com.google.showcase.v1beta1.Request result = new com.google.showcase.v1beta1.Request(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.showcase.v1beta1.Request result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.annotation_ = annotationBuilder_ == null + ? annotation_ + : annotationBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.location_ = locationBuilder_ == null + ? location_ + : locationBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.showcase.v1beta1.Request) { + return mergeFrom((com.google.showcase.v1beta1.Request)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.showcase.v1beta1.Request other) { + if (other == com.google.showcase.v1beta1.Request.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasAnnotation()) { + mergeAnnotation(other.getAnnotation()); + } + if (other.hasLocation()) { + mergeLocation(other.getLocation()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + getAnnotationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + getLocationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.showcase.v1beta1.Annotation annotation_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Annotation, com.google.showcase.v1beta1.Annotation.Builder, com.google.showcase.v1beta1.AnnotationOrBuilder> annotationBuilder_; + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + * @return Whether the annotation field is set. + */ + public boolean hasAnnotation() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + * @return The annotation. + */ + public com.google.showcase.v1beta1.Annotation getAnnotation() { + if (annotationBuilder_ == null) { + return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; + } else { + return annotationBuilder_.getMessage(); + } + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + public Builder setAnnotation(com.google.showcase.v1beta1.Annotation value) { + if (annotationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + annotation_ = value; + } else { + annotationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + public Builder setAnnotation( + com.google.showcase.v1beta1.Annotation.Builder builderForValue) { + if (annotationBuilder_ == null) { + annotation_ = builderForValue.build(); + } else { + annotationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + public Builder mergeAnnotation(com.google.showcase.v1beta1.Annotation value) { + if (annotationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + annotation_ != null && + annotation_ != com.google.showcase.v1beta1.Annotation.getDefaultInstance()) { + getAnnotationBuilder().mergeFrom(value); + } else { + annotation_ = value; + } + } else { + annotationBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + public Builder clearAnnotation() { + bitField0_ = (bitField0_ & ~0x00000002); + annotation_ = null; + if (annotationBuilder_ != null) { + annotationBuilder_.dispose(); + annotationBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + public com.google.showcase.v1beta1.Annotation.Builder getAnnotationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getAnnotationFieldBuilder().getBuilder(); + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() { + if (annotationBuilder_ != null) { + return annotationBuilder_.getMessageOrBuilder(); + } else { + return annotation_ == null ? + com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; + } + } + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Annotation, com.google.showcase.v1beta1.Annotation.Builder, com.google.showcase.v1beta1.AnnotationOrBuilder> + getAnnotationFieldBuilder() { + if (annotationBuilder_ == null) { + annotationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Annotation, com.google.showcase.v1beta1.Annotation.Builder, com.google.showcase.v1beta1.AnnotationOrBuilder>( + getAnnotation(), + getParentForChildren(), + isClean()); + annotation_ = null; + } + return annotationBuilder_; + } + + private com.google.showcase.v1beta1.Location location_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> locationBuilder_; + /** + * .google.showcase.v1beta1.Location location = 3; + * @return Whether the location field is set. + */ + public boolean hasLocation() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.showcase.v1beta1.Location location = 3; + * @return The location. + */ + public com.google.showcase.v1beta1.Location getLocation() { + if (locationBuilder_ == null) { + return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + } else { + return locationBuilder_.getMessage(); + } + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + public Builder setLocation(com.google.showcase.v1beta1.Location value) { + if (locationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + location_ = value; + } else { + locationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + public Builder setLocation( + com.google.showcase.v1beta1.Location.Builder builderForValue) { + if (locationBuilder_ == null) { + location_ = builderForValue.build(); + } else { + locationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + public Builder mergeLocation(com.google.showcase.v1beta1.Location value) { + if (locationBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + location_ != null && + location_ != com.google.showcase.v1beta1.Location.getDefaultInstance()) { + getLocationBuilder().mergeFrom(value); + } else { + location_ = value; + } + } else { + locationBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + public Builder clearLocation() { + bitField0_ = (bitField0_ & ~0x00000004); + location_ = null; + if (locationBuilder_ != null) { + locationBuilder_.dispose(); + locationBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + public com.google.showcase.v1beta1.Location.Builder getLocationBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getLocationFieldBuilder().getBuilder(); + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { + if (locationBuilder_ != null) { + return locationBuilder_.getMessageOrBuilder(); + } else { + return location_ == null ? + com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + } + } + /** + * .google.showcase.v1beta1.Location location = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> + getLocationFieldBuilder() { + if (locationBuilder_ == null) { + locationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder>( + getLocation(), + getParentForChildren(), + isClean()); + location_ = null; + } + return locationBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Request) + } + + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Request) + private static final com.google.showcase.v1beta1.Request DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Request(); + } + + public static com.google.showcase.v1beta1.Request getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Request parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.showcase.v1beta1.Request getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java new file mode 100644 index 0000000000..a8febedd64 --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java @@ -0,0 +1,51 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/collisions.proto + +package com.google.showcase.v1beta1; + +public interface RequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Request) + com.google.protobuf.MessageOrBuilder { + + /** + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + * @return Whether the annotation field is set. + */ + boolean hasAnnotation(); + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + * @return The annotation. + */ + com.google.showcase.v1beta1.Annotation getAnnotation(); + /** + * .google.showcase.v1beta1.Annotation annotation = 2; + */ + com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder(); + + /** + * .google.showcase.v1beta1.Location location = 3; + * @return Whether the location field is set. + */ + boolean hasLocation(); + /** + * .google.showcase.v1beta1.Location location = 3; + * @return The location. + */ + com.google.showcase.v1beta1.Location getLocation(); + /** + * .google.showcase.v1beta1.Location location = 3; + */ + com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder(); +} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java new file mode 100644 index 0000000000..7498bd3edd --- /dev/null +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java @@ -0,0 +1,79 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: showcase/gapic-showcase-extended/proto/wicked.proto + +package com.google.showcase.v1beta1; + +public final class WickedOuterClass { + private WickedOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_showcase_v1beta1_EvilRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_showcase_v1beta1_EvilResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n3showcase/gapic-showcase-extended/proto" + + "/wicked.proto\022\027google.showcase.v1beta1\032\027" + + "google/api/client.proto\"%\n\013EvilRequest\022\026" + + "\n\016malicious_idea\030\001 \001(\t\"&\n\014EvilResponse\022\026" + + "\n\016malicious_plan\030\001 \001(\t2\304\002\n\006Wicked\022\\\n\rCra" + + "ftEvilPlan\022$.google.showcase.v1beta1.Evi" + + "lRequest\032%.google.showcase.v1beta1.EvilR" + + "esponse\022f\n\023BrainstormEvilPlans\022$.google." + + "showcase.v1beta1.EvilRequest\032%.google.sh" + + "owcase.v1beta1.EvilResponse(\0010\001\022a\n\020Persu" + + "adeEvilPlan\022$.google.showcase.v1beta1.Ev" + + "ilRequest\032%.google.showcase.v1beta1.Evil" + + "Response(\001\032\021\312A\016localhost:7469Bq\n\033com.goo" + + "gle.showcase.v1beta1P\001Z4github.com/googl" + + "eapis/gapic-showcase/server/genproto\352\002\031G" + + "oogle::Showcase::V1beta1b\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.ClientProto.getDescriptor(), + }); + internal_static_google_showcase_v1beta1_EvilRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_showcase_v1beta1_EvilRequest_descriptor, + new java.lang.String[] { "MaliciousIdea", }); + internal_static_google_showcase_v1beta1_EvilResponse_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_showcase_v1beta1_EvilResponse_descriptor, + new java.lang.String[] { "MaliciousPlan", }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + com.google.protobuf.Descriptors.FileDescriptor + .internalUpdateFileDescriptor(descriptor, registry); + com.google.api.ClientProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} From 76d8fbaeb6594cfdc3e43fd91d3a54d7320d1b98 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Tue, 30 May 2023 23:04:59 -0400 Subject: [PATCH 05/18] fix: update LRO parsing to check package for short-form response and metadata types --- .../generator/gapic/protoparser/Parser.java | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java index 35ba86dcc6..c1c819214e 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java @@ -824,39 +824,34 @@ static LongrunningOperation parseLro( boolean isResponseTypeNameShortOnly = lastDotIndex < 0; String responseTypeShortName = lastDotIndex >= 0 ? responseTypeName.substring(lastDotIndex + 1) : responseTypeName; + // When only shortname is provided, match on same proto package as method (See + // https://aip.dev/151) + String responseTypeFullName = + isResponseTypeNameShortOnly + ? methodDescriptor.getFile().getPackage() + "." + responseTypeShortName + : responseTypeName; lastDotIndex = metadataTypeName.lastIndexOf('.'); boolean isMetadataTypeNameShortOnly = lastDotIndex < 0; String metadataTypeShortName = lastDotIndex >= 0 ? metadataTypeName.substring(lastDotIndex + 1) : metadataTypeName; + // When only shortname is provided, match on same proto package as method (See + // https://aip.dev/151) + String metadataTypeFullName = + isMetadataTypeNameShortOnly + ? methodDescriptor.getFile().getPackage() + "." + metadataTypeShortName + : metadataTypeName; // The messageTypes map keys to the Java fully-qualified name. for (Map.Entry messageEntry : messageTypes.entrySet()) { - String messageKey = messageEntry.getKey(); - int messageLastDotIndex = messageEntry.getKey().lastIndexOf('.'); - String messageShortName = - messageLastDotIndex >= 0 ? messageKey.substring(messageLastDotIndex + 1) : messageKey; - if (responseMessage == null) { - if (isResponseTypeNameShortOnly && responseTypeName.equals(messageShortName)) { - responseMessage = messageEntry.getValue(); - } else if (!isResponseTypeNameShortOnly && responseTypeShortName.equals(messageShortName)) { - // Ensure that the full proto name matches. - Message candidateMessage = messageEntry.getValue(); - if (candidateMessage.fullProtoName().equals(responseTypeName)) { - responseMessage = candidateMessage; - } - } + Message candidateMessage = messageEntry.getValue(); + if (responseMessage == null + && candidateMessage.fullProtoName().equals(responseTypeFullName)) { + responseMessage = candidateMessage; } - if (metadataMessage == null) { - if (isMetadataTypeNameShortOnly && metadataTypeName.equals(messageShortName)) { - metadataMessage = messageEntry.getValue(); - } else if (!isMetadataTypeNameShortOnly && metadataTypeShortName.equals(messageShortName)) { - // Ensure that the full proto name matches. - Message candidateMessage = messageEntry.getValue(); - if (candidateMessage.fullProtoName().equals(metadataTypeName)) { - metadataMessage = candidateMessage; - } - } + if (metadataMessage == null + && candidateMessage.fullProtoName().equals(metadataTypeFullName)) { + metadataMessage = candidateMessage; } } From 2e1c69e66fd46bdedbbe29695ab02a7a5fa8ebc0 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 31 May 2023 16:30:53 -0400 Subject: [PATCH 06/18] tests: exclude Location edge case from test proto and update goldens --- .../proto/collisions.proto | 6 +- .../dosomething/AsyncDoSomething.java | 4 +- .../dosomething/AsyncDoSomethingLRO.java | 13 +- .../dosomething/SyncDoSomething.java | 8 +- .../showcase/v1beta1/CollisionsClient.java | 28 +-- .../showcase/v1beta1/CollisionsSettings.java | 12 +- .../showcase/v1beta1/stub/CollisionsStub.java | 9 +- .../v1beta1/stub/CollisionsStubSettings.java | 31 +-- .../v1beta1/stub/GrpcCollisionsStub.java | 15 +- .../v1beta1/stub/HttpJsonCollisionsStub.java | 7 +- .../v1beta1/CollisionsClientTest.java | 19 +- .../v1beta1/CollisionsOuterClass.java | 20 +- .../v1beta1/{Location.java => Metadata.java} | 112 +++++------ ...nOrBuilder.java => MetadataOrBuilder.java} | 4 +- .../com/google/showcase/v1beta1/Request.java | 176 +++++++++--------- .../showcase/v1beta1/RequestOrBuilder.java | 16 +- 16 files changed, 212 insertions(+), 268 deletions(-) rename showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/{Location.java => Metadata.java} (80%) rename showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/{LocationOrBuilder.java => MetadataOrBuilder.java} (89%) diff --git a/showcase/gapic-showcase-extended/proto/collisions.proto b/showcase/gapic-showcase-extended/proto/collisions.proto index 009fcd77f9..6e73d526e0 100644 --- a/showcase/gapic-showcase-extended/proto/collisions.proto +++ b/showcase/gapic-showcase-extended/proto/collisions.proto @@ -29,7 +29,7 @@ service Collisions { rpc doSomething(Request) returns (google.longrunning.Operation) { option (google.longrunning.operation_info) = { response_type: "Annotation" - metadata_type: "Location" + metadata_type: "Metadata" }; } } @@ -37,13 +37,13 @@ service Collisions { message Request { string name = 1; Annotation annotation = 2; - Location location = 3; + Metadata metadata = 3; } message Annotation { string name = 1; } -message Location { +message Metadata { string name = 1; } \ No newline at end of file diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java index 8cdc664bbd..8eb114eaac 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java @@ -21,7 +21,7 @@ import com.google.longrunning.Operation; import com.google.showcase.v1beta1.Annotation; import com.google.showcase.v1beta1.CollisionsClient; -import com.google.showcase.v1beta1.Location; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; public class AsyncDoSomething { @@ -41,7 +41,7 @@ public static void asyncDoSomething() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setLocation(Location.newBuilder().build()) + .setMetadata(Metadata.newBuilder().build()) .build(); ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request); // Do something. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java index 0db7250549..f9fcb62291 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java @@ -18,10 +18,9 @@ // [START localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async] import com.google.api.gax.longrunning.OperationFuture; -import com.google.protobuf.DescriptorProtos; import com.google.showcase.v1beta1.Annotation; import com.google.showcase.v1beta1.CollisionsClient; -import com.google.showcase.v1beta1.Location; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; public class AsyncDoSomethingLRO { @@ -41,14 +40,12 @@ public static void asyncDoSomethingLRO() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setLocation(Location.newBuilder().build()) + .setMetadata(Metadata.newBuilder().build()) .build(); - OperationFuture< - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - future = collisionsClient.doSomethingOperationCallable().futureCall(request); + OperationFuture future = + collisionsClient.doSomethingOperationCallable().futureCall(request); // Do something. - DescriptorProtos.GeneratedCodeInfo.Annotation response = future.get(); + Annotation response = future.get(); } } } diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java index dbc79d6476..255f977800 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java @@ -17,10 +17,9 @@ package com.google.showcase.v1beta1.samples; // [START localhost7469_v1beta1_generated_Collisions_DoSomething_sync] -import com.google.protobuf.DescriptorProtos; import com.google.showcase.v1beta1.Annotation; import com.google.showcase.v1beta1.CollisionsClient; -import com.google.showcase.v1beta1.Location; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; public class SyncDoSomething { @@ -40,10 +39,9 @@ public static void syncDoSomething() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setLocation(Location.newBuilder().build()) + .setMetadata(Metadata.newBuilder().build()) .build(); - DescriptorProtos.GeneratedCodeInfo.Annotation response = - collisionsClient.doSomethingAsync(request).get(); + Annotation response = collisionsClient.doSomethingAsync(request).get(); } } } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java index 133186ef2a..6f1d96c7a8 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java @@ -34,7 +34,6 @@ import com.google.cloud.location.Location; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.protobuf.DescriptorProtos; import com.google.showcase.v1beta1.stub.CollisionsStub; import com.google.showcase.v1beta1.stub.CollisionsStubSettings; import java.io.IOException; @@ -217,19 +216,16 @@ public final OperationsClient getHttpJsonOperationsClient() { * Request.newBuilder() * .setName("name3373707") * .setAnnotation(Annotation.newBuilder().build()) - * .setLocation(Location.newBuilder().build()) + * .setMetadata(Metadata.newBuilder().build()) * .build(); - * DescriptorProtos.GeneratedCodeInfo.Annotation response = - * collisionsClient.doSomethingAsync(request).get(); + * Annotation response = collisionsClient.doSomethingAsync(request).get(); * } * } * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final OperationFuture< - DescriptorProtos.GeneratedCodeInfo.Annotation, DescriptorProtos.SourceCodeInfo.Location> - doSomethingAsync(Request request) { + public final OperationFuture doSomethingAsync(Request request) { return doSomethingOperationCallable().futureCall(request); } @@ -248,22 +244,16 @@ public final OperationsClient getHttpJsonOperationsClient() { * Request.newBuilder() * .setName("name3373707") * .setAnnotation(Annotation.newBuilder().build()) - * .setLocation(Location.newBuilder().build()) + * .setMetadata(Metadata.newBuilder().build()) * .build(); - * OperationFuture< - * DescriptorProtos.GeneratedCodeInfo.Annotation, - * DescriptorProtos.SourceCodeInfo.Location> - * future = collisionsClient.doSomethingOperationCallable().futureCall(request); + * OperationFuture future = + * collisionsClient.doSomethingOperationCallable().futureCall(request); * // Do something. - * DescriptorProtos.GeneratedCodeInfo.Annotation response = future.get(); + * Annotation response = future.get(); * } * } */ - public final OperationCallable< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationCallable() { + public final OperationCallable doSomethingOperationCallable() { return stub.doSomethingOperationCallable(); } @@ -282,7 +272,7 @@ public final OperationsClient getHttpJsonOperationsClient() { * Request.newBuilder() * .setName("name3373707") * .setAnnotation(Annotation.newBuilder().build()) - * .setLocation(Location.newBuilder().build()) + * .setMetadata(Metadata.newBuilder().build()) * .build(); * ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request); * // Do something. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java index b097ebb056..7ff83412c3 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java @@ -37,7 +37,6 @@ import com.google.cloud.location.ListLocationsResponse; import com.google.cloud.location.Location; import com.google.longrunning.Operation; -import com.google.protobuf.DescriptorProtos; import com.google.showcase.v1beta1.stub.CollisionsStubSettings; import java.io.IOException; import java.util.List; @@ -89,11 +88,7 @@ public UnaryCallSettings doSomethingSettings() { } /** Returns the object with the settings used for calls to doSomething. */ - public OperationCallSettings< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationSettings() { + public OperationCallSettings doSomethingOperationSettings() { return ((CollisionsStubSettings) getStubSettings()).doSomethingOperationSettings(); } @@ -228,10 +223,7 @@ public UnaryCallSettings.Builder doSomethingSettings() { } /** Returns the builder for the settings used for calls to doSomething. */ - public OperationCallSettings.Builder< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> + public OperationCallSettings.Builder doSomethingOperationSettings() { return getStubSettingsBuilder().doSomethingOperationSettings(); } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java index efdbba6e54..cd953ba815 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java @@ -28,7 +28,8 @@ import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; -import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; import javax.annotation.Generated; @@ -50,11 +51,7 @@ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOp return null; } - public OperationCallable< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationCallable() { + public OperationCallable doSomethingOperationCallable() { throw new UnsupportedOperationException("Not implemented: doSomethingOperationCallable()"); } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java index 202c08ae6a..b38b5833b7 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java @@ -56,7 +56,8 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.longrunning.Operation; -import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; import java.io.IOException; import java.util.List; @@ -107,11 +108,7 @@ public class CollisionsStubSettings extends StubSettings ImmutableList.builder().build(); private final UnaryCallSettings doSomethingSettings; - private final OperationCallSettings< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationSettings; + private final OperationCallSettings doSomethingOperationSettings; private final PagedCallSettings< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings; @@ -176,11 +173,7 @@ public UnaryCallSettings doSomethingSettings() { } /** Returns the object with the settings used for calls to doSomething. */ - public OperationCallSettings< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationSettings() { + public OperationCallSettings doSomethingOperationSettings() { return doSomethingOperationSettings; } @@ -311,10 +304,7 @@ protected CollisionsStubSettings(Builder settingsBuilder) throws IOException { public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder doSomethingSettings; - private final OperationCallSettings.Builder< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> + private final OperationCallSettings.Builder doSomethingOperationSettings; private final PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -421,11 +411,9 @@ private static Builder initDefaults(Builder builder) { .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) .build()) .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create( - DescriptorProtos.GeneratedCodeInfo.Annotation.class)) + ProtoOperationTransformers.ResponseTransformer.create(Annotation.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create( - DescriptorProtos.SourceCodeInfo.Location.class)) + ProtoOperationTransformers.MetadataTransformer.create(Metadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -464,10 +452,7 @@ public UnaryCallSettings.Builder doSomethingSettings() { /** Returns the builder for the settings used for calls to doSomething. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings.Builder< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> + public OperationCallSettings.Builder doSomethingOperationSettings() { return doSomethingOperationSettings; } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java index 04db440b44..35fbbdfac7 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java @@ -33,7 +33,8 @@ import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; -import com.google.protobuf.DescriptorProtos; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -79,11 +80,7 @@ public class GrpcCollisionsStub extends CollisionsStub { .build(); private final UnaryCallable doSomethingCallable; - private final OperationCallable< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationCallable; + private final OperationCallable doSomethingOperationCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; @@ -189,11 +186,7 @@ public UnaryCallable doSomethingCallable() { } @Override - public OperationCallable< - Request, - DescriptorProtos.GeneratedCodeInfo.Annotation, - DescriptorProtos.SourceCodeInfo.Location> - doSomethingOperationCallable() { + public OperationCallable doSomethingOperationCallable() { return doSomethingOperationCallable; } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java index 58d397e5bb..832f142924 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java @@ -38,8 +38,9 @@ import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; -import com.google.protobuf.DescriptorProtos; import com.google.protobuf.TypeRegistry; +import com.google.showcase.v1beta1.Annotation; +import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; import java.io.IOException; import java.util.ArrayList; @@ -60,8 +61,8 @@ public class HttpJsonCollisionsStub extends CollisionsStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() - .add(DescriptorProtos.GeneratedCodeInfo.Annotation.getDescriptor()) - .add(DescriptorProtos.SourceCodeInfo.Location.getDescriptor()) + .add(Metadata.getDescriptor()) + .add(Annotation.getDescriptor()) .build(); private static final ApiMethodDescriptor diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java index 8c0876664f..da9cfe2d15 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java @@ -34,10 +34,8 @@ import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Any; -import com.google.protobuf.DescriptorProtos; import io.grpc.StatusRuntimeException; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -94,13 +92,7 @@ public void tearDown() throws Exception { @Test public void doSomethingTest() throws Exception { - DescriptorProtos.GeneratedCodeInfo.Annotation expectedResponse = - DescriptorProtos.GeneratedCodeInfo.Annotation.newBuilder() - .addAllPath(new ArrayList()) - .setSourceFile("sourceFile-1111864265") - .setBegin(93616297) - .setEnd(100571) - .build(); + Annotation expectedResponse = Annotation.newBuilder().setName("name3373707").build(); Operation resultOperation = Operation.newBuilder() .setName("doSomethingTest") @@ -113,11 +105,10 @@ public void doSomethingTest() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) + .setMetadata(Metadata.newBuilder().build()) .build(); - DescriptorProtos.GeneratedCodeInfo.Annotation actualResponse = - client.doSomethingAsync(request).get(); + Annotation actualResponse = client.doSomethingAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockCollisions.getRequests(); @@ -126,7 +117,7 @@ public void doSomethingTest() throws Exception { Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertEquals(request.getAnnotation(), actualRequest.getAnnotation()); - Assert.assertEquals(request.getLocation(), actualRequest.getLocation()); + Assert.assertEquals(request.getMetadata(), actualRequest.getMetadata()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -143,7 +134,7 @@ public void doSomethingExceptionTest() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) + .setMetadata(Metadata.newBuilder().build()) .build(); client.doSomethingAsync(request).get(); Assert.fail("No exception raised"); diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java index 326d872182..faf0c18e50 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java @@ -25,10 +25,10 @@ public static void registerAllExtensions( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_Location_descriptor; + internal_static_google_showcase_v1beta1_Metadata_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_Location_fieldAccessorTable; + internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -43,13 +43,13 @@ public static void registerAllExtensions( "a1\032\027google/api/client.proto\032#google/long" + "running/operations.proto\"\205\001\n\007Request\022\014\n\004" + "name\030\001 \001(\t\0227\n\nannotation\030\002 \001(\0132#.google." + - "showcase.v1beta1.Annotation\0223\n\010location\030" + - "\003 \001(\0132!.google.showcase.v1beta1.Location" + - "\"\032\n\nAnnotation\022\014\n\004name\030\001 \001(\t\"\030\n\010Location" + + "showcase.v1beta1.Annotation\0223\n\010metadata\030" + + "\003 \001(\0132!.google.showcase.v1beta1.Metadata" + + "\"\032\n\nAnnotation\022\014\n\004name\030\001 \001(\t\"\030\n\010Metadata" + "\022\014\n\004name\030\001 \001(\t2\212\001\n\nCollisions\022i\n\013doSomet" + "hing\022 .google.showcase.v1beta1.Request\032\035" + ".google.longrunning.Operation\"\031\312A\026\n\nAnno" + - "tation\022\010Location\032\021\312A\016localhost:7469B\037\n\033c" + + "tation\022\010Metadata\032\021\312A\016localhost:7469B\037\n\033c" + "om.google.showcase.v1beta1P\001b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor @@ -63,18 +63,18 @@ public static void registerAllExtensions( internal_static_google_showcase_v1beta1_Request_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_showcase_v1beta1_Request_descriptor, - new java.lang.String[] { "Name", "Annotation", "Location", }); + new java.lang.String[] { "Name", "Annotation", "Metadata", }); internal_static_google_showcase_v1beta1_Annotation_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_showcase_v1beta1_Annotation_descriptor, new java.lang.String[] { "Name", }); - internal_static_google_showcase_v1beta1_Location_descriptor = + internal_static_google_showcase_v1beta1_Metadata_descriptor = getDescriptor().getMessageTypes().get(2); - internal_static_google_showcase_v1beta1_Location_fieldAccessorTable = new + internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_Location_descriptor, + internal_static_google_showcase_v1beta1_Metadata_descriptor, new java.lang.String[] { "Name", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java similarity index 80% rename from showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java rename to showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java index df879e8365..4639ffffdc 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java @@ -4,18 +4,18 @@ package com.google.showcase.v1beta1; /** - * Protobuf type {@code google.showcase.v1beta1.Location} + * Protobuf type {@code google.showcase.v1beta1.Metadata} */ -public final class Location extends +public final class Metadata extends com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Location) - LocationOrBuilder { + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Metadata) + MetadataOrBuilder { private static final long serialVersionUID = 0L; - // Use Location.newBuilder() to construct. - private Location(com.google.protobuf.GeneratedMessageV3.Builder builder) { + // Use Metadata.newBuilder() to construct. + private Metadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } - private Location() { + private Metadata() { name_ = ""; } @@ -23,20 +23,20 @@ private Location() { @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { - return new Location(); + return new Metadata(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); + com.google.showcase.v1beta1.Metadata.class, com.google.showcase.v1beta1.Metadata.Builder.class); } public static final int NAME_FIELD_NUMBER = 1; @@ -117,10 +117,10 @@ public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } - if (!(obj instanceof com.google.showcase.v1beta1.Location)) { + if (!(obj instanceof com.google.showcase.v1beta1.Metadata)) { return super.equals(obj); } - com.google.showcase.v1beta1.Location other = (com.google.showcase.v1beta1.Location) obj; + com.google.showcase.v1beta1.Metadata other = (com.google.showcase.v1beta1.Metadata) obj; if (!getName() .equals(other.getName())) return false; @@ -142,44 +142,44 @@ public int hashCode() { return hash; } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.showcase.v1beta1.Location parseFrom(byte[] data) + public static com.google.showcase.v1beta1.Metadata parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.showcase.v1beta1.Location parseFrom(java.io.InputStream input) + public static com.google.showcase.v1beta1.Metadata parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -187,26 +187,26 @@ public static com.google.showcase.v1beta1.Location parseFrom( .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Location parseDelimitedFrom(java.io.InputStream input) + public static com.google.showcase.v1beta1.Metadata parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Location parseDelimitedFrom( + public static com.google.showcase.v1beta1.Metadata parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Location parseFrom( + public static com.google.showcase.v1beta1.Metadata parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -219,7 +219,7 @@ public static com.google.showcase.v1beta1.Location parseFrom( public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } - public static Builder newBuilder(com.google.showcase.v1beta1.Location prototype) { + public static Builder newBuilder(com.google.showcase.v1beta1.Metadata prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override @@ -235,26 +235,26 @@ protected Builder newBuilderForType( return builder; } /** - * Protobuf type {@code google.showcase.v1beta1.Location} + * Protobuf type {@code google.showcase.v1beta1.Metadata} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Location) - com.google.showcase.v1beta1.LocationOrBuilder { + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Metadata) + com.google.showcase.v1beta1.MetadataOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); + com.google.showcase.v1beta1.Metadata.class, com.google.showcase.v1beta1.Metadata.Builder.class); } - // Construct using com.google.showcase.v1beta1.Location.newBuilder() + // Construct using com.google.showcase.v1beta1.Metadata.newBuilder() private Builder() { } @@ -275,17 +275,17 @@ public Builder clear() { @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; } @java.lang.Override - public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { - return com.google.showcase.v1beta1.Location.getDefaultInstance(); + public com.google.showcase.v1beta1.Metadata getDefaultInstanceForType() { + return com.google.showcase.v1beta1.Metadata.getDefaultInstance(); } @java.lang.Override - public com.google.showcase.v1beta1.Location build() { - com.google.showcase.v1beta1.Location result = buildPartial(); + public com.google.showcase.v1beta1.Metadata build() { + com.google.showcase.v1beta1.Metadata result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -293,14 +293,14 @@ public com.google.showcase.v1beta1.Location build() { } @java.lang.Override - public com.google.showcase.v1beta1.Location buildPartial() { - com.google.showcase.v1beta1.Location result = new com.google.showcase.v1beta1.Location(this); + public com.google.showcase.v1beta1.Metadata buildPartial() { + com.google.showcase.v1beta1.Metadata result = new com.google.showcase.v1beta1.Metadata(this); if (bitField0_ != 0) { buildPartial0(result); } onBuilt(); return result; } - private void buildPartial0(com.google.showcase.v1beta1.Location result) { + private void buildPartial0(com.google.showcase.v1beta1.Metadata result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000001) != 0)) { result.name_ = name_; @@ -309,16 +309,16 @@ private void buildPartial0(com.google.showcase.v1beta1.Location result) { @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.Location) { - return mergeFrom((com.google.showcase.v1beta1.Location)other); + if (other instanceof com.google.showcase.v1beta1.Metadata) { + return mergeFrom((com.google.showcase.v1beta1.Metadata)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(com.google.showcase.v1beta1.Location other) { - if (other == com.google.showcase.v1beta1.Location.getDefaultInstance()) return this; + public Builder mergeFrom(com.google.showcase.v1beta1.Metadata other) { + if (other == com.google.showcase.v1beta1.Metadata.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; bitField0_ |= 0x00000001; @@ -456,23 +456,23 @@ public final Builder mergeUnknownFields( } - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Location) + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Metadata) } - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Location) - private static final com.google.showcase.v1beta1.Location DEFAULT_INSTANCE; + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Metadata) + private static final com.google.showcase.v1beta1.Metadata DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Location(); + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Metadata(); } - public static com.google.showcase.v1beta1.Location getDefaultInstance() { + public static com.google.showcase.v1beta1.Metadata getDefaultInstance() { return DEFAULT_INSTANCE; } - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { @java.lang.Override - public Location parsePartialFrom( + public Metadata parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -491,17 +491,17 @@ public Location parsePartialFrom( } }; - public static com.google.protobuf.Parser parser() { + public static com.google.protobuf.Parser parser() { return PARSER; } @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } @java.lang.Override - public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { + public com.google.showcase.v1beta1.Metadata getDefaultInstanceForType() { return DEFAULT_INSTANCE; } diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/MetadataOrBuilder.java similarity index 89% rename from showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java rename to showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/MetadataOrBuilder.java index 37f73be8aa..6465a7bc9c 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/MetadataOrBuilder.java @@ -3,8 +3,8 @@ package com.google.showcase.v1beta1; -public interface LocationOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Location) +public interface MetadataOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Metadata) com.google.protobuf.MessageOrBuilder { /** diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java index 9374b40128..96fa6c924f 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java @@ -104,30 +104,30 @@ public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; } - public static final int LOCATION_FIELD_NUMBER = 3; - private com.google.showcase.v1beta1.Location location_; + public static final int METADATA_FIELD_NUMBER = 3; + private com.google.showcase.v1beta1.Metadata metadata_; /** - * .google.showcase.v1beta1.Location location = 3; - * @return Whether the location field is set. + * .google.showcase.v1beta1.Metadata metadata = 3; + * @return Whether the metadata field is set. */ @java.lang.Override - public boolean hasLocation() { - return location_ != null; + public boolean hasMetadata() { + return metadata_ != null; } /** - * .google.showcase.v1beta1.Location location = 3; - * @return The location. + * .google.showcase.v1beta1.Metadata metadata = 3; + * @return The metadata. */ @java.lang.Override - public com.google.showcase.v1beta1.Location getLocation() { - return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + public com.google.showcase.v1beta1.Metadata getMetadata() { + return metadata_ == null ? com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ @java.lang.Override - public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { - return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + public com.google.showcase.v1beta1.MetadataOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; } private byte memoizedIsInitialized = -1; @@ -150,8 +150,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (annotation_ != null) { output.writeMessage(2, getAnnotation()); } - if (location_ != null) { - output.writeMessage(3, getLocation()); + if (metadata_ != null) { + output.writeMessage(3, getMetadata()); } getUnknownFields().writeTo(output); } @@ -169,9 +169,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, getAnnotation()); } - if (location_ != null) { + if (metadata_ != null) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, getLocation()); + .computeMessageSize(3, getMetadata()); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -195,10 +195,10 @@ public boolean equals(final java.lang.Object obj) { if (!getAnnotation() .equals(other.getAnnotation())) return false; } - if (hasLocation() != other.hasLocation()) return false; - if (hasLocation()) { - if (!getLocation() - .equals(other.getLocation())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; @@ -217,9 +217,9 @@ public int hashCode() { hash = (37 * hash) + ANNOTATION_FIELD_NUMBER; hash = (53 * hash) + getAnnotation().hashCode(); } - if (hasLocation()) { - hash = (37 * hash) + LOCATION_FIELD_NUMBER; - hash = (53 * hash) + getLocation().hashCode(); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; @@ -358,10 +358,10 @@ public Builder clear() { annotationBuilder_.dispose(); annotationBuilder_ = null; } - location_ = null; - if (locationBuilder_ != null) { - locationBuilder_.dispose(); - locationBuilder_ = null; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; } return this; } @@ -405,9 +405,9 @@ private void buildPartial0(com.google.showcase.v1beta1.Request result) { : annotationBuilder_.build(); } if (((from_bitField0_ & 0x00000004) != 0)) { - result.location_ = locationBuilder_ == null - ? location_ - : locationBuilder_.build(); + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); } } @@ -431,8 +431,8 @@ public Builder mergeFrom(com.google.showcase.v1beta1.Request other) { if (other.hasAnnotation()) { mergeAnnotation(other.getAnnotation()); } - if (other.hasLocation()) { - mergeLocation(other.getLocation()); + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); @@ -474,7 +474,7 @@ public Builder mergeFrom( } // case 18 case 26: { input.readMessage( - getLocationFieldBuilder().getBuilder(), + getMetadataFieldBuilder().getBuilder(), extensionRegistry); bitField0_ |= 0x00000004; break; @@ -687,123 +687,123 @@ public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() return annotationBuilder_; } - private com.google.showcase.v1beta1.Location location_; + private com.google.showcase.v1beta1.Metadata metadata_; private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> locationBuilder_; + com.google.showcase.v1beta1.Metadata, com.google.showcase.v1beta1.Metadata.Builder, com.google.showcase.v1beta1.MetadataOrBuilder> metadataBuilder_; /** - * .google.showcase.v1beta1.Location location = 3; - * @return Whether the location field is set. + * .google.showcase.v1beta1.Metadata metadata = 3; + * @return Whether the metadata field is set. */ - public boolean hasLocation() { + public boolean hasMetadata() { return ((bitField0_ & 0x00000004) != 0); } /** - * .google.showcase.v1beta1.Location location = 3; - * @return The location. + * .google.showcase.v1beta1.Metadata metadata = 3; + * @return The metadata. */ - public com.google.showcase.v1beta1.Location getLocation() { - if (locationBuilder_ == null) { - return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + public com.google.showcase.v1beta1.Metadata getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; } else { - return locationBuilder_.getMessage(); + return metadataBuilder_.getMessage(); } } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - public Builder setLocation(com.google.showcase.v1beta1.Location value) { - if (locationBuilder_ == null) { + public Builder setMetadata(com.google.showcase.v1beta1.Metadata value) { + if (metadataBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - location_ = value; + metadata_ = value; } else { - locationBuilder_.setMessage(value); + metadataBuilder_.setMessage(value); } bitField0_ |= 0x00000004; onChanged(); return this; } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - public Builder setLocation( - com.google.showcase.v1beta1.Location.Builder builderForValue) { - if (locationBuilder_ == null) { - location_ = builderForValue.build(); + public Builder setMetadata( + com.google.showcase.v1beta1.Metadata.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); } else { - locationBuilder_.setMessage(builderForValue.build()); + metadataBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; onChanged(); return this; } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - public Builder mergeLocation(com.google.showcase.v1beta1.Location value) { - if (locationBuilder_ == null) { + public Builder mergeMetadata(com.google.showcase.v1beta1.Metadata value) { + if (metadataBuilder_ == null) { if (((bitField0_ & 0x00000004) != 0) && - location_ != null && - location_ != com.google.showcase.v1beta1.Location.getDefaultInstance()) { - getLocationBuilder().mergeFrom(value); + metadata_ != null && + metadata_ != com.google.showcase.v1beta1.Metadata.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); } else { - location_ = value; + metadata_ = value; } } else { - locationBuilder_.mergeFrom(value); + metadataBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; onChanged(); return this; } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - public Builder clearLocation() { + public Builder clearMetadata() { bitField0_ = (bitField0_ & ~0x00000004); - location_ = null; - if (locationBuilder_ != null) { - locationBuilder_.dispose(); - locationBuilder_ = null; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; } onChanged(); return this; } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - public com.google.showcase.v1beta1.Location.Builder getLocationBuilder() { + public com.google.showcase.v1beta1.Metadata.Builder getMetadataBuilder() { bitField0_ |= 0x00000004; onChanged(); - return getLocationFieldBuilder().getBuilder(); + return getMetadataFieldBuilder().getBuilder(); } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { - if (locationBuilder_ != null) { - return locationBuilder_.getMessageOrBuilder(); + public com.google.showcase.v1beta1.MetadataOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); } else { - return location_ == null ? - com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; + return metadata_ == null ? + com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; } } /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> - getLocationFieldBuilder() { - if (locationBuilder_ == null) { - locationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder>( - getLocation(), + com.google.showcase.v1beta1.Metadata, com.google.showcase.v1beta1.Metadata.Builder, com.google.showcase.v1beta1.MetadataOrBuilder> + getMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Metadata, com.google.showcase.v1beta1.Metadata.Builder, com.google.showcase.v1beta1.MetadataOrBuilder>( + getMetadata(), getParentForChildren(), isClean()); - location_ = null; + metadata_ = null; } - return locationBuilder_; + return metadataBuilder_; } @java.lang.Override public final Builder setUnknownFields( diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java index a8febedd64..fde53e1f8e 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java @@ -35,17 +35,17 @@ public interface RequestOrBuilder extends com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder(); /** - * .google.showcase.v1beta1.Location location = 3; - * @return Whether the location field is set. + * .google.showcase.v1beta1.Metadata metadata = 3; + * @return Whether the metadata field is set. */ - boolean hasLocation(); + boolean hasMetadata(); /** - * .google.showcase.v1beta1.Location location = 3; - * @return The location. + * .google.showcase.v1beta1.Metadata metadata = 3; + * @return The metadata. */ - com.google.showcase.v1beta1.Location getLocation(); + com.google.showcase.v1beta1.Metadata getMetadata(); /** - * .google.showcase.v1beta1.Location location = 3; + * .google.showcase.v1beta1.Metadata metadata = 3; */ - com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder(); + com.google.showcase.v1beta1.MetadataOrBuilder getMetadataOrBuilder(); } From 7c759a9541cd22f5332cd5d977c49ba2ba5222e3 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 31 May 2023 17:27:52 -0400 Subject: [PATCH 07/18] test: update showcase-extended goldens after merging changes from main --- .../SyncCreateSetCredentialsProvider.java | 2 +- .../SyncCreateSetCredentialsProvider1.java | 2 +- .../create/SyncCreateSetEndpoint.java | 2 +- .../dosomething/AsyncDoSomething.java | 2 +- .../dosomething/AsyncDoSomethingLRO.java | 2 +- .../dosomething/SyncDoSomething.java | 2 +- .../getlocation/AsyncGetLocation.java | 2 +- .../getlocation/SyncGetLocation.java | 2 +- .../listlocations/AsyncListLocations.java | 2 +- .../AsyncListLocationsPaged.java | 2 +- .../listlocations/SyncListLocations.java | 2 +- .../getlocation/SyncGetLocation.java | 2 +- .../getlocation/SyncGetLocation.java | 2 +- .../craftevilplan/SyncCraftEvilPlan.java | 2 +- .../AsyncBrainstormEvilPlans.java | 2 +- .../craftevilplan/AsyncCraftEvilPlan.java | 2 +- .../craftevilplan/SyncCraftEvilPlan.java | 2 +- .../SyncCreateSetCredentialsProvider.java | 2 +- .../SyncCreateSetCredentialsProvider1.java | 2 +- .../wicked/create/SyncCreateSetEndpoint.java | 2 +- .../wicked/getlocation/AsyncGetLocation.java | 2 +- .../wicked/getlocation/SyncGetLocation.java | 2 +- .../listlocations/AsyncListLocations.java | 2 +- .../AsyncListLocationsPaged.java | 2 +- .../listlocations/SyncListLocations.java | 2 +- .../AsyncPersuadeEvilPlan.java | 2 +- .../craftevilplan/SyncCraftEvilPlan.java | 2 +- .../showcase/v1beta1/CollisionsClient.java | 2 +- .../showcase/v1beta1/CollisionsSettings.java | 2 +- .../google/showcase/v1beta1/WickedClient.java | 2 +- .../showcase/v1beta1/WickedSettings.java | 2 +- .../showcase/v1beta1/stub/CollisionsStub.java | 2 +- .../v1beta1/stub/CollisionsStubSettings.java | 2 +- .../stub/GrpcCollisionsCallableFactory.java | 2 +- .../v1beta1/stub/GrpcCollisionsStub.java | 2 +- .../stub/GrpcWickedCallableFactory.java | 2 +- .../showcase/v1beta1/stub/GrpcWickedStub.java | 2 +- .../HttpJsonCollisionsCallableFactory.java | 2 +- .../v1beta1/stub/HttpJsonCollisionsStub.java | 2 +- .../stub/HttpJsonWickedCallableFactory.java | 2 +- .../v1beta1/stub/HttpJsonWickedStub.java | 2 +- .../showcase/v1beta1/stub/WickedStub.java | 2 +- .../v1beta1/stub/WickedStubSettings.java | 2 +- .../v1beta1/CollisionsClientHttpJsonTest.java | 2 +- .../v1beta1/CollisionsClientTest.java | 2 +- .../showcase/v1beta1/MockCollisions.java | 2 +- .../showcase/v1beta1/MockCollisionsImpl.java | 2 +- .../google/showcase/v1beta1/MockWicked.java | 2 +- .../showcase/v1beta1/MockWickedImpl.java | 2 +- .../v1beta1/WickedClientHttpJsonTest.java | 2 +- .../showcase/v1beta1/WickedClientTest.java | 2 +- .../google/showcase/v1beta1/Annotation.java | 39 ++++++++++++++++++- .../google/showcase/v1beta1/EvilRequest.java | 39 ++++++++++++++++++- .../google/showcase/v1beta1/EvilResponse.java | 39 ++++++++++++++++++- .../com/google/showcase/v1beta1/Metadata.java | 39 ++++++++++++++++++- .../com/google/showcase/v1beta1/Request.java | 39 ++++++++++++++++++- 56 files changed, 236 insertions(+), 61 deletions(-) diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java index 507734e8e2..2bc2cd0be7 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java index a60f10c365..d09b8ca88d 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java index 45bf928ae6..15627c4ae9 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java index 8eb114eaac..30445aabbb 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java index f9fcb62291..ec11e8d692 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java index 255f977800..ed3426ea11 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java index 2ec2689e0e..903fcc6b26 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java index fb594b8e79..468f9a120f 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java index 83716796aa..e3231849c0 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java index 817d99ba25..1eca857f08 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java index a37b330b89..539b2c6f3b 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java index f9dfd67664..355ed7f1c5 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java index dce0590ab3..781c3f4653 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java index de6207f682..d37ea2865c 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java index 8bcb58afbb..a7a9a72437 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java index 8be0e67e7c..b7133bcc21 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java index 4b7aeb0f9c..67d75d0f2a 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java index c4eb08016b..9af0aaa741 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java index 904ca354a6..38fb1b127b 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java index bff6d56f2b..87b154260c 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java index e2228a9939..0bd173c76a 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java index 9a30312e45..e5e8f160e5 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java index 0ea2d5884a..d37e1b1fda 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java index c68cc6191a..f1b1ef00c1 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java index f17136c827..61a487a7af 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java index 88d9d4f18e..1aa00ccb50 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java index ee9bc599ad..af8709d91a 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java index 6f1d96c7a8..7ae3b9aa59 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java index 7ff83412c3..84a0fcb15a 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java index 9a4fc0ec99..014d399e74 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java index d818e2a2bf..c3a824a6b2 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java index cd953ba815..57289da7dc 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java index b38b5833b7..593b151956 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java index 6c39ee28b5..ef0ea02f4d 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java index 35fbbdfac7..59fde0f3a0 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java index a98141bc97..388b417f03 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java index 94dd0e4d01..c3e680dee2 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java index 749d6cd828..0da4f298cc 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java index 832f142924..f2367700a1 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java index 16dde24678..37726531b0 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java index 78e03df937..d45cbba41e 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java index cd9f5d2fee..0693ab1315 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java index 4f0d92cd66..dfb54a1ad3 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java index 8b3d33fd56..0aa72be007 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java index da9cfe2d15..1da72bb40d 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java index a078fda36d..580b7c4d51 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java index 2f06a674dc..ec284c97a7 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java index 94a2d21499..219dc25a91 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java index 0db01ba8a6..0fdad0b607 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java index 6b68fca732..9d3ca75149 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java index 2ed4e3bad5..67bf9d3567 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java index 420df938ec..e36e50a459 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java @@ -26,6 +26,11 @@ protected java.lang.Object newInstance( return new Annotation(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; @@ -186,13 +191,11 @@ public static com.google.showcase.v1beta1.Annotation parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Annotation parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Annotation parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -307,6 +310,38 @@ private void buildPartial0(com.google.showcase.v1beta1.Annotation result) { } } + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.showcase.v1beta1.Annotation) { diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java index e41c78284c..ed713fa0b7 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java @@ -26,6 +26,11 @@ protected java.lang.Object newInstance( return new EvilRequest(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; @@ -186,13 +191,11 @@ public static com.google.showcase.v1beta1.EvilRequest parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.EvilRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.EvilRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -307,6 +310,38 @@ private void buildPartial0(com.google.showcase.v1beta1.EvilRequest result) { } } + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.showcase.v1beta1.EvilRequest) { diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java index d9c0a7a380..96c096134f 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java @@ -26,6 +26,11 @@ protected java.lang.Object newInstance( return new EvilResponse(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; @@ -186,13 +191,11 @@ public static com.google.showcase.v1beta1.EvilResponse parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.EvilResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.EvilResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -307,6 +310,38 @@ private void buildPartial0(com.google.showcase.v1beta1.EvilResponse result) { } } + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.showcase.v1beta1.EvilResponse) { diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java index 4639ffffdc..e86d39b3b1 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java @@ -26,6 +26,11 @@ protected java.lang.Object newInstance( return new Metadata(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; @@ -186,13 +191,11 @@ public static com.google.showcase.v1beta1.Metadata parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Metadata parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Metadata parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -307,6 +310,38 @@ private void buildPartial0(com.google.showcase.v1beta1.Metadata result) { } } + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.showcase.v1beta1.Metadata) { diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java index 96fa6c924f..c39bb9d868 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java @@ -26,6 +26,11 @@ protected java.lang.Object newInstance( return new Request(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; @@ -270,13 +275,11 @@ public static com.google.showcase.v1beta1.Request parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Request parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Request parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -411,6 +414,38 @@ private void buildPartial0(com.google.showcase.v1beta1.Request result) { } } + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.showcase.v1beta1.Request) { From 67fececd180a7753abb71104f25ab5efd9e10984 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 31 May 2023 22:54:08 -0400 Subject: [PATCH 08/18] fix: recursively write generics on methodInvocationExpr to account for fully qualified types --- .../google/api/generator/engine/writer/JavaWriterVisitor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java b/gapic-generator-java/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java index e092f1c69c..e956d86949 100644 --- a/gapic-generator-java/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java +++ b/gapic-generator-java/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java @@ -362,7 +362,8 @@ public void visit(MethodInvocationExpr methodInvocationExpr) { leftAngle(); int numGenerics = methodInvocationExpr.generics().size(); for (int i = 0; i < numGenerics; i++) { - buffer.append(methodInvocationExpr.generics().get(i).name()); + Reference r = methodInvocationExpr.generics().get(i); + r.accept(this); if (i < numGenerics - 1) { buffer.append(COMMA); space(); From 30d8a0d78a01cf15fb4b2b19abe48bcdf1b00e24 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 31 May 2023 22:59:11 -0400 Subject: [PATCH 09/18] test: add Location edge case back to test proto and update goldens --- .../proto/collisions.proto | 6 +- .../dosomething/AsyncDoSomething.java | 4 +- .../dosomething/AsyncDoSomethingLRO.java | 6 +- .../dosomething/SyncDoSomething.java | 4 +- .../showcase/v1beta1/CollisionsClient.java | 14 +- .../showcase/v1beta1/CollisionsSettings.java | 5 +- .../showcase/v1beta1/stub/CollisionsStub.java | 8 +- .../v1beta1/stub/CollisionsStubSettings.java | 44 +++-- .../v1beta1/stub/GrpcCollisionsStub.java | 7 +- .../v1beta1/stub/HttpJsonCollisionsStub.java | 31 +-- .../v1beta1/CollisionsClientTest.java | 6 +- .../v1beta1/CollisionsOuterClass.java | 20 +- .../v1beta1/{Metadata.java => Location.java} | 112 +++++------ ...aOrBuilder.java => LocationOrBuilder.java} | 4 +- .../com/google/showcase/v1beta1/Request.java | 176 +++++++++--------- .../showcase/v1beta1/RequestOrBuilder.java | 16 +- 16 files changed, 240 insertions(+), 223 deletions(-) rename showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/{Metadata.java => Location.java} (81%) rename showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/{MetadataOrBuilder.java => LocationOrBuilder.java} (89%) diff --git a/showcase/gapic-showcase-extended/proto/collisions.proto b/showcase/gapic-showcase-extended/proto/collisions.proto index 6e73d526e0..009fcd77f9 100644 --- a/showcase/gapic-showcase-extended/proto/collisions.proto +++ b/showcase/gapic-showcase-extended/proto/collisions.proto @@ -29,7 +29,7 @@ service Collisions { rpc doSomething(Request) returns (google.longrunning.Operation) { option (google.longrunning.operation_info) = { response_type: "Annotation" - metadata_type: "Metadata" + metadata_type: "Location" }; } } @@ -37,13 +37,13 @@ service Collisions { message Request { string name = 1; Annotation annotation = 2; - Metadata metadata = 3; + Location location = 3; } message Annotation { string name = 1; } -message Metadata { +message Location { string name = 1; } \ No newline at end of file diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java index 30445aabbb..ccfb6d757b 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java @@ -21,7 +21,7 @@ import com.google.longrunning.Operation; import com.google.showcase.v1beta1.Annotation; import com.google.showcase.v1beta1.CollisionsClient; -import com.google.showcase.v1beta1.Metadata; +import com.google.showcase.v1beta1.Location; import com.google.showcase.v1beta1.Request; public class AsyncDoSomething { @@ -41,7 +41,7 @@ public static void asyncDoSomething() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setMetadata(Metadata.newBuilder().build()) + .setLocation(Location.newBuilder().build()) .build(); ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request); // Do something. diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java index ec11e8d692..6f87f4612b 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java @@ -20,7 +20,7 @@ import com.google.api.gax.longrunning.OperationFuture; import com.google.showcase.v1beta1.Annotation; import com.google.showcase.v1beta1.CollisionsClient; -import com.google.showcase.v1beta1.Metadata; +import com.google.showcase.v1beta1.Location; import com.google.showcase.v1beta1.Request; public class AsyncDoSomethingLRO { @@ -40,9 +40,9 @@ public static void asyncDoSomethingLRO() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setMetadata(Metadata.newBuilder().build()) + .setLocation(Location.newBuilder().build()) .build(); - OperationFuture future = + OperationFuture future = collisionsClient.doSomethingOperationCallable().futureCall(request); // Do something. Annotation response = future.get(); diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java index ed3426ea11..8512379c1b 100644 --- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java +++ b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java @@ -19,7 +19,7 @@ // [START localhost7469_v1beta1_generated_Collisions_DoSomething_sync] import com.google.showcase.v1beta1.Annotation; import com.google.showcase.v1beta1.CollisionsClient; -import com.google.showcase.v1beta1.Metadata; +import com.google.showcase.v1beta1.Location; import com.google.showcase.v1beta1.Request; public class SyncDoSomething { @@ -39,7 +39,7 @@ public static void syncDoSomething() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setMetadata(Metadata.newBuilder().build()) + .setLocation(Location.newBuilder().build()) .build(); Annotation response = collisionsClient.doSomethingAsync(request).get(); } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java index 7ae3b9aa59..6a82edbe55 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java @@ -216,7 +216,7 @@ public final OperationsClient getHttpJsonOperationsClient() { * Request.newBuilder() * .setName("name3373707") * .setAnnotation(Annotation.newBuilder().build()) - * .setMetadata(Metadata.newBuilder().build()) + * .setLocation(Location.newBuilder().build()) * .build(); * Annotation response = collisionsClient.doSomethingAsync(request).get(); * } @@ -225,7 +225,8 @@ public final OperationsClient getHttpJsonOperationsClient() { * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final OperationFuture doSomethingAsync(Request request) { + public final OperationFuture doSomethingAsync( + Request request) { return doSomethingOperationCallable().futureCall(request); } @@ -244,16 +245,17 @@ public final OperationFuture doSomethingAsync(Request requ * Request.newBuilder() * .setName("name3373707") * .setAnnotation(Annotation.newBuilder().build()) - * .setMetadata(Metadata.newBuilder().build()) + * .setLocation(Location.newBuilder().build()) * .build(); - * OperationFuture future = + * OperationFuture future = * collisionsClient.doSomethingOperationCallable().futureCall(request); * // Do something. * Annotation response = future.get(); * } * } */ - public final OperationCallable doSomethingOperationCallable() { + public final OperationCallable + doSomethingOperationCallable() { return stub.doSomethingOperationCallable(); } @@ -272,7 +274,7 @@ public final OperationCallable doSomethingOperati * Request.newBuilder() * .setName("name3373707") * .setAnnotation(Annotation.newBuilder().build()) - * .setMetadata(Metadata.newBuilder().build()) + * .setLocation(Location.newBuilder().build()) * .build(); * ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request); * // Do something. diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java index 84a0fcb15a..87f40b9349 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java @@ -88,7 +88,8 @@ public UnaryCallSettings doSomethingSettings() { } /** Returns the object with the settings used for calls to doSomething. */ - public OperationCallSettings doSomethingOperationSettings() { + public OperationCallSettings + doSomethingOperationSettings() { return ((CollisionsStubSettings) getStubSettings()).doSomethingOperationSettings(); } @@ -223,7 +224,7 @@ public UnaryCallSettings.Builder doSomethingSettings() { } /** Returns the builder for the settings used for calls to doSomething. */ - public OperationCallSettings.Builder + public OperationCallSettings.Builder doSomethingOperationSettings() { return getStubSettingsBuilder().doSomethingOperationSettings(); } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java index 57289da7dc..0812b07fe1 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java @@ -25,11 +25,10 @@ import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Metadata; +import com.google.showcase.v1beta1.Location; import com.google.showcase.v1beta1.Request; import javax.annotation.Generated; @@ -51,7 +50,7 @@ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOp return null; } - public OperationCallable doSomethingOperationCallable() { + public OperationCallable doSomethingOperationCallable() { throw new UnsupportedOperationException("Not implemented: doSomethingOperationCallable()"); } @@ -68,7 +67,8 @@ public UnaryCallable listLocationsC throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); } - public UnaryCallable getLocationCallable() { + public UnaryCallable + getLocationCallable() { throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java index 593b151956..9da36484d5 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java @@ -50,14 +50,13 @@ import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.longrunning.Operation; import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Metadata; +import com.google.showcase.v1beta1.Location; import com.google.showcase.v1beta1.Request; import java.io.IOException; import java.util.List; @@ -108,15 +107,18 @@ public class CollisionsStubSettings extends StubSettings ImmutableList.builder().build(); private final UnaryCallSettings doSomethingSettings; - private final OperationCallSettings doSomethingOperationSettings; + private final OperationCallSettings doSomethingOperationSettings; private final PagedCallSettings< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings; - private final UnaryCallSettings getLocationSettings; + private final UnaryCallSettings + getLocationSettings; - private static final PagedListDescriptor + private static final PagedListDescriptor< + ListLocationsRequest, ListLocationsResponse, com.google.cloud.location.Location> LIST_LOCATIONS_PAGE_STR_DESC = - new PagedListDescriptor() { + new PagedListDescriptor< + ListLocationsRequest, ListLocationsResponse, com.google.cloud.location.Location>() { @Override public String emptyToken() { return ""; @@ -143,9 +145,10 @@ public String extractNextToken(ListLocationsResponse payload) { } @Override - public Iterable extractResources(ListLocationsResponse payload) { + public Iterable extractResources( + ListLocationsResponse payload) { return payload.getLocationsList() == null - ? ImmutableList.of() + ? ImmutableList.of() : payload.getLocationsList(); } }; @@ -161,8 +164,12 @@ public ApiFuture getFuturePagedResponse( ListLocationsRequest request, ApiCallContext context, ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); + PageContext< + ListLocationsRequest, + ListLocationsResponse, + com.google.cloud.location.Location> + pageContext = + PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); } }; @@ -173,7 +180,7 @@ public UnaryCallSettings doSomethingSettings() { } /** Returns the object with the settings used for calls to doSomething. */ - public OperationCallSettings doSomethingOperationSettings() { + public OperationCallSettings doSomethingOperationSettings() { return doSomethingOperationSettings; } @@ -184,7 +191,8 @@ public OperationCallSettings doSomethingOperation } /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings getLocationSettings() { + public UnaryCallSettings + getLocationSettings() { return getLocationSettings; } @@ -304,12 +312,13 @@ protected CollisionsStubSettings(Builder settingsBuilder) throws IOException { public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder doSomethingSettings; - private final OperationCallSettings.Builder + private final OperationCallSettings.Builder doSomethingOperationSettings; private final PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings; - private final UnaryCallSettings.Builder getLocationSettings; + private final UnaryCallSettings.Builder + getLocationSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -413,7 +422,7 @@ private static Builder initDefaults(Builder builder) { .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Annotation.class)) .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(Metadata.class)) + ProtoOperationTransformers.MetadataTransformer.create(Location.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() @@ -452,7 +461,7 @@ public UnaryCallSettings.Builder doSomethingSettings() { /** Returns the builder for the settings used for calls to doSomething. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings.Builder + public OperationCallSettings.Builder doSomethingOperationSettings() { return doSomethingOperationSettings; } @@ -465,7 +474,8 @@ public UnaryCallSettings.Builder doSomethingSettings() { } /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder getLocationSettings() { + public UnaryCallSettings.Builder + getLocationSettings() { return getLocationSettings; } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java index 59fde0f3a0..c528dfc90e 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java @@ -34,7 +34,6 @@ import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Metadata; import com.google.showcase.v1beta1.Request; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; @@ -80,7 +79,8 @@ public class GrpcCollisionsStub extends CollisionsStub { .build(); private final UnaryCallable doSomethingCallable; - private final OperationCallable doSomethingOperationCallable; + private final OperationCallable + doSomethingOperationCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; @@ -186,7 +186,8 @@ public UnaryCallable doSomethingCallable() { } @Override - public OperationCallable doSomethingOperationCallable() { + public OperationCallable + doSomethingOperationCallable() { return doSomethingOperationCallable; } diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java index f2367700a1..601ad4b35c 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java @@ -35,12 +35,11 @@ import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; import com.google.common.collect.ImmutableMap; import com.google.longrunning.Operation; import com.google.protobuf.TypeRegistry; import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Metadata; +import com.google.showcase.v1beta1.Location; import com.google.showcase.v1beta1.Request; import java.io.IOException; import java.util.ArrayList; @@ -61,7 +60,7 @@ public class HttpJsonCollisionsStub extends CollisionsStub { private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder() - .add(Metadata.getDescriptor()) + .add(Location.getDescriptor()) .add(Annotation.getDescriptor()) .build(); @@ -98,9 +97,9 @@ public class HttpJsonCollisionsStub extends CollisionsStub { .build()) .build(); - private static final ApiMethodDescriptor + private static final ApiMethodDescriptor getLocationMethodDescriptor = - ApiMethodDescriptor.newBuilder() + ApiMethodDescriptor.newBuilder() .setFullMethodName("google.cloud.location.Locations/GetLocation") .setHttpMethod("GET") .setType(ApiMethodDescriptor.MethodType.UNARY) @@ -125,8 +124,8 @@ public class HttpJsonCollisionsStub extends CollisionsStub { .setRequestBodyExtractor(request -> null) .build()) .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Location.getDefaultInstance()) + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(com.google.cloud.location.Location.getDefaultInstance()) .setDefaultTypeRegistry(typeRegistry) .build()) .build(); @@ -134,7 +133,8 @@ public class HttpJsonCollisionsStub extends CollisionsStub { private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; - private final UnaryCallable getLocationCallable; + private final UnaryCallable + getLocationCallable; private final BackgroundResource backgroundResources; private final HttpJsonOperationsStub httpJsonOperationsStub; @@ -204,11 +204,13 @@ protected HttpJsonCollisionsStub( .setMethodDescriptor(listLocationsMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); - HttpJsonCallSettings getLocationTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(getLocationMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); + HttpJsonCallSettings + getLocationTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); this.listLocationsCallable = callableFactory.createUnaryCallable( @@ -248,7 +250,8 @@ public UnaryCallable listLocationsC } @Override - public UnaryCallable getLocationCallable() { + public UnaryCallable + getLocationCallable() { return getLocationCallable; } diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java index 1da72bb40d..a1c6bf43d7 100644 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java +++ b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java @@ -105,7 +105,7 @@ public void doSomethingTest() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setMetadata(Metadata.newBuilder().build()) + .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) .build(); Annotation actualResponse = client.doSomethingAsync(request).get(); @@ -117,7 +117,7 @@ public void doSomethingTest() throws Exception { Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertEquals(request.getAnnotation(), actualRequest.getAnnotation()); - Assert.assertEquals(request.getMetadata(), actualRequest.getMetadata()); + Assert.assertEquals(request.getLocation(), actualRequest.getLocation()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -134,7 +134,7 @@ public void doSomethingExceptionTest() throws Exception { Request.newBuilder() .setName("name3373707") .setAnnotation(Annotation.newBuilder().build()) - .setMetadata(Metadata.newBuilder().build()) + .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) .build(); client.doSomethingAsync(request).get(); Assert.fail("No exception raised"); diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java index faf0c18e50..326d872182 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java @@ -25,10 +25,10 @@ public static void registerAllExtensions( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_Metadata_descriptor; + internal_static_google_showcase_v1beta1_Location_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable; + internal_static_google_showcase_v1beta1_Location_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -43,13 +43,13 @@ public static void registerAllExtensions( "a1\032\027google/api/client.proto\032#google/long" + "running/operations.proto\"\205\001\n\007Request\022\014\n\004" + "name\030\001 \001(\t\0227\n\nannotation\030\002 \001(\0132#.google." + - "showcase.v1beta1.Annotation\0223\n\010metadata\030" + - "\003 \001(\0132!.google.showcase.v1beta1.Metadata" + - "\"\032\n\nAnnotation\022\014\n\004name\030\001 \001(\t\"\030\n\010Metadata" + + "showcase.v1beta1.Annotation\0223\n\010location\030" + + "\003 \001(\0132!.google.showcase.v1beta1.Location" + + "\"\032\n\nAnnotation\022\014\n\004name\030\001 \001(\t\"\030\n\010Location" + "\022\014\n\004name\030\001 \001(\t2\212\001\n\nCollisions\022i\n\013doSomet" + "hing\022 .google.showcase.v1beta1.Request\032\035" + ".google.longrunning.Operation\"\031\312A\026\n\nAnno" + - "tation\022\010Metadata\032\021\312A\016localhost:7469B\037\n\033c" + + "tation\022\010Location\032\021\312A\016localhost:7469B\037\n\033c" + "om.google.showcase.v1beta1P\001b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor @@ -63,18 +63,18 @@ public static void registerAllExtensions( internal_static_google_showcase_v1beta1_Request_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_showcase_v1beta1_Request_descriptor, - new java.lang.String[] { "Name", "Annotation", "Metadata", }); + new java.lang.String[] { "Name", "Annotation", "Location", }); internal_static_google_showcase_v1beta1_Annotation_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_showcase_v1beta1_Annotation_descriptor, new java.lang.String[] { "Name", }); - internal_static_google_showcase_v1beta1_Metadata_descriptor = + internal_static_google_showcase_v1beta1_Location_descriptor = getDescriptor().getMessageTypes().get(2); - internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable = new + internal_static_google_showcase_v1beta1_Location_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_Metadata_descriptor, + internal_static_google_showcase_v1beta1_Location_descriptor, new java.lang.String[] { "Name", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java similarity index 81% rename from showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java rename to showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java index e86d39b3b1..7e9c559fef 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Metadata.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java @@ -4,18 +4,18 @@ package com.google.showcase.v1beta1; /** - * Protobuf type {@code google.showcase.v1beta1.Metadata} + * Protobuf type {@code google.showcase.v1beta1.Location} */ -public final class Metadata extends +public final class Location extends com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Metadata) - MetadataOrBuilder { + // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Location) + LocationOrBuilder { private static final long serialVersionUID = 0L; - // Use Metadata.newBuilder() to construct. - private Metadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + // Use Location.newBuilder() to construct. + private Location(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } - private Metadata() { + private Location() { name_ = ""; } @@ -23,7 +23,7 @@ private Metadata() { @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { - return new Metadata(); + return new Location(); } @java.lang.Override @@ -33,15 +33,15 @@ protected java.lang.Object newInstance( } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Metadata.class, com.google.showcase.v1beta1.Metadata.Builder.class); + com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); } public static final int NAME_FIELD_NUMBER = 1; @@ -122,10 +122,10 @@ public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } - if (!(obj instanceof com.google.showcase.v1beta1.Metadata)) { + if (!(obj instanceof com.google.showcase.v1beta1.Location)) { return super.equals(obj); } - com.google.showcase.v1beta1.Metadata other = (com.google.showcase.v1beta1.Metadata) obj; + com.google.showcase.v1beta1.Location other = (com.google.showcase.v1beta1.Location) obj; if (!getName() .equals(other.getName())) return false; @@ -147,69 +147,69 @@ public int hashCode() { return hash; } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.showcase.v1beta1.Metadata parseFrom(byte[] data) + public static com.google.showcase.v1beta1.Location parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.google.showcase.v1beta1.Metadata parseFrom(java.io.InputStream input) + public static com.google.showcase.v1beta1.Location parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Metadata parseDelimitedFrom(java.io.InputStream input) + public static com.google.showcase.v1beta1.Location parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Metadata parseDelimitedFrom( + public static com.google.showcase.v1beta1.Location parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } - public static com.google.showcase.v1beta1.Metadata parseFrom( + public static com.google.showcase.v1beta1.Location parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -222,7 +222,7 @@ public static com.google.showcase.v1beta1.Metadata parseFrom( public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } - public static Builder newBuilder(com.google.showcase.v1beta1.Metadata prototype) { + public static Builder newBuilder(com.google.showcase.v1beta1.Location prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override @@ -238,26 +238,26 @@ protected Builder newBuilderForType( return builder; } /** - * Protobuf type {@code google.showcase.v1beta1.Metadata} + * Protobuf type {@code google.showcase.v1beta1.Location} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Metadata) - com.google.showcase.v1beta1.MetadataOrBuilder { + // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Location) + com.google.showcase.v1beta1.LocationOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_fieldAccessorTable + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Metadata.class, com.google.showcase.v1beta1.Metadata.Builder.class); + com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); } - // Construct using com.google.showcase.v1beta1.Metadata.newBuilder() + // Construct using com.google.showcase.v1beta1.Location.newBuilder() private Builder() { } @@ -278,17 +278,17 @@ public Builder clear() { @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Metadata_descriptor; + return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; } @java.lang.Override - public com.google.showcase.v1beta1.Metadata getDefaultInstanceForType() { - return com.google.showcase.v1beta1.Metadata.getDefaultInstance(); + public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { + return com.google.showcase.v1beta1.Location.getDefaultInstance(); } @java.lang.Override - public com.google.showcase.v1beta1.Metadata build() { - com.google.showcase.v1beta1.Metadata result = buildPartial(); + public com.google.showcase.v1beta1.Location build() { + com.google.showcase.v1beta1.Location result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -296,14 +296,14 @@ public com.google.showcase.v1beta1.Metadata build() { } @java.lang.Override - public com.google.showcase.v1beta1.Metadata buildPartial() { - com.google.showcase.v1beta1.Metadata result = new com.google.showcase.v1beta1.Metadata(this); + public com.google.showcase.v1beta1.Location buildPartial() { + com.google.showcase.v1beta1.Location result = new com.google.showcase.v1beta1.Location(this); if (bitField0_ != 0) { buildPartial0(result); } onBuilt(); return result; } - private void buildPartial0(com.google.showcase.v1beta1.Metadata result) { + private void buildPartial0(com.google.showcase.v1beta1.Location result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000001) != 0)) { result.name_ = name_; @@ -344,16 +344,16 @@ public Builder addRepeatedField( } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.Metadata) { - return mergeFrom((com.google.showcase.v1beta1.Metadata)other); + if (other instanceof com.google.showcase.v1beta1.Location) { + return mergeFrom((com.google.showcase.v1beta1.Location)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(com.google.showcase.v1beta1.Metadata other) { - if (other == com.google.showcase.v1beta1.Metadata.getDefaultInstance()) return this; + public Builder mergeFrom(com.google.showcase.v1beta1.Location other) { + if (other == com.google.showcase.v1beta1.Location.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; bitField0_ |= 0x00000001; @@ -491,23 +491,23 @@ public final Builder mergeUnknownFields( } - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Metadata) + // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Location) } - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Metadata) - private static final com.google.showcase.v1beta1.Metadata DEFAULT_INSTANCE; + // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Location) + private static final com.google.showcase.v1beta1.Location DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Metadata(); + DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Location(); } - public static com.google.showcase.v1beta1.Metadata getDefaultInstance() { + public static com.google.showcase.v1beta1.Location getDefaultInstance() { return DEFAULT_INSTANCE; } - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { @java.lang.Override - public Metadata parsePartialFrom( + public Location parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -526,17 +526,17 @@ public Metadata parsePartialFrom( } }; - public static com.google.protobuf.Parser parser() { + public static com.google.protobuf.Parser parser() { return PARSER; } @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } @java.lang.Override - public com.google.showcase.v1beta1.Metadata getDefaultInstanceForType() { + public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { return DEFAULT_INSTANCE; } diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/MetadataOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java similarity index 89% rename from showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/MetadataOrBuilder.java rename to showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java index 6465a7bc9c..37f73be8aa 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/MetadataOrBuilder.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java @@ -3,8 +3,8 @@ package com.google.showcase.v1beta1; -public interface MetadataOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Metadata) +public interface LocationOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Location) com.google.protobuf.MessageOrBuilder { /** diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java index c39bb9d868..70ebe31042 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java @@ -109,30 +109,30 @@ public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; } - public static final int METADATA_FIELD_NUMBER = 3; - private com.google.showcase.v1beta1.Metadata metadata_; + public static final int LOCATION_FIELD_NUMBER = 3; + private com.google.showcase.v1beta1.Location location_; /** - * .google.showcase.v1beta1.Metadata metadata = 3; - * @return Whether the metadata field is set. + * .google.showcase.v1beta1.Location location = 3; + * @return Whether the location field is set. */ @java.lang.Override - public boolean hasMetadata() { - return metadata_ != null; + public boolean hasLocation() { + return location_ != null; } /** - * .google.showcase.v1beta1.Metadata metadata = 3; - * @return The metadata. + * .google.showcase.v1beta1.Location location = 3; + * @return The location. */ @java.lang.Override - public com.google.showcase.v1beta1.Metadata getMetadata() { - return metadata_ == null ? com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; + public com.google.showcase.v1beta1.Location getLocation() { + return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ @java.lang.Override - public com.google.showcase.v1beta1.MetadataOrBuilder getMetadataOrBuilder() { - return metadata_ == null ? com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; + public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { + return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; } private byte memoizedIsInitialized = -1; @@ -155,8 +155,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (annotation_ != null) { output.writeMessage(2, getAnnotation()); } - if (metadata_ != null) { - output.writeMessage(3, getMetadata()); + if (location_ != null) { + output.writeMessage(3, getLocation()); } getUnknownFields().writeTo(output); } @@ -174,9 +174,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, getAnnotation()); } - if (metadata_ != null) { + if (location_ != null) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, getMetadata()); + .computeMessageSize(3, getLocation()); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -200,10 +200,10 @@ public boolean equals(final java.lang.Object obj) { if (!getAnnotation() .equals(other.getAnnotation())) return false; } - if (hasMetadata() != other.hasMetadata()) return false; - if (hasMetadata()) { - if (!getMetadata() - .equals(other.getMetadata())) return false; + if (hasLocation() != other.hasLocation()) return false; + if (hasLocation()) { + if (!getLocation() + .equals(other.getLocation())) return false; } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; @@ -222,9 +222,9 @@ public int hashCode() { hash = (37 * hash) + ANNOTATION_FIELD_NUMBER; hash = (53 * hash) + getAnnotation().hashCode(); } - if (hasMetadata()) { - hash = (37 * hash) + METADATA_FIELD_NUMBER; - hash = (53 * hash) + getMetadata().hashCode(); + if (hasLocation()) { + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; @@ -361,10 +361,10 @@ public Builder clear() { annotationBuilder_.dispose(); annotationBuilder_ = null; } - metadata_ = null; - if (metadataBuilder_ != null) { - metadataBuilder_.dispose(); - metadataBuilder_ = null; + location_ = null; + if (locationBuilder_ != null) { + locationBuilder_.dispose(); + locationBuilder_ = null; } return this; } @@ -408,9 +408,9 @@ private void buildPartial0(com.google.showcase.v1beta1.Request result) { : annotationBuilder_.build(); } if (((from_bitField0_ & 0x00000004) != 0)) { - result.metadata_ = metadataBuilder_ == null - ? metadata_ - : metadataBuilder_.build(); + result.location_ = locationBuilder_ == null + ? location_ + : locationBuilder_.build(); } } @@ -466,8 +466,8 @@ public Builder mergeFrom(com.google.showcase.v1beta1.Request other) { if (other.hasAnnotation()) { mergeAnnotation(other.getAnnotation()); } - if (other.hasMetadata()) { - mergeMetadata(other.getMetadata()); + if (other.hasLocation()) { + mergeLocation(other.getLocation()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); @@ -509,7 +509,7 @@ public Builder mergeFrom( } // case 18 case 26: { input.readMessage( - getMetadataFieldBuilder().getBuilder(), + getLocationFieldBuilder().getBuilder(), extensionRegistry); bitField0_ |= 0x00000004; break; @@ -722,123 +722,123 @@ public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() return annotationBuilder_; } - private com.google.showcase.v1beta1.Metadata metadata_; + private com.google.showcase.v1beta1.Location location_; private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Metadata, com.google.showcase.v1beta1.Metadata.Builder, com.google.showcase.v1beta1.MetadataOrBuilder> metadataBuilder_; + com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> locationBuilder_; /** - * .google.showcase.v1beta1.Metadata metadata = 3; - * @return Whether the metadata field is set. + * .google.showcase.v1beta1.Location location = 3; + * @return Whether the location field is set. */ - public boolean hasMetadata() { + public boolean hasLocation() { return ((bitField0_ & 0x00000004) != 0); } /** - * .google.showcase.v1beta1.Metadata metadata = 3; - * @return The metadata. + * .google.showcase.v1beta1.Location location = 3; + * @return The location. */ - public com.google.showcase.v1beta1.Metadata getMetadata() { - if (metadataBuilder_ == null) { - return metadata_ == null ? com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; + public com.google.showcase.v1beta1.Location getLocation() { + if (locationBuilder_ == null) { + return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; } else { - return metadataBuilder_.getMessage(); + return locationBuilder_.getMessage(); } } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - public Builder setMetadata(com.google.showcase.v1beta1.Metadata value) { - if (metadataBuilder_ == null) { + public Builder setLocation(com.google.showcase.v1beta1.Location value) { + if (locationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - metadata_ = value; + location_ = value; } else { - metadataBuilder_.setMessage(value); + locationBuilder_.setMessage(value); } bitField0_ |= 0x00000004; onChanged(); return this; } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - public Builder setMetadata( - com.google.showcase.v1beta1.Metadata.Builder builderForValue) { - if (metadataBuilder_ == null) { - metadata_ = builderForValue.build(); + public Builder setLocation( + com.google.showcase.v1beta1.Location.Builder builderForValue) { + if (locationBuilder_ == null) { + location_ = builderForValue.build(); } else { - metadataBuilder_.setMessage(builderForValue.build()); + locationBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; onChanged(); return this; } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - public Builder mergeMetadata(com.google.showcase.v1beta1.Metadata value) { - if (metadataBuilder_ == null) { + public Builder mergeLocation(com.google.showcase.v1beta1.Location value) { + if (locationBuilder_ == null) { if (((bitField0_ & 0x00000004) != 0) && - metadata_ != null && - metadata_ != com.google.showcase.v1beta1.Metadata.getDefaultInstance()) { - getMetadataBuilder().mergeFrom(value); + location_ != null && + location_ != com.google.showcase.v1beta1.Location.getDefaultInstance()) { + getLocationBuilder().mergeFrom(value); } else { - metadata_ = value; + location_ = value; } } else { - metadataBuilder_.mergeFrom(value); + locationBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; onChanged(); return this; } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - public Builder clearMetadata() { + public Builder clearLocation() { bitField0_ = (bitField0_ & ~0x00000004); - metadata_ = null; - if (metadataBuilder_ != null) { - metadataBuilder_.dispose(); - metadataBuilder_ = null; + location_ = null; + if (locationBuilder_ != null) { + locationBuilder_.dispose(); + locationBuilder_ = null; } onChanged(); return this; } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - public com.google.showcase.v1beta1.Metadata.Builder getMetadataBuilder() { + public com.google.showcase.v1beta1.Location.Builder getLocationBuilder() { bitField0_ |= 0x00000004; onChanged(); - return getMetadataFieldBuilder().getBuilder(); + return getLocationFieldBuilder().getBuilder(); } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - public com.google.showcase.v1beta1.MetadataOrBuilder getMetadataOrBuilder() { - if (metadataBuilder_ != null) { - return metadataBuilder_.getMessageOrBuilder(); + public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { + if (locationBuilder_ != null) { + return locationBuilder_.getMessageOrBuilder(); } else { - return metadata_ == null ? - com.google.showcase.v1beta1.Metadata.getDefaultInstance() : metadata_; + return location_ == null ? + com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; } } /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Metadata, com.google.showcase.v1beta1.Metadata.Builder, com.google.showcase.v1beta1.MetadataOrBuilder> - getMetadataFieldBuilder() { - if (metadataBuilder_ == null) { - metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Metadata, com.google.showcase.v1beta1.Metadata.Builder, com.google.showcase.v1beta1.MetadataOrBuilder>( - getMetadata(), + com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> + getLocationFieldBuilder() { + if (locationBuilder_ == null) { + locationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder>( + getLocation(), getParentForChildren(), isClean()); - metadata_ = null; + location_ = null; } - return metadataBuilder_; + return locationBuilder_; } @java.lang.Override public final Builder setUnknownFields( diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java index fde53e1f8e..a8febedd64 100644 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java +++ b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java @@ -35,17 +35,17 @@ public interface RequestOrBuilder extends com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder(); /** - * .google.showcase.v1beta1.Metadata metadata = 3; - * @return Whether the metadata field is set. + * .google.showcase.v1beta1.Location location = 3; + * @return Whether the location field is set. */ - boolean hasMetadata(); + boolean hasLocation(); /** - * .google.showcase.v1beta1.Metadata metadata = 3; - * @return The metadata. + * .google.showcase.v1beta1.Location location = 3; + * @return The location. */ - com.google.showcase.v1beta1.Metadata getMetadata(); + com.google.showcase.v1beta1.Location getLocation(); /** - * .google.showcase.v1beta1.Metadata metadata = 3; + * .google.showcase.v1beta1.Location location = 3; */ - com.google.showcase.v1beta1.MetadataOrBuilder getMetadataOrBuilder(); + com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder(); } From b73d72aad94f0250841c1c8fcb0c2d3144237eea Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Thu, 1 Jun 2023 10:05:40 -0400 Subject: [PATCH 10/18] test: add service description to new test proto --- showcase/gapic-showcase-extended/proto/collisions.proto | 2 ++ .../java/com/google/showcase/v1beta1/CollisionsClient.java | 7 +++++-- .../java/com/google/showcase/v1beta1/package-info.java | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/showcase/gapic-showcase-extended/proto/collisions.proto b/showcase/gapic-showcase-extended/proto/collisions.proto index 009fcd77f9..aaf2f92f9b 100644 --- a/showcase/gapic-showcase-extended/proto/collisions.proto +++ b/showcase/gapic-showcase-extended/proto/collisions.proto @@ -22,6 +22,8 @@ package google.showcase.v1beta1; option java_package = "com.google.showcase.v1beta1"; option java_multiple_files = true; +// This service exercises scenarios where short names of types +// exhibit ambiguity or collide with other types service Collisions { option (google.api.default_host) = "localhost:7469"; diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java index 6a82edbe55..03e7d91f3f 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java @@ -43,8 +43,11 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * This class provides the ability to make remote calls to the backing service through method calls - * that map to API methods. Sample code to get started: + * Service Description: This service exercises scenarios where short names of types exhibit + * ambiguity or collide with other types + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: * *

{@code
  * // This snippet has been automatically generated and should be regarded as a code template only.
diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java
index f0cd9d4d09..9f49d78924 100644
--- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java
+++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java
@@ -158,6 +158,9 @@
  *
  * 

======================= CollisionsClient ======================= * + *

Service Description: This service exercises scenarios where short names of types exhibit + * ambiguity or collide with other types + * *

Sample for CollisionsClient: * *

{@code

From de5e9c39c0d757200bddba4878c533f3104a8df3 Mon Sep 17 00:00:00 2001
From: Emily Wang 
Date: Tue, 13 Jun 2023 09:50:12 -0400
Subject: [PATCH 11/18] chore: refactor type name matching into private helper

---
 .../generator/gapic/protoparser/Parser.java   | 38 +++++++++----------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java
index c1c819214e..43f5f830fc 100644
--- a/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java
+++ b/gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java
@@ -780,6 +780,21 @@ static List parseMethods(
     return methods;
   }
 
+  private static String fetchTypeFullName(String typeName, MethodDescriptor methodDescriptor) {
+    // When provided type name is fully qualified, return as-is
+    // When only shortname is provided, assume same proto package as method (See
+    // https://aip.dev/151)
+    int lastDotIndex = typeName.lastIndexOf('.');
+    boolean isResponseTypeNameShortOnly = lastDotIndex < 0;
+    String responseTypeShortName =
+        lastDotIndex >= 0 ? typeName.substring(lastDotIndex + 1) : typeName;
+    String typeFullName =
+        isResponseTypeNameShortOnly
+            ? methodDescriptor.getFile().getPackage() + "." + responseTypeShortName
+            : typeName;
+    return typeFullName;
+  }
+
   @VisibleForTesting
   static LongrunningOperation parseLro(
       String servicePackage, MethodDescriptor methodDescriptor, Map messageTypes) {
@@ -820,27 +835,8 @@ static LongrunningOperation parseLro(
     Message responseMessage = null;
     Message metadataMessage = null;
 
-    int lastDotIndex = responseTypeName.lastIndexOf('.');
-    boolean isResponseTypeNameShortOnly = lastDotIndex < 0;
-    String responseTypeShortName =
-        lastDotIndex >= 0 ? responseTypeName.substring(lastDotIndex + 1) : responseTypeName;
-    // When only shortname is provided, match on same proto package as method (See
-    // https://aip.dev/151)
-    String responseTypeFullName =
-        isResponseTypeNameShortOnly
-            ? methodDescriptor.getFile().getPackage() + "." + responseTypeShortName
-            : responseTypeName;
-
-    lastDotIndex = metadataTypeName.lastIndexOf('.');
-    boolean isMetadataTypeNameShortOnly = lastDotIndex < 0;
-    String metadataTypeShortName =
-        lastDotIndex >= 0 ? metadataTypeName.substring(lastDotIndex + 1) : metadataTypeName;
-    // When only shortname is provided, match on same proto package as method (See
-    // https://aip.dev/151)
-    String metadataTypeFullName =
-        isMetadataTypeNameShortOnly
-            ? methodDescriptor.getFile().getPackage() + "." + metadataTypeShortName
-            : metadataTypeName;
+    String responseTypeFullName = fetchTypeFullName(responseTypeName, methodDescriptor);
+    String metadataTypeFullName = fetchTypeFullName(metadataTypeName, methodDescriptor);
 
     // The messageTypes map keys to the Java fully-qualified name.
     for (Map.Entry messageEntry : messageTypes.entrySet()) {

From b7952a4cde4485258052e0ae0fc172778188ec18 Mon Sep 17 00:00:00 2001
From: Emily Wang 
Date: Tue, 13 Jun 2023 09:58:35 -0400
Subject: [PATCH 12/18] test: turn off showcase-extended setup

---
 showcase/BUILD.bazel                          | 25 +++++++++----------
 .../gapic-showcase-extended/proto/BUILD.bazel | 22 ++++++++--------
 showcase/scripts/update.sh                    |  4 +--
 showcase/scripts/verify.sh                    |  4 +--
 4 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/showcase/BUILD.bazel b/showcase/BUILD.bazel
index e83cd1fe90..5fb79c83a2 100644
--- a/showcase/BUILD.bazel
+++ b/showcase/BUILD.bazel
@@ -17,7 +17,7 @@ proto_library_with_info(
     name = "showcase_proto_with_info",
     deps = [
         "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_proto",
-        "//showcase/gapic-showcase-extended/proto:showcase_proto_extended",
+        # "//showcase/gapic-showcase-extended/proto:showcase_proto_extended",
         "@com_google_googleapis//google/cloud:common_resources_proto",
         "@com_google_googleapis//google/cloud/location:location_proto"
     ],
@@ -27,7 +27,7 @@ java_proto_library(
     name = "showcase_java_proto",
     deps = [
         "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_proto",
-        "//showcase/gapic-showcase-extended/proto:showcase_proto_extended"
+        # "//showcase/gapic-showcase-extended/proto:showcase_proto_extended"
 ],
 )
 
@@ -37,13 +37,13 @@ java_grpc_library(
     deps = [":showcase_java_proto"],
 )
 
-java_grpc_library(
-    name = "showcase_java_grpc_extended",
-    srcs = [
-        "//showcase/gapic-showcase-extended/proto:showcase_proto_extended",
-    ],
-    deps = [":showcase_java_proto"],
-)
+# java_grpc_library(
+#     name = "showcase_java_grpc_extended",
+#     srcs = [
+#         "//showcase/gapic-showcase-extended/proto:showcase_proto_extended",
+#     ],
+#     deps = [":showcase_java_proto"],
+# )
 
 java_gapic_library(
     name = "showcase_java_gapic",
@@ -56,7 +56,7 @@ java_gapic_library(
     service_yaml = "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_v1beta1.yaml",
     test_deps = [
         ":showcase_java_grpc",
-        ":showcase_java_grpc_extended",
+        # ":showcase_java_grpc_extended",
         "@com_google_googleapis//google/cloud/location:location_java_grpc"
     ],
     transport = "grpc+rest",
@@ -121,10 +121,10 @@ sh_binary(
 # GRPC Showcase : Update and Verify
 GRPC_DATA = [
     "libshowcase_java_grpc-src.jar",
-    "libshowcase_java_grpc_extended-src.jar",
+    # "libshowcase_java_grpc_extended-src.jar",
     ":grpc_gapic_showcase_files",
     ":showcase_java_grpc",
-    ":showcase_java_grpc_extended"
+    # ":showcase_java_grpc_extended"
 ]
 
 sh_binary(
@@ -146,7 +146,6 @@ PROTO_DATA = [
     "proto-google-cloud-showcase-v1beta1-java.tar.gz",
     ":proto_gapic_showcase_files",
     ":showcase_java_proto",
-    # ":showcase_java_proto_extended",
 ]
 
 sh_binary(
diff --git a/showcase/gapic-showcase-extended/proto/BUILD.bazel b/showcase/gapic-showcase-extended/proto/BUILD.bazel
index 91de49e161..ec22f33770 100644
--- a/showcase/gapic-showcase-extended/proto/BUILD.bazel
+++ b/showcase/gapic-showcase-extended/proto/BUILD.bazel
@@ -28,14 +28,14 @@ package(default_visibility = ["//visibility:public"])
 # gapic-showcase project is used to test the generated client behavior with a showcase server
 # gapic-showcase-extension project is used to test the generator's behavior
 
-proto_library(
-    name = "showcase_proto_extended",
-    srcs = [
-        ":collisions.proto",
-        ":wicked.proto",
-    ],
-    deps = [
-        "@com_google_googleapis//google/api:client_proto",
-        "@com_google_googleapis//google/longrunning:operations_proto",
-    ],
-)
+# proto_library(
+#     name = "showcase_proto_extended",
+#     srcs = [
+#         ":collisions.proto",
+#         ":wicked.proto",
+#     ],
+#     deps = [
+#         "@com_google_googleapis//google/api:client_proto",
+#         "@com_google_googleapis//google/longrunning:operations_proto",
+#     ],
+# )
diff --git a/showcase/scripts/update.sh b/showcase/scripts/update.sh
index ad94efb740..a0e6547ed5 100755
--- a/showcase/scripts/update.sh
+++ b/showcase/scripts/update.sh
@@ -40,13 +40,13 @@ case $1 in
   grpc)
     GRPC_PROJECT_DIR=grpc-gapic-showcase-v1beta1
     GRPC_JAR=$(find . -name 'libshowcase_java_grpc-src.jar')
-    GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar')
+    # GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar')
     clear_existing $GRPC_PROJECT_DIR
     create_unpack_dir grpc_unpacked
     GRPC_UNPACK_DIR=$PWD
 
     jar xf "$BAZEL_ROOT/$GRPC_JAR"
-    jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED"
+    # jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED"
     cd "$BUILD_WORKSPACE_DIRECTORY/showcase/$GRPC_PROJECT_DIR"
     mkdir -p ./src/main/java/com
     cp -r "$GRPC_UNPACK_DIR"/com/* ./src/main/java/com
diff --git a/showcase/scripts/verify.sh b/showcase/scripts/verify.sh
index 6c4865b84c..b7827cb72d 100755
--- a/showcase/scripts/verify.sh
+++ b/showcase/scripts/verify.sh
@@ -39,12 +39,12 @@ case $1 in
   grpc)
     GRPC_PROJECT_DIR=grpc-gapic-showcase-v1beta1
     GRPC_JAR=$(find . -name 'libshowcase_java_grpc-src.jar')
-    GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar')
+    # GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar')
     create_unpack_dir grpc_unpacked
     GRPC_UNPACK_DIR=$PWD
 
     jar xf "$BAZEL_ROOT/$GRPC_JAR"
-    jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED"
+    # jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED"
     delete_unneeded
     diff -ru "$SHOWCASE_DIR/$GRPC_PROJECT_DIR"/src/main/java/com "$GRPC_UNPACK_DIR"/com
     ;;

From 69e3a27f810572e282ae8196c8622307d4855b7b Mon Sep 17 00:00:00 2001
From: Emily Wang 
Date: Tue, 13 Jun 2023 10:00:46 -0400
Subject: [PATCH 13/18] test: remove golden files previously generated by
 showcase-extended setup

---
 .../SyncCreateSetCredentialsProvider.java     |  44 -
 .../SyncCreateSetCredentialsProvider1.java    |  39 -
 .../create/SyncCreateSetEndpoint.java         |  41 -
 .../dosomething/AsyncDoSomething.java         |  52 -
 .../dosomething/AsyncDoSomethingLRO.java      |  52 -
 .../dosomething/SyncDoSomething.java          |  48 -
 .../getlocation/AsyncGetLocation.java         |  45 -
 .../getlocation/SyncGetLocation.java          |  42 -
 .../listlocations/AsyncListLocations.java     |  54 --
 .../AsyncListLocationsPaged.java              |  61 --
 .../listlocations/SyncListLocations.java      |  50 -
 .../getlocation/SyncGetLocation.java          |  48 -
 .../getlocation/SyncGetLocation.java          |  48 -
 .../craftevilplan/SyncCraftEvilPlan.java      |  48 -
 .../AsyncBrainstormEvilPlans.java             |  49 -
 .../craftevilplan/AsyncCraftEvilPlan.java     |  46 -
 .../craftevilplan/SyncCraftEvilPlan.java      |  43 -
 .../SyncCreateSetCredentialsProvider.java     |  44 -
 .../SyncCreateSetCredentialsProvider1.java    |  39 -
 .../wicked/create/SyncCreateSetEndpoint.java  |  40 -
 .../wicked/getlocation/AsyncGetLocation.java  |  45 -
 .../wicked/getlocation/SyncGetLocation.java   |  42 -
 .../listlocations/AsyncListLocations.java     |  53 -
 .../AsyncListLocationsPaged.java              |  61 --
 .../listlocations/SyncListLocations.java      |  50 -
 .../AsyncPersuadeEvilPlan.java                |  63 --
 .../craftevilplan/SyncCraftEvilPlan.java      |  48 -
 .../showcase/v1beta1/CollisionsClient.java    | 552 -----------
 .../showcase/v1beta1/CollisionsSettings.java  | 249 -----
 .../google/showcase/v1beta1/WickedClient.java | 554 -----------
 .../showcase/v1beta1/WickedSettings.java      | 256 -----
 .../showcase/v1beta1/gapic_metadata.json      |  42 -
 .../google/showcase/v1beta1/package-info.java |  41 -
 .../showcase/v1beta1/stub/CollisionsStub.java |  77 --
 .../v1beta1/stub/CollisionsStubSettings.java  | 487 ----------
 .../stub/GrpcCollisionsCallableFactory.java   | 115 ---
 .../v1beta1/stub/GrpcCollisionsStub.java      | 245 -----
 .../stub/GrpcWickedCallableFactory.java       | 115 ---
 .../showcase/v1beta1/stub/GrpcWickedStub.java | 274 ------
 .../HttpJsonCollisionsCallableFactory.java    | 105 --
 .../v1beta1/stub/HttpJsonCollisionsStub.java  | 299 ------
 .../stub/HttpJsonWickedCallableFactory.java   | 105 --
 .../v1beta1/stub/HttpJsonWickedStub.java      | 274 ------
 .../showcase/v1beta1/stub/WickedStub.java     |  71 --
 .../v1beta1/stub/WickedStubSettings.java      | 458 ---------
 .../v1beta1/CollisionsClientHttpJsonTest.java | 204 ----
 .../v1beta1/CollisionsClientTest.java         | 248 -----
 .../showcase/v1beta1/MockCollisions.java      |  59 --
 .../showcase/v1beta1/MockCollisionsImpl.java  |  81 --
 .../google/showcase/v1beta1/MockWicked.java   |  59 --
 .../showcase/v1beta1/MockWickedImpl.java      | 154 ---
 .../v1beta1/WickedClientHttpJsonTest.java     | 216 -----
 .../showcase/v1beta1/WickedClientTest.java    | 326 -------
 .../showcase/v1beta1/CollisionsGrpc.java      | 293 ------
 .../google/showcase/v1beta1/WickedGrpc.java   | 409 --------
 .../google/showcase/v1beta1/Annotation.java   | 544 -----------
 .../showcase/v1beta1/AnnotationOrBuilder.java |  21 -
 .../v1beta1/CollisionsOuterClass.java         |  90 --
 .../google/showcase/v1beta1/EvilRequest.java  | 544 -----------
 .../v1beta1/EvilRequestOrBuilder.java         |  21 -
 .../google/showcase/v1beta1/EvilResponse.java | 544 -----------
 .../v1beta1/EvilResponseOrBuilder.java        |  21 -
 .../com/google/showcase/v1beta1/Location.java | 544 -----------
 .../showcase/v1beta1/LocationOrBuilder.java   |  21 -
 .../com/google/showcase/v1beta1/Request.java  | 906 ------------------
 .../showcase/v1beta1/RequestOrBuilder.java    |  51 -
 .../showcase/v1beta1/WickedOuterClass.java    |  79 --
 67 files changed, 11049 deletions(-)
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java
 delete mode 100644 showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java
 delete mode 100644 showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java
 delete mode 100644 showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java
 delete mode 100644 showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java
 delete mode 100644 showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java
 delete mode 100644 showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java

diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java
deleted file mode 100644
index 2bc2cd0be7..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider_sync]
-import com.google.api.gax.core.FixedCredentialsProvider;
-import com.google.showcase.v1beta1.CollisionsClient;
-import com.google.showcase.v1beta1.CollisionsSettings;
-import com.google.showcase.v1beta1.myCredentials;
-
-public class SyncCreateSetCredentialsProvider {
-
-  public static void main(String[] args) throws Exception {
-    syncCreateSetCredentialsProvider();
-  }
-
-  public static void syncCreateSetCredentialsProvider() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    CollisionsSettings collisionsSettings =
-        CollisionsSettings.newBuilder()
-            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
-            .build();
-    CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java
deleted file mode 100644
index d09b8ca88d..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetCredentialsProvider1.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider1_sync]
-import com.google.showcase.v1beta1.CollisionsClient;
-import com.google.showcase.v1beta1.CollisionsSettings;
-
-public class SyncCreateSetCredentialsProvider1 {
-
-  public static void main(String[] args) throws Exception {
-    syncCreateSetCredentialsProvider1();
-  }
-
-  public static void syncCreateSetCredentialsProvider1() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    CollisionsSettings collisionsSettings = CollisionsSettings.newHttpJsonBuilder().build();
-    CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_Create_SetCredentialsProvider1_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java
deleted file mode 100644
index 15627c4ae9..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/create/SyncCreateSetEndpoint.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_Create_SetEndpoint_sync]
-import com.google.showcase.v1beta1.CollisionsClient;
-import com.google.showcase.v1beta1.CollisionsSettings;
-import com.google.showcase.v1beta1.myEndpoint;
-
-public class SyncCreateSetEndpoint {
-
-  public static void main(String[] args) throws Exception {
-    syncCreateSetEndpoint();
-  }
-
-  public static void syncCreateSetEndpoint() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    CollisionsSettings collisionsSettings =
-        CollisionsSettings.newBuilder().setEndpoint(myEndpoint).build();
-    CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_Create_SetEndpoint_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java
deleted file mode 100644
index ccfb6d757b..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomething.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_DoSomething_async]
-import com.google.api.core.ApiFuture;
-import com.google.longrunning.Operation;
-import com.google.showcase.v1beta1.Annotation;
-import com.google.showcase.v1beta1.CollisionsClient;
-import com.google.showcase.v1beta1.Location;
-import com.google.showcase.v1beta1.Request;
-
-public class AsyncDoSomething {
-
-  public static void main(String[] args) throws Exception {
-    asyncDoSomething();
-  }
-
-  public static void asyncDoSomething() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      Request request =
-          Request.newBuilder()
-              .setName("name3373707")
-              .setAnnotation(Annotation.newBuilder().build())
-              .setLocation(Location.newBuilder().build())
-              .build();
-      ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request);
-      // Do something.
-      Operation response = future.get();
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_DoSomething_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java
deleted file mode 100644
index 6f87f4612b..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/AsyncDoSomethingLRO.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async]
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.showcase.v1beta1.Annotation;
-import com.google.showcase.v1beta1.CollisionsClient;
-import com.google.showcase.v1beta1.Location;
-import com.google.showcase.v1beta1.Request;
-
-public class AsyncDoSomethingLRO {
-
-  public static void main(String[] args) throws Exception {
-    asyncDoSomethingLRO();
-  }
-
-  public static void asyncDoSomethingLRO() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      Request request =
-          Request.newBuilder()
-              .setName("name3373707")
-              .setAnnotation(Annotation.newBuilder().build())
-              .setLocation(Location.newBuilder().build())
-              .build();
-      OperationFuture future =
-          collisionsClient.doSomethingOperationCallable().futureCall(request);
-      // Do something.
-      Annotation response = future.get();
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_DoSomething_LRO_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java
deleted file mode 100644
index 8512379c1b..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/dosomething/SyncDoSomething.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_DoSomething_sync]
-import com.google.showcase.v1beta1.Annotation;
-import com.google.showcase.v1beta1.CollisionsClient;
-import com.google.showcase.v1beta1.Location;
-import com.google.showcase.v1beta1.Request;
-
-public class SyncDoSomething {
-
-  public static void main(String[] args) throws Exception {
-    syncDoSomething();
-  }
-
-  public static void syncDoSomething() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      Request request =
-          Request.newBuilder()
-              .setName("name3373707")
-              .setAnnotation(Annotation.newBuilder().build())
-              .setLocation(Location.newBuilder().build())
-              .build();
-      Annotation response = collisionsClient.doSomethingAsync(request).get();
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_DoSomething_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java
deleted file mode 100644
index 903fcc6b26..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/AsyncGetLocation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_GetLocation_async]
-import com.google.api.core.ApiFuture;
-import com.google.cloud.location.GetLocationRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.CollisionsClient;
-
-public class AsyncGetLocation {
-
-  public static void main(String[] args) throws Exception {
-    asyncGetLocation();
-  }
-
-  public static void asyncGetLocation() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-      ApiFuture future = collisionsClient.getLocationCallable().futureCall(request);
-      // Do something.
-      Location response = future.get();
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_GetLocation_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java
deleted file mode 100644
index 468f9a120f..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/getlocation/SyncGetLocation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_GetLocation_sync]
-import com.google.cloud.location.GetLocationRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.CollisionsClient;
-
-public class SyncGetLocation {
-
-  public static void main(String[] args) throws Exception {
-    syncGetLocation();
-  }
-
-  public static void syncGetLocation() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-      Location response = collisionsClient.getLocation(request);
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_GetLocation_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java
deleted file mode 100644
index e3231849c0..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocations.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_ListLocations_async]
-import com.google.api.core.ApiFuture;
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.CollisionsClient;
-
-public class AsyncListLocations {
-
-  public static void main(String[] args) throws Exception {
-    asyncListLocations();
-  }
-
-  public static void asyncListLocations() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      ListLocationsRequest request =
-          ListLocationsRequest.newBuilder()
-              .setName("name3373707")
-              .setFilter("filter-1274492040")
-              .setPageSize(883849137)
-              .setPageToken("pageToken873572522")
-              .build();
-      ApiFuture future =
-          collisionsClient.listLocationsPagedCallable().futureCall(request);
-      // Do something.
-      for (Location element : future.get().iterateAll()) {
-        // doThingsWith(element);
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_ListLocations_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java
deleted file mode 100644
index 1eca857f08..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/AsyncListLocationsPaged.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_ListLocations_Paged_async]
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.ListLocationsResponse;
-import com.google.cloud.location.Location;
-import com.google.common.base.Strings;
-import com.google.showcase.v1beta1.CollisionsClient;
-
-public class AsyncListLocationsPaged {
-
-  public static void main(String[] args) throws Exception {
-    asyncListLocationsPaged();
-  }
-
-  public static void asyncListLocationsPaged() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      ListLocationsRequest request =
-          ListLocationsRequest.newBuilder()
-              .setName("name3373707")
-              .setFilter("filter-1274492040")
-              .setPageSize(883849137)
-              .setPageToken("pageToken873572522")
-              .build();
-      while (true) {
-        ListLocationsResponse response = collisionsClient.listLocationsCallable().call(request);
-        for (Location element : response.getLocationsList()) {
-          // doThingsWith(element);
-        }
-        String nextPageToken = response.getNextPageToken();
-        if (!Strings.isNullOrEmpty(nextPageToken)) {
-          request = request.toBuilder().setPageToken(nextPageToken).build();
-        } else {
-          break;
-        }
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_ListLocations_Paged_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java
deleted file mode 100644
index 539b2c6f3b..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisions/listlocations/SyncListLocations.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Collisions_ListLocations_sync]
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.CollisionsClient;
-
-public class SyncListLocations {
-
-  public static void main(String[] args) throws Exception {
-    syncListLocations();
-  }
-
-  public static void syncListLocations() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-      ListLocationsRequest request =
-          ListLocationsRequest.newBuilder()
-              .setName("name3373707")
-              .setFilter("filter-1274492040")
-              .setPageSize(883849137)
-              .setPageToken("pageToken873572522")
-              .build();
-      for (Location element : collisionsClient.listLocations(request).iterateAll()) {
-        // doThingsWith(element);
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Collisions_ListLocations_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java
deleted file mode 100644
index 355ed7f1c5..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/collisionssettings/getlocation/SyncGetLocation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_CollisionsSettings_GetLocation_sync]
-import com.google.showcase.v1beta1.CollisionsSettings;
-import java.time.Duration;
-
-public class SyncGetLocation {
-
-  public static void main(String[] args) throws Exception {
-    syncGetLocation();
-  }
-
-  public static void syncGetLocation() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    CollisionsSettings.Builder collisionsSettingsBuilder = CollisionsSettings.newBuilder();
-    collisionsSettingsBuilder
-        .getLocationSettings()
-        .setRetrySettings(
-            collisionsSettingsBuilder
-                .getLocationSettings()
-                .getRetrySettings()
-                .toBuilder()
-                .setTotalTimeout(Duration.ofSeconds(30))
-                .build());
-    CollisionsSettings collisionsSettings = collisionsSettingsBuilder.build();
-  }
-}
-// [END localhost7469_v1beta1_generated_CollisionsSettings_GetLocation_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java
deleted file mode 100644
index 781c3f4653..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/collisionsstubsettings/getlocation/SyncGetLocation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.stub.samples;
-
-// [START localhost7469_v1beta1_generated_CollisionsStubSettings_GetLocation_sync]
-import com.google.showcase.v1beta1.stub.CollisionsStubSettings;
-import java.time.Duration;
-
-public class SyncGetLocation {
-
-  public static void main(String[] args) throws Exception {
-    syncGetLocation();
-  }
-
-  public static void syncGetLocation() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    CollisionsStubSettings.Builder collisionsSettingsBuilder = CollisionsStubSettings.newBuilder();
-    collisionsSettingsBuilder
-        .getLocationSettings()
-        .setRetrySettings(
-            collisionsSettingsBuilder
-                .getLocationSettings()
-                .getRetrySettings()
-                .toBuilder()
-                .setTotalTimeout(Duration.ofSeconds(30))
-                .build());
-    CollisionsStubSettings collisionsSettings = collisionsSettingsBuilder.build();
-  }
-}
-// [END localhost7469_v1beta1_generated_CollisionsStubSettings_GetLocation_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java
deleted file mode 100644
index d37ea2865c..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/stub/wickedstubsettings/craftevilplan/SyncCraftEvilPlan.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.stub.samples;
-
-// [START localhost7469_v1beta1_generated_WickedStubSettings_CraftEvilPlan_sync]
-import com.google.showcase.v1beta1.stub.WickedStubSettings;
-import java.time.Duration;
-
-public class SyncCraftEvilPlan {
-
-  public static void main(String[] args) throws Exception {
-    syncCraftEvilPlan();
-  }
-
-  public static void syncCraftEvilPlan() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    WickedStubSettings.Builder wickedSettingsBuilder = WickedStubSettings.newBuilder();
-    wickedSettingsBuilder
-        .craftEvilPlanSettings()
-        .setRetrySettings(
-            wickedSettingsBuilder
-                .craftEvilPlanSettings()
-                .getRetrySettings()
-                .toBuilder()
-                .setTotalTimeout(Duration.ofSeconds(30))
-                .build());
-    WickedStubSettings wickedSettings = wickedSettingsBuilder.build();
-  }
-}
-// [END localhost7469_v1beta1_generated_WickedStubSettings_CraftEvilPlan_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java
deleted file mode 100644
index a7a9a72437..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/brainstormevilplans/AsyncBrainstormEvilPlans.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_BrainstormEvilPlans_async]
-import com.google.api.gax.rpc.BidiStream;
-import com.google.showcase.v1beta1.EvilRequest;
-import com.google.showcase.v1beta1.EvilResponse;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class AsyncBrainstormEvilPlans {
-
-  public static void main(String[] args) throws Exception {
-    asyncBrainstormEvilPlans();
-  }
-
-  public static void asyncBrainstormEvilPlans() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      BidiStream bidiStream =
-          wickedClient.brainstormEvilPlansCallable().call();
-      EvilRequest request =
-          EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-      bidiStream.send(request);
-      for (EvilResponse response : bidiStream) {
-        // Do something when a response is received.
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_BrainstormEvilPlans_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java
deleted file mode 100644
index b7133bcc21..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/AsyncCraftEvilPlan.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_async]
-import com.google.api.core.ApiFuture;
-import com.google.showcase.v1beta1.EvilRequest;
-import com.google.showcase.v1beta1.EvilResponse;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class AsyncCraftEvilPlan {
-
-  public static void main(String[] args) throws Exception {
-    asyncCraftEvilPlan();
-  }
-
-  public static void asyncCraftEvilPlan() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      EvilRequest request =
-          EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-      ApiFuture future = wickedClient.craftEvilPlanCallable().futureCall(request);
-      // Do something.
-      EvilResponse response = future.get();
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java
deleted file mode 100644
index 67d75d0f2a..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/craftevilplan/SyncCraftEvilPlan.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_sync]
-import com.google.showcase.v1beta1.EvilRequest;
-import com.google.showcase.v1beta1.EvilResponse;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class SyncCraftEvilPlan {
-
-  public static void main(String[] args) throws Exception {
-    syncCraftEvilPlan();
-  }
-
-  public static void syncCraftEvilPlan() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      EvilRequest request =
-          EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-      EvilResponse response = wickedClient.craftEvilPlan(request);
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_CraftEvilPlan_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java
deleted file mode 100644
index 9af0aaa741..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider_sync]
-import com.google.api.gax.core.FixedCredentialsProvider;
-import com.google.showcase.v1beta1.WickedClient;
-import com.google.showcase.v1beta1.WickedSettings;
-import com.google.showcase.v1beta1.myCredentials;
-
-public class SyncCreateSetCredentialsProvider {
-
-  public static void main(String[] args) throws Exception {
-    syncCreateSetCredentialsProvider();
-  }
-
-  public static void syncCreateSetCredentialsProvider() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    WickedSettings wickedSettings =
-        WickedSettings.newBuilder()
-            .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
-            .build();
-    WickedClient wickedClient = WickedClient.create(wickedSettings);
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java
deleted file mode 100644
index 38fb1b127b..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetCredentialsProvider1.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider1_sync]
-import com.google.showcase.v1beta1.WickedClient;
-import com.google.showcase.v1beta1.WickedSettings;
-
-public class SyncCreateSetCredentialsProvider1 {
-
-  public static void main(String[] args) throws Exception {
-    syncCreateSetCredentialsProvider1();
-  }
-
-  public static void syncCreateSetCredentialsProvider1() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    WickedSettings wickedSettings = WickedSettings.newHttpJsonBuilder().build();
-    WickedClient wickedClient = WickedClient.create(wickedSettings);
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_Create_SetCredentialsProvider1_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java
deleted file mode 100644
index 87b154260c..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/create/SyncCreateSetEndpoint.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_Create_SetEndpoint_sync]
-import com.google.showcase.v1beta1.WickedClient;
-import com.google.showcase.v1beta1.WickedSettings;
-import com.google.showcase.v1beta1.myEndpoint;
-
-public class SyncCreateSetEndpoint {
-
-  public static void main(String[] args) throws Exception {
-    syncCreateSetEndpoint();
-  }
-
-  public static void syncCreateSetEndpoint() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    WickedSettings wickedSettings = WickedSettings.newBuilder().setEndpoint(myEndpoint).build();
-    WickedClient wickedClient = WickedClient.create(wickedSettings);
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_Create_SetEndpoint_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java
deleted file mode 100644
index 0bd173c76a..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/AsyncGetLocation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_GetLocation_async]
-import com.google.api.core.ApiFuture;
-import com.google.cloud.location.GetLocationRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class AsyncGetLocation {
-
-  public static void main(String[] args) throws Exception {
-    asyncGetLocation();
-  }
-
-  public static void asyncGetLocation() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-      ApiFuture future = wickedClient.getLocationCallable().futureCall(request);
-      // Do something.
-      Location response = future.get();
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_GetLocation_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java
deleted file mode 100644
index e5e8f160e5..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/getlocation/SyncGetLocation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_GetLocation_sync]
-import com.google.cloud.location.GetLocationRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class SyncGetLocation {
-
-  public static void main(String[] args) throws Exception {
-    syncGetLocation();
-  }
-
-  public static void syncGetLocation() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-      Location response = wickedClient.getLocation(request);
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_GetLocation_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java
deleted file mode 100644
index d37e1b1fda..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocations.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_ListLocations_async]
-import com.google.api.core.ApiFuture;
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class AsyncListLocations {
-
-  public static void main(String[] args) throws Exception {
-    asyncListLocations();
-  }
-
-  public static void asyncListLocations() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      ListLocationsRequest request =
-          ListLocationsRequest.newBuilder()
-              .setName("name3373707")
-              .setFilter("filter-1274492040")
-              .setPageSize(883849137)
-              .setPageToken("pageToken873572522")
-              .build();
-      ApiFuture future = wickedClient.listLocationsPagedCallable().futureCall(request);
-      // Do something.
-      for (Location element : future.get().iterateAll()) {
-        // doThingsWith(element);
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_ListLocations_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java
deleted file mode 100644
index f1b1ef00c1..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/AsyncListLocationsPaged.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_ListLocations_Paged_async]
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.ListLocationsResponse;
-import com.google.cloud.location.Location;
-import com.google.common.base.Strings;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class AsyncListLocationsPaged {
-
-  public static void main(String[] args) throws Exception {
-    asyncListLocationsPaged();
-  }
-
-  public static void asyncListLocationsPaged() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      ListLocationsRequest request =
-          ListLocationsRequest.newBuilder()
-              .setName("name3373707")
-              .setFilter("filter-1274492040")
-              .setPageSize(883849137)
-              .setPageToken("pageToken873572522")
-              .build();
-      while (true) {
-        ListLocationsResponse response = wickedClient.listLocationsCallable().call(request);
-        for (Location element : response.getLocationsList()) {
-          // doThingsWith(element);
-        }
-        String nextPageToken = response.getNextPageToken();
-        if (!Strings.isNullOrEmpty(nextPageToken)) {
-          request = request.toBuilder().setPageToken(nextPageToken).build();
-        } else {
-          break;
-        }
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_ListLocations_Paged_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java
deleted file mode 100644
index 61a487a7af..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/listlocations/SyncListLocations.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_ListLocations_sync]
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.Location;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class SyncListLocations {
-
-  public static void main(String[] args) throws Exception {
-    syncListLocations();
-  }
-
-  public static void syncListLocations() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      ListLocationsRequest request =
-          ListLocationsRequest.newBuilder()
-              .setName("name3373707")
-              .setFilter("filter-1274492040")
-              .setPageSize(883849137)
-              .setPageToken("pageToken873572522")
-              .build();
-      for (Location element : wickedClient.listLocations(request).iterateAll()) {
-        // doThingsWith(element);
-      }
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_ListLocations_sync]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java
deleted file mode 100644
index 1aa00ccb50..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wicked/persuadeevilplan/AsyncPersuadeEvilPlan.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_Wicked_PersuadeEvilPlan_async]
-import com.google.api.gax.rpc.ApiStreamObserver;
-import com.google.showcase.v1beta1.EvilRequest;
-import com.google.showcase.v1beta1.EvilResponse;
-import com.google.showcase.v1beta1.WickedClient;
-
-public class AsyncPersuadeEvilPlan {
-
-  public static void main(String[] args) throws Exception {
-    asyncPersuadeEvilPlan();
-  }
-
-  public static void asyncPersuadeEvilPlan() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    try (WickedClient wickedClient = WickedClient.create()) {
-      ApiStreamObserver responseObserver =
-          new ApiStreamObserver() {
-            @Override
-            public void onNext(EvilResponse response) {
-              // Do something when a response is received.
-            }
-
-            @Override
-            public void onError(Throwable t) {
-              // Add error-handling
-            }
-
-            @Override
-            public void onCompleted() {
-              // Do something when complete.
-            }
-          };
-      ApiStreamObserver requestObserver =
-          wickedClient.persuadeEvilPlan().clientStreamingCall(responseObserver);
-      EvilRequest request =
-          EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-      requestObserver.onNext(request);
-    }
-  }
-}
-// [END localhost7469_v1beta1_generated_Wicked_PersuadeEvilPlan_async]
diff --git a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java b/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java
deleted file mode 100644
index af8709d91a..0000000000
--- a/showcase/gapic-showcase/samples/snippets/generated/src/main/java/com/google/showcase/v1beta1/wickedsettings/craftevilplan/SyncCraftEvilPlan.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1.samples;
-
-// [START localhost7469_v1beta1_generated_WickedSettings_CraftEvilPlan_sync]
-import com.google.showcase.v1beta1.WickedSettings;
-import java.time.Duration;
-
-public class SyncCraftEvilPlan {
-
-  public static void main(String[] args) throws Exception {
-    syncCraftEvilPlan();
-  }
-
-  public static void syncCraftEvilPlan() throws Exception {
-    // This snippet has been automatically generated and should be regarded as a code template only.
-    // It will require modifications to work:
-    // - It may require correct/in-range values for request initialization.
-    // - It may require specifying regional endpoints when creating the service client as shown in
-    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-    WickedSettings.Builder wickedSettingsBuilder = WickedSettings.newBuilder();
-    wickedSettingsBuilder
-        .craftEvilPlanSettings()
-        .setRetrySettings(
-            wickedSettingsBuilder
-                .craftEvilPlanSettings()
-                .getRetrySettings()
-                .toBuilder()
-                .setTotalTimeout(Duration.ofSeconds(30))
-                .build());
-    WickedSettings wickedSettings = wickedSettingsBuilder.build();
-  }
-}
-// [END localhost7469_v1beta1_generated_WickedSettings_CraftEvilPlan_sync]
diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java
deleted file mode 100644
index 03e7d91f3f..0000000000
--- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsClient.java
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.showcase.v1beta1;
-
-import com.google.api.core.ApiFuture;
-import com.google.api.core.ApiFutures;
-import com.google.api.core.BetaApi;
-import com.google.api.gax.core.BackgroundResource;
-import com.google.api.gax.httpjson.longrunning.OperationsClient;
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.api.gax.paging.AbstractFixedSizeCollection;
-import com.google.api.gax.paging.AbstractPage;
-import com.google.api.gax.paging.AbstractPagedListResponse;
-import com.google.api.gax.rpc.OperationCallable;
-import com.google.api.gax.rpc.PageContext;
-import com.google.api.gax.rpc.UnaryCallable;
-import com.google.cloud.location.GetLocationRequest;
-import com.google.cloud.location.ListLocationsRequest;
-import com.google.cloud.location.ListLocationsResponse;
-import com.google.cloud.location.Location;
-import com.google.common.util.concurrent.MoreExecutors;
-import com.google.longrunning.Operation;
-import com.google.showcase.v1beta1.stub.CollisionsStub;
-import com.google.showcase.v1beta1.stub.CollisionsStubSettings;
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Generated;
-
-// AUTO-GENERATED DOCUMENTATION AND CLASS.
-/**
- * Service Description: This service exercises scenarios where short names of types exhibit
- * ambiguity or collide with other types
- *
- * 

This class provides the ability to make remote calls to the backing service through method - * calls that map to API methods. Sample code to get started: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
- *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
- *   Location response = collisionsClient.getLocation(request);
- * }
- * }
- * - *

Note: close() needs to be called on the CollisionsClient object to clean up resources such as - * threads. In the example above, try-with-resources is used, which automatically calls close(). - * - *

The surface of this class includes several types of Java methods for each of the API's - * methods: - * - *

    - *
  1. A "flattened" method. With this type of method, the fields of the request type have been - * converted into function parameters. It may be the case that not all fields are available as - * parameters, and not every API method will have a flattened method entry point. - *
  2. A "request object" method. This type of method only takes one parameter, a request object, - * which must be constructed before the call. Not every API method will have a request object - * method. - *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API - * callable object, which can be used to initiate calls to the service. - *
- * - *

See the individual methods for example code. - * - *

Many parameters require resource names to be formatted in a particular way. To assist with - * these names, this class includes a format method for each type of name, and additionally a parse - * method to extract the individual identifiers contained within names that are returned. - * - *

This class can be customized by passing in a custom instance of CollisionsSettings to - * create(). For example: - * - *

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * CollisionsSettings collisionsSettings =
- *     CollisionsSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * CollisionsSettings collisionsSettings =
- *     CollisionsSettings.newBuilder().setEndpoint(myEndpoint).build();
- * CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
- * }
- * - *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over - * the wire: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * CollisionsSettings collisionsSettings = CollisionsSettings.newHttpJsonBuilder().build();
- * CollisionsClient collisionsClient = CollisionsClient.create(collisionsSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class CollisionsClient implements BackgroundResource { - private final CollisionsSettings settings; - private final CollisionsStub stub; - private final OperationsClient httpJsonOperationsClient; - private final com.google.longrunning.OperationsClient operationsClient; - - /** Constructs an instance of CollisionsClient with default settings. */ - public static final CollisionsClient create() throws IOException { - return create(CollisionsSettings.newBuilder().build()); - } - - /** - * Constructs an instance of CollisionsClient, using the given settings. The channels are created - * based on the settings passed in, or defaults for any settings that are not set. - */ - public static final CollisionsClient create(CollisionsSettings settings) throws IOException { - return new CollisionsClient(settings); - } - - /** - * Constructs an instance of CollisionsClient, using the given stub for making calls. This is for - * advanced usage - prefer using create(CollisionsSettings). - */ - public static final CollisionsClient create(CollisionsStub stub) { - return new CollisionsClient(stub); - } - - /** - * Constructs an instance of CollisionsClient, using the given settings. This is protected so that - * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. - */ - protected CollisionsClient(CollisionsSettings settings) throws IOException { - this.settings = settings; - this.stub = ((CollisionsStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = - com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); - this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); - } - - protected CollisionsClient(CollisionsStub stub) { - this.settings = null; - this.stub = stub; - this.operationsClient = - com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); - this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); - } - - public final CollisionsSettings getSettings() { - return settings; - } - - public CollisionsStub getStub() { - return stub; - } - - /** - * Returns the OperationsClient that can be used to query the status of a long-running operation - * returned by another API method call. - */ - public final com.google.longrunning.OperationsClient getOperationsClient() { - return operationsClient; - } - - /** - * Returns the OperationsClient that can be used to query the status of a long-running operation - * returned by another API method call. - */ - @BetaApi - public final OperationsClient getHttpJsonOperationsClient() { - return httpJsonOperationsClient; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   Request request =
-   *       Request.newBuilder()
-   *           .setName("name3373707")
-   *           .setAnnotation(Annotation.newBuilder().build())
-   *           .setLocation(Location.newBuilder().build())
-   *           .build();
-   *   Annotation response = collisionsClient.doSomethingAsync(request).get();
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture doSomethingAsync( - Request request) { - return doSomethingOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *
{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   Request request =
-   *       Request.newBuilder()
-   *           .setName("name3373707")
-   *           .setAnnotation(Annotation.newBuilder().build())
-   *           .setLocation(Location.newBuilder().build())
-   *           .build();
-   *   OperationFuture future =
-   *       collisionsClient.doSomethingOperationCallable().futureCall(request);
-   *   // Do something.
-   *   Annotation response = future.get();
-   * }
-   * }
- */ - public final OperationCallable - doSomethingOperationCallable() { - return stub.doSomethingOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *
{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   Request request =
-   *       Request.newBuilder()
-   *           .setName("name3373707")
-   *           .setAnnotation(Annotation.newBuilder().build())
-   *           .setLocation(Location.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = collisionsClient.doSomethingCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable doSomethingCallable() { - return stub.doSomethingCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Location element : collisionsClient.listLocations(request).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { - return listLocationsPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       collisionsClient.listLocationsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Location element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable - listLocationsPagedCallable() { - return stub.listLocationsPagedCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListLocationsResponse response = collisionsClient.listLocationsCallable().call(request);
-   *     for (Location element : response.getLocationsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable listLocationsCallable() { - return stub.listLocationsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets information about a location. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   Location response = collisionsClient.getLocation(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Location getLocation(GetLocationRequest request) { - return getLocationCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets information about a location. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   ApiFuture future = collisionsClient.getLocationCallable().futureCall(request);
-   *   // Do something.
-   *   Location response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable getLocationCallable() { - return stub.getLocationCallable(); - } - - @Override - public final void close() { - stub.close(); - } - - @Override - public void shutdown() { - stub.shutdown(); - } - - @Override - public boolean isShutdown() { - return stub.isShutdown(); - } - - @Override - public boolean isTerminated() { - return stub.isTerminated(); - } - - @Override - public void shutdownNow() { - stub.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return stub.awaitTermination(duration, unit); - } - - public static class ListLocationsPagedResponse - extends AbstractPagedListResponse< - ListLocationsRequest, - ListLocationsResponse, - Location, - ListLocationsPage, - ListLocationsFixedSizeCollection> { - - public static ApiFuture createAsync( - PageContext context, - ApiFuture futureResponse) { - ApiFuture futurePage = - ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); - return ApiFutures.transform( - futurePage, - input -> new ListLocationsPagedResponse(input), - MoreExecutors.directExecutor()); - } - - private ListLocationsPagedResponse(ListLocationsPage page) { - super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); - } - } - - public static class ListLocationsPage - extends AbstractPage< - ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { - - private ListLocationsPage( - PageContext context, - ListLocationsResponse response) { - super(context, response); - } - - private static ListLocationsPage createEmptyPage() { - return new ListLocationsPage(null, null); - } - - @Override - protected ListLocationsPage createPage( - PageContext context, - ListLocationsResponse response) { - return new ListLocationsPage(context, response); - } - - @Override - public ApiFuture createPageAsync( - PageContext context, - ApiFuture futureResponse) { - return super.createPageAsync(context, futureResponse); - } - } - - public static class ListLocationsFixedSizeCollection - extends AbstractFixedSizeCollection< - ListLocationsRequest, - ListLocationsResponse, - Location, - ListLocationsPage, - ListLocationsFixedSizeCollection> { - - private ListLocationsFixedSizeCollection(List pages, int collectionSize) { - super(pages, collectionSize); - } - - private static ListLocationsFixedSizeCollection createEmptyCollection() { - return new ListLocationsFixedSizeCollection(null, 0); - } - - @Override - protected ListLocationsFixedSizeCollection createCollection( - List pages, int collectionSize) { - return new ListLocationsFixedSizeCollection(pages, collectionSize); - } - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java deleted file mode 100644 index 87f40b9349..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/CollisionsSettings.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientSettings; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.longrunning.Operation; -import com.google.showcase.v1beta1.stub.CollisionsStubSettings; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link CollisionsClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (localhost) and default port (7469) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the total timeout of getLocation to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * CollisionsSettings.Builder collisionsSettingsBuilder = CollisionsSettings.newBuilder();
- * collisionsSettingsBuilder
- *     .getLocationSettings()
- *     .setRetrySettings(
- *         collisionsSettingsBuilder
- *             .getLocationSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * CollisionsSettings collisionsSettings = collisionsSettingsBuilder.build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class CollisionsSettings extends ClientSettings { - - /** Returns the object with the settings used for calls to doSomething. */ - public UnaryCallSettings doSomethingSettings() { - return ((CollisionsStubSettings) getStubSettings()).doSomethingSettings(); - } - - /** Returns the object with the settings used for calls to doSomething. */ - public OperationCallSettings - doSomethingOperationSettings() { - return ((CollisionsStubSettings) getStubSettings()).doSomethingOperationSettings(); - } - - /** Returns the object with the settings used for calls to listLocations. */ - public PagedCallSettings - listLocationsSettings() { - return ((CollisionsStubSettings) getStubSettings()).listLocationsSettings(); - } - - /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings getLocationSettings() { - return ((CollisionsStubSettings) getStubSettings()).getLocationSettings(); - } - - public static final CollisionsSettings create(CollisionsStubSettings stub) throws IOException { - return new CollisionsSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return CollisionsStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return CollisionsStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return CollisionsStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return CollisionsStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return CollisionsStubSettings.defaultGrpcTransportProviderBuilder(); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return CollisionsStubSettings.defaultHttpJsonTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return CollisionsStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return CollisionsStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - @BetaApi - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected CollisionsSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for CollisionsSettings. */ - public static class Builder extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(CollisionsStubSettings.newBuilder(clientContext)); - } - - protected Builder(CollisionsSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(CollisionsStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(CollisionsStubSettings.newBuilder()); - } - - @BetaApi - private static Builder createHttpJsonDefault() { - return new Builder(CollisionsStubSettings.newHttpJsonBuilder()); - } - - public CollisionsStubSettings.Builder getStubSettingsBuilder() { - return ((CollisionsStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to doSomething. */ - public UnaryCallSettings.Builder doSomethingSettings() { - return getStubSettingsBuilder().doSomethingSettings(); - } - - /** Returns the builder for the settings used for calls to doSomething. */ - public OperationCallSettings.Builder - doSomethingOperationSettings() { - return getStubSettingsBuilder().doSomethingOperationSettings(); - } - - /** Returns the builder for the settings used for calls to listLocations. */ - public PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings() { - return getStubSettingsBuilder().listLocationsSettings(); - } - - /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder getLocationSettings() { - return getStubSettingsBuilder().getLocationSettings(); - } - - @Override - public CollisionsSettings build() throws IOException { - return new CollisionsSettings(this); - } - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java deleted file mode 100644 index 014d399e74..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedClient.java +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.paging.AbstractFixedSizeCollection; -import com.google.api.gax.paging.AbstractPage; -import com.google.api.gax.paging.AbstractPagedListResponse; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.showcase.v1beta1.stub.WickedStub; -import com.google.showcase.v1beta1.stub.WickedStubSettings; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: This service is used to show a Service with either non-enabled or - * non-eligible RPCs for HttpJson (Http 1.1). Non-Enabled: Missing the (google.api.http) annotation - * to enabled it Non-Eligible: BIDI and Client side streaming are not supported with Http 1.1 - * Service name is reference to `No REST for the Wicked` - * - *

This class provides the ability to make remote calls to the backing service through method - * calls that map to API methods. Sample code to get started: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (WickedClient wickedClient = WickedClient.create()) {
- *   EvilRequest request =
- *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
- *   EvilResponse response = wickedClient.craftEvilPlan(request);
- * }
- * }
- * - *

Note: close() needs to be called on the WickedClient object to clean up resources such as - * threads. In the example above, try-with-resources is used, which automatically calls close(). - * - *

The surface of this class includes several types of Java methods for each of the API's - * methods: - * - *

    - *
  1. A "flattened" method. With this type of method, the fields of the request type have been - * converted into function parameters. It may be the case that not all fields are available as - * parameters, and not every API method will have a flattened method entry point. - *
  2. A "request object" method. This type of method only takes one parameter, a request object, - * which must be constructed before the call. Not every API method will have a request object - * method. - *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API - * callable object, which can be used to initiate calls to the service. - *
- * - *

See the individual methods for example code. - * - *

Many parameters require resource names to be formatted in a particular way. To assist with - * these names, this class includes a format method for each type of name, and additionally a parse - * method to extract the individual identifiers contained within names that are returned. - * - *

This class can be customized by passing in a custom instance of WickedSettings to create(). - * For example: - * - *

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * WickedSettings wickedSettings =
- *     WickedSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * WickedClient wickedClient = WickedClient.create(wickedSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * WickedSettings wickedSettings = WickedSettings.newBuilder().setEndpoint(myEndpoint).build();
- * WickedClient wickedClient = WickedClient.create(wickedSettings);
- * }
- * - *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over - * the wire: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * WickedSettings wickedSettings = WickedSettings.newHttpJsonBuilder().build();
- * WickedClient wickedClient = WickedClient.create(wickedSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class WickedClient implements BackgroundResource { - private final WickedSettings settings; - private final WickedStub stub; - - /** Constructs an instance of WickedClient with default settings. */ - public static final WickedClient create() throws IOException { - return create(WickedSettings.newBuilder().build()); - } - - /** - * Constructs an instance of WickedClient, using the given settings. The channels are created - * based on the settings passed in, or defaults for any settings that are not set. - */ - public static final WickedClient create(WickedSettings settings) throws IOException { - return new WickedClient(settings); - } - - /** - * Constructs an instance of WickedClient, using the given stub for making calls. This is for - * advanced usage - prefer using create(WickedSettings). - */ - public static final WickedClient create(WickedStub stub) { - return new WickedClient(stub); - } - - /** - * Constructs an instance of WickedClient, using the given settings. This is protected so that it - * is easy to make a subclass, but otherwise, the static factory methods should be preferred. - */ - protected WickedClient(WickedSettings settings) throws IOException { - this.settings = settings; - this.stub = ((WickedStubSettings) settings.getStubSettings()).createStub(); - } - - protected WickedClient(WickedStub stub) { - this.settings = null; - this.stub = stub; - } - - public final WickedSettings getSettings() { - return settings; - } - - public WickedStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   EvilRequest request =
-   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-   *   EvilResponse response = wickedClient.craftEvilPlan(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final EvilResponse craftEvilPlan(EvilRequest request) { - return craftEvilPlanCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *
{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   EvilRequest request =
-   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-   *   ApiFuture future = wickedClient.craftEvilPlanCallable().futureCall(request);
-   *   // Do something.
-   *   EvilResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable craftEvilPlanCallable() { - return stub.craftEvilPlanCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *
{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   BidiStream bidiStream =
-   *       wickedClient.brainstormEvilPlansCallable().call();
-   *   EvilRequest request =
-   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-   *   bidiStream.send(request);
-   *   for (EvilResponse response : bidiStream) {
-   *     // Do something when a response is received.
-   *   }
-   * }
-   * }
- */ - public final BidiStreamingCallable brainstormEvilPlansCallable() { - return stub.brainstormEvilPlansCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sample code: - * - *
{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   ApiStreamObserver responseObserver =
-   *       new ApiStreamObserver() {
-   *         {@literal @}Override
-   *         public void onNext(EvilResponse response) {
-   *           // Do something when a response is received.
-   *         }
-   *
-   *         {@literal @}Override
-   *         public void onError(Throwable t) {
-   *           // Add error-handling
-   *         }
-   *
-   *         {@literal @}Override
-   *         public void onCompleted() {
-   *           // Do something when complete.
-   *         }
-   *       };
-   *   ApiStreamObserver requestObserver =
-   *       wickedClient.persuadeEvilPlan().clientStreamingCall(responseObserver);
-   *   EvilRequest request =
-   *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
-   *   requestObserver.onNext(request);
-   * }
-   * }
- */ - public final ClientStreamingCallable persuadeEvilPlanCallable() { - return stub.persuadeEvilPlanCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Location element : wickedClient.listLocations(request).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { - return listLocationsPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = wickedClient.listLocationsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Location element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable - listLocationsPagedCallable() { - return stub.listLocationsPagedCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListLocationsResponse response = wickedClient.listLocationsCallable().call(request);
-   *     for (Location element : response.getLocationsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable listLocationsCallable() { - return stub.listLocationsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets information about a location. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   Location response = wickedClient.getLocation(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Location getLocation(GetLocationRequest request) { - return getLocationCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets information about a location. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (WickedClient wickedClient = WickedClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   ApiFuture future = wickedClient.getLocationCallable().futureCall(request);
-   *   // Do something.
-   *   Location response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable getLocationCallable() { - return stub.getLocationCallable(); - } - - @Override - public final void close() { - stub.close(); - } - - @Override - public void shutdown() { - stub.shutdown(); - } - - @Override - public boolean isShutdown() { - return stub.isShutdown(); - } - - @Override - public boolean isTerminated() { - return stub.isTerminated(); - } - - @Override - public void shutdownNow() { - stub.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return stub.awaitTermination(duration, unit); - } - - public static class ListLocationsPagedResponse - extends AbstractPagedListResponse< - ListLocationsRequest, - ListLocationsResponse, - Location, - ListLocationsPage, - ListLocationsFixedSizeCollection> { - - public static ApiFuture createAsync( - PageContext context, - ApiFuture futureResponse) { - ApiFuture futurePage = - ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); - return ApiFutures.transform( - futurePage, - input -> new ListLocationsPagedResponse(input), - MoreExecutors.directExecutor()); - } - - private ListLocationsPagedResponse(ListLocationsPage page) { - super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); - } - } - - public static class ListLocationsPage - extends AbstractPage< - ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { - - private ListLocationsPage( - PageContext context, - ListLocationsResponse response) { - super(context, response); - } - - private static ListLocationsPage createEmptyPage() { - return new ListLocationsPage(null, null); - } - - @Override - protected ListLocationsPage createPage( - PageContext context, - ListLocationsResponse response) { - return new ListLocationsPage(context, response); - } - - @Override - public ApiFuture createPageAsync( - PageContext context, - ApiFuture futureResponse) { - return super.createPageAsync(context, futureResponse); - } - } - - public static class ListLocationsFixedSizeCollection - extends AbstractFixedSizeCollection< - ListLocationsRequest, - ListLocationsResponse, - Location, - ListLocationsPage, - ListLocationsFixedSizeCollection> { - - private ListLocationsFixedSizeCollection(List pages, int collectionSize) { - super(pages, collectionSize); - } - - private static ListLocationsFixedSizeCollection createEmptyCollection() { - return new ListLocationsFixedSizeCollection(null, 0); - } - - @Override - protected ListLocationsFixedSizeCollection createCollection( - List pages, int collectionSize) { - return new ListLocationsFixedSizeCollection(pages, collectionSize); - } - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java deleted file mode 100644 index c3a824a6b2..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/WickedSettings.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientSettings; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.showcase.v1beta1.stub.WickedStubSettings; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link WickedClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (localhost) and default port (7469) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the total timeout of craftEvilPlan to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * WickedSettings.Builder wickedSettingsBuilder = WickedSettings.newBuilder();
- * wickedSettingsBuilder
- *     .craftEvilPlanSettings()
- *     .setRetrySettings(
- *         wickedSettingsBuilder
- *             .craftEvilPlanSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * WickedSettings wickedSettings = wickedSettingsBuilder.build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class WickedSettings extends ClientSettings { - - /** Returns the object with the settings used for calls to craftEvilPlan. */ - public UnaryCallSettings craftEvilPlanSettings() { - return ((WickedStubSettings) getStubSettings()).craftEvilPlanSettings(); - } - - /** Returns the object with the settings used for calls to brainstormEvilPlans. */ - public StreamingCallSettings brainstormEvilPlansSettings() { - return ((WickedStubSettings) getStubSettings()).brainstormEvilPlansSettings(); - } - - /** Returns the object with the settings used for calls to persuadeEvilPlan. */ - public StreamingCallSettings persuadeEvilPlanSettings() { - return ((WickedStubSettings) getStubSettings()).persuadeEvilPlanSettings(); - } - - /** Returns the object with the settings used for calls to listLocations. */ - public PagedCallSettings - listLocationsSettings() { - return ((WickedStubSettings) getStubSettings()).listLocationsSettings(); - } - - /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings getLocationSettings() { - return ((WickedStubSettings) getStubSettings()).getLocationSettings(); - } - - public static final WickedSettings create(WickedStubSettings stub) throws IOException { - return new WickedSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return WickedStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return WickedStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return WickedStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return WickedStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return WickedStubSettings.defaultGrpcTransportProviderBuilder(); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return WickedStubSettings.defaultHttpJsonTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return WickedStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return WickedStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - @BetaApi - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected WickedSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for WickedSettings. */ - public static class Builder extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(WickedStubSettings.newBuilder(clientContext)); - } - - protected Builder(WickedSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(WickedStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(WickedStubSettings.newBuilder()); - } - - @BetaApi - private static Builder createHttpJsonDefault() { - return new Builder(WickedStubSettings.newHttpJsonBuilder()); - } - - public WickedStubSettings.Builder getStubSettingsBuilder() { - return ((WickedStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to craftEvilPlan. */ - public UnaryCallSettings.Builder craftEvilPlanSettings() { - return getStubSettingsBuilder().craftEvilPlanSettings(); - } - - /** Returns the builder for the settings used for calls to brainstormEvilPlans. */ - public StreamingCallSettings.Builder brainstormEvilPlansSettings() { - return getStubSettingsBuilder().brainstormEvilPlansSettings(); - } - - /** Returns the builder for the settings used for calls to persuadeEvilPlan. */ - public StreamingCallSettings.Builder persuadeEvilPlanSettings() { - return getStubSettingsBuilder().persuadeEvilPlanSettings(); - } - - /** Returns the builder for the settings used for calls to listLocations. */ - public PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings() { - return getStubSettingsBuilder().listLocationsSettings(); - } - - /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder getLocationSettings() { - return getStubSettingsBuilder().getLocationSettings(); - } - - @Override - public WickedSettings build() throws IOException { - return new WickedSettings(this); - } - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json index ec839e018f..b79bfb905f 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json @@ -250,48 +250,6 @@ } } } - }, - "Collisions": { - "clients": { - "grpc": { - "libraryClient": "CollisionsClient", - "rpcs": { - "GetLocation": { - "methods": ["getLocation", "getLocationCallable"] - }, - "ListLocations": { - "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] - }, - "doSomething": { - "methods": ["doSomethingAsync", "doSomethingOperationCallable", "doSomethingCallable"] - } - } - } - } - }, - "Wicked": { - "clients": { - "grpc": { - "libraryClient": "WickedClient", - "rpcs": { - "BrainstormEvilPlans": { - "methods": ["brainstormEvilPlansCallable"] - }, - "CraftEvilPlan": { - "methods": ["craftEvilPlan", "craftEvilPlanCallable"] - }, - "GetLocation": { - "methods": ["getLocation", "getLocationCallable"] - }, - "ListLocations": { - "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] - }, - "PersuadeEvilPlan": { - "methods": ["persuadeEvilPlanCallable"] - } - } - } - } } } } \ No newline at end of file diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java index 9f49d78924..3e4b18d27e 100644 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java +++ b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java @@ -155,47 +155,6 @@ * Session response = testingClient.createSession(request); * } * }

- * - *

======================= CollisionsClient ======================= - * - *

Service Description: This service exercises scenarios where short names of types exhibit - * ambiguity or collide with other types - * - *

Sample for CollisionsClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (CollisionsClient collisionsClient = CollisionsClient.create()) {
- *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
- *   Location response = collisionsClient.getLocation(request);
- * }
- * }
- * - *

======================= WickedClient ======================= - * - *

Service Description: This service is used to show a Service with either non-enabled or - * non-eligible RPCs for HttpJson (Http 1.1). Non-Enabled: Missing the (google.api.http) annotation - * to enabled it Non-Eligible: BIDI and Client side streaming are not supported with Http 1.1 - * Service name is reference to `No REST for the Wicked` - * - *

Sample for WickedClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (WickedClient wickedClient = WickedClient.create()) {
- *   EvilRequest request =
- *       EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build();
- *   EvilResponse response = wickedClient.craftEvilPlan(request);
- * }
- * }
*/ @Generated("by gapic-generator-java") package com.google.showcase.v1beta1; diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java deleted file mode 100644 index 0812b07fe1..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStub.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Location; -import com.google.showcase.v1beta1.Request; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the Collisions service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public abstract class CollisionsStub implements BackgroundResource { - - public OperationsStub getOperationsStub() { - return null; - } - - public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { - return null; - } - - public OperationCallable doSomethingOperationCallable() { - throw new UnsupportedOperationException("Not implemented: doSomethingOperationCallable()"); - } - - public UnaryCallable doSomethingCallable() { - throw new UnsupportedOperationException("Not implemented: doSomethingCallable()"); - } - - public UnaryCallable - listLocationsPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); - } - - public UnaryCallable listLocationsCallable() { - throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); - } - - public UnaryCallable - getLocationCallable() { - throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java deleted file mode 100644 index 9da36484d5..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/CollisionsStubSettings.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.ApiFuture; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GaxProperties; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.GrpcTransportChannel; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.grpc.ProtoOperationTransformers; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.HttpJsonTransportChannel; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -import com.google.api.gax.longrunning.OperationSnapshot; -import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.ApiCallContext; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.PagedListDescriptor; -import com.google.api.gax.rpc.PagedListResponseFactory; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.longrunning.Operation; -import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Location; -import com.google.showcase.v1beta1.Request; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; -import org.threeten.bp.Duration; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link CollisionsStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (localhost) and default port (7469) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the total timeout of getLocation to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * CollisionsStubSettings.Builder collisionsSettingsBuilder = CollisionsStubSettings.newBuilder();
- * collisionsSettingsBuilder
- *     .getLocationSettings()
- *     .setRetrySettings(
- *         collisionsSettingsBuilder
- *             .getLocationSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * CollisionsStubSettings collisionsSettings = collisionsSettingsBuilder.build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class CollisionsStubSettings extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().build(); - - private final UnaryCallSettings doSomethingSettings; - private final OperationCallSettings doSomethingOperationSettings; - private final PagedCallSettings< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings; - private final UnaryCallSettings - getLocationSettings; - - private static final PagedListDescriptor< - ListLocationsRequest, ListLocationsResponse, com.google.cloud.location.Location> - LIST_LOCATIONS_PAGE_STR_DESC = - new PagedListDescriptor< - ListLocationsRequest, ListLocationsResponse, com.google.cloud.location.Location>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { - return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { - return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListLocationsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListLocationsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources( - ListLocationsResponse payload) { - return payload.getLocationsList() == null - ? ImmutableList.of() - : payload.getLocationsList(); - } - }; - - private static final PagedListResponseFactory< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - LIST_LOCATIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListLocationsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext< - ListLocationsRequest, - ListLocationsResponse, - com.google.cloud.location.Location> - pageContext = - PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); - return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - /** Returns the object with the settings used for calls to doSomething. */ - public UnaryCallSettings doSomethingSettings() { - return doSomethingSettings; - } - - /** Returns the object with the settings used for calls to doSomething. */ - public OperationCallSettings doSomethingOperationSettings() { - return doSomethingOperationSettings; - } - - /** Returns the object with the settings used for calls to listLocations. */ - public PagedCallSettings - listLocationsSettings() { - return listLocationsSettings; - } - - /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings - getLocationSettings() { - return getLocationSettings; - } - - public CollisionsStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcCollisionsStub.create(this); - } - if (getTransportChannelProvider() - .getTransportName() - .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { - return HttpJsonCollisionsStub.create(this); - } - throw new UnsupportedOperationException( - String.format( - "Transport not supported: %s", getTransportChannelProvider().getTransportName())); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "localhost:7469"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "localhost:7469"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return InstantiatingHttpJsonChannelProvider.newBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(CollisionsStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(CollisionsStubSettings.class)) - .setTransportToken( - GaxHttpJsonProperties.getHttpJsonTokenName(), - GaxHttpJsonProperties.getHttpJsonVersion()); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return CollisionsStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected CollisionsStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - doSomethingSettings = settingsBuilder.doSomethingSettings().build(); - doSomethingOperationSettings = settingsBuilder.doSomethingOperationSettings().build(); - listLocationsSettings = settingsBuilder.listLocationsSettings().build(); - getLocationSettings = settingsBuilder.getLocationSettings().build(); - } - - /** Builder for CollisionsStubSettings. */ - public static class Builder extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder doSomethingSettings; - private final OperationCallSettings.Builder - doSomethingOperationSettings; - private final PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings; - private final UnaryCallSettings.Builder - getLocationSettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - doSomethingSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - doSomethingOperationSettings = OperationCallSettings.newBuilder(); - listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); - getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - doSomethingSettings, listLocationsSettings, getLocationSettings); - initDefaults(this); - } - - protected Builder(CollisionsStubSettings settings) { - super(settings); - - doSomethingSettings = settings.doSomethingSettings.toBuilder(); - doSomethingOperationSettings = settings.doSomethingOperationSettings.toBuilder(); - listLocationsSettings = settings.listLocationsSettings.toBuilder(); - getLocationSettings = settings.getLocationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - doSomethingSettings, listLocationsSettings, getLocationSettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder createHttpJsonDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .doSomethingSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .listLocationsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .getLocationSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .doSomethingOperationSettings() - .setInitialCallSettings( - UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) - .build()) - .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create(Annotation.class)) - .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(Location.class)) - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(5000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ZERO) - .setTotalTimeout(Duration.ofMillis(300000L)) - .build())); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to doSomething. */ - public UnaryCallSettings.Builder doSomethingSettings() { - return doSomethingSettings; - } - - /** Returns the builder for the settings used for calls to doSomething. */ - @BetaApi( - "The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallSettings.Builder - doSomethingOperationSettings() { - return doSomethingOperationSettings; - } - - /** Returns the builder for the settings used for calls to listLocations. */ - public PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings() { - return listLocationsSettings; - } - - /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder - getLocationSettings() { - return getLocationSettings; - } - - @Override - public CollisionsStubSettings build() throws IOException { - return new CollisionsStubSettings(this); - } - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java deleted file mode 100644 index ef0ea02f4d..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsCallableFactory.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC callable factory implementation for the Collisions service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcCollisionsCallableFactory implements GrpcStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - GrpcCallSettings grpcCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - GrpcCallSettings grpcCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, callSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java deleted file mode 100644 index c528dfc90e..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcCollisionsStub.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.ImmutableMap; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.GrpcOperationsStub; -import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Request; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the Collisions service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcCollisionsStub extends CollisionsStub { - private static final MethodDescriptor doSomethingMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.showcase.v1beta1.Collisions/doSomething") - .setRequestMarshaller(ProtoUtils.marshaller(Request.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - listLocationsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.location.Locations/ListLocations") - .setRequestMarshaller( - ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor getLocationMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.location.Locations/GetLocation") - .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) - .build(); - - private final UnaryCallable doSomethingCallable; - private final OperationCallable - doSomethingOperationCallable; - private final UnaryCallable listLocationsCallable; - private final UnaryCallable - listLocationsPagedCallable; - private final UnaryCallable getLocationCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcCollisionsStub create(CollisionsStubSettings settings) - throws IOException { - return new GrpcCollisionsStub(settings, ClientContext.create(settings)); - } - - public static final GrpcCollisionsStub create(ClientContext clientContext) throws IOException { - return new GrpcCollisionsStub(CollisionsStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcCollisionsStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcCollisionsStub( - CollisionsStubSettings.newBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of GrpcCollisionsStub, using the given settings. This is protected so - * that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected GrpcCollisionsStub(CollisionsStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new GrpcCollisionsCallableFactory()); - } - - /** - * Constructs an instance of GrpcCollisionsStub, using the given settings. This is protected so - * that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected GrpcCollisionsStub( - CollisionsStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings doSomethingTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(doSomethingMethodDescriptor) - .build(); - GrpcCallSettings listLocationsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listLocationsMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings getLocationTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getLocationMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - - this.doSomethingCallable = - callableFactory.createUnaryCallable( - doSomethingTransportSettings, settings.doSomethingSettings(), clientContext); - this.doSomethingOperationCallable = - callableFactory.createOperationCallable( - doSomethingTransportSettings, - settings.doSomethingOperationSettings(), - clientContext, - operationsStub); - this.listLocationsCallable = - callableFactory.createUnaryCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.listLocationsPagedCallable = - callableFactory.createPagedCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.getLocationCallable = - callableFactory.createUnaryCallable( - getLocationTransportSettings, settings.getLocationSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable doSomethingCallable() { - return doSomethingCallable; - } - - @Override - public OperationCallable - doSomethingOperationCallable() { - return doSomethingOperationCallable; - } - - @Override - public UnaryCallable listLocationsCallable() { - return listLocationsCallable; - } - - @Override - public UnaryCallable - listLocationsPagedCallable() { - return listLocationsPagedCallable; - } - - @Override - public UnaryCallable getLocationCallable() { - return getLocationCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java deleted file mode 100644 index 388b417f03..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedCallableFactory.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC callable factory implementation for the Wicked service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcWickedCallableFactory implements GrpcStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - GrpcCallSettings grpcCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - GrpcCallSettings grpcCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, callSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java deleted file mode 100644 index c3e680dee2..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/GrpcWickedStub.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.ImmutableMap; -import com.google.longrunning.stub.GrpcOperationsStub; -import com.google.showcase.v1beta1.EvilRequest; -import com.google.showcase.v1beta1.EvilResponse; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the Wicked service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcWickedStub extends WickedStub { - private static final MethodDescriptor craftEvilPlanMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.showcase.v1beta1.Wicked/CraftEvilPlan") - .setRequestMarshaller(ProtoUtils.marshaller(EvilRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(EvilResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - brainstormEvilPlansMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName("google.showcase.v1beta1.Wicked/BrainstormEvilPlans") - .setRequestMarshaller(ProtoUtils.marshaller(EvilRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(EvilResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - persuadeEvilPlanMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.CLIENT_STREAMING) - .setFullMethodName("google.showcase.v1beta1.Wicked/PersuadeEvilPlan") - .setRequestMarshaller(ProtoUtils.marshaller(EvilRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(EvilResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - listLocationsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.location.Locations/ListLocations") - .setRequestMarshaller( - ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor getLocationMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.location.Locations/GetLocation") - .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) - .build(); - - private final UnaryCallable craftEvilPlanCallable; - private final BidiStreamingCallable brainstormEvilPlansCallable; - private final ClientStreamingCallable persuadeEvilPlanCallable; - private final UnaryCallable listLocationsCallable; - private final UnaryCallable - listLocationsPagedCallable; - private final UnaryCallable getLocationCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcWickedStub create(WickedStubSettings settings) throws IOException { - return new GrpcWickedStub(settings, ClientContext.create(settings)); - } - - public static final GrpcWickedStub create(ClientContext clientContext) throws IOException { - return new GrpcWickedStub(WickedStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcWickedStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcWickedStub( - WickedStubSettings.newBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of GrpcWickedStub, using the given settings. This is protected so that - * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. - */ - protected GrpcWickedStub(WickedStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new GrpcWickedCallableFactory()); - } - - /** - * Constructs an instance of GrpcWickedStub, using the given settings. This is protected so that - * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. - */ - protected GrpcWickedStub( - WickedStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings craftEvilPlanTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(craftEvilPlanMethodDescriptor) - .build(); - GrpcCallSettings brainstormEvilPlansTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(brainstormEvilPlansMethodDescriptor) - .build(); - GrpcCallSettings persuadeEvilPlanTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(persuadeEvilPlanMethodDescriptor) - .build(); - GrpcCallSettings listLocationsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listLocationsMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings getLocationTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getLocationMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - - this.craftEvilPlanCallable = - callableFactory.createUnaryCallable( - craftEvilPlanTransportSettings, settings.craftEvilPlanSettings(), clientContext); - this.brainstormEvilPlansCallable = - callableFactory.createBidiStreamingCallable( - brainstormEvilPlansTransportSettings, - settings.brainstormEvilPlansSettings(), - clientContext); - this.persuadeEvilPlanCallable = - callableFactory.createClientStreamingCallable( - persuadeEvilPlanTransportSettings, settings.persuadeEvilPlanSettings(), clientContext); - this.listLocationsCallable = - callableFactory.createUnaryCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.listLocationsPagedCallable = - callableFactory.createPagedCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.getLocationCallable = - callableFactory.createUnaryCallable( - getLocationTransportSettings, settings.getLocationSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable craftEvilPlanCallable() { - return craftEvilPlanCallable; - } - - @Override - public BidiStreamingCallable brainstormEvilPlansCallable() { - return brainstormEvilPlansCallable; - } - - @Override - public ClientStreamingCallable persuadeEvilPlanCallable() { - return persuadeEvilPlanCallable; - } - - @Override - public UnaryCallable listLocationsCallable() { - return listLocationsCallable; - } - - @Override - public UnaryCallable - listLocationsPagedCallable() { - return listLocationsPagedCallable; - } - - @Override - public UnaryCallable getLocationCallable() { - return getLocationCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java deleted file mode 100644 index 0da4f298cc..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsCallableFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonCallableFactory; -import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST callable factory implementation for the Collisions service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class HttpJsonCollisionsCallableFactory - implements HttpJsonStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - HttpJsonCallSettings httpJsonCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createUnaryCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - HttpJsonCallSettings httpJsonCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createPagedCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - HttpJsonCallSettings httpJsonCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createBatchingCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - HttpJsonCallSettings httpJsonCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - UnaryCallable innerCallable = - HttpJsonCallableFactory.createBaseUnaryCallable( - httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); - HttpJsonOperationSnapshotCallable initialCallable = - new HttpJsonOperationSnapshotCallable( - innerCallable, - httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); - return HttpJsonCallableFactory.createOperationCallable( - callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - HttpJsonCallSettings httpJsonCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createServerStreamingCallable( - httpJsonCallSettings, callSettings, clientContext); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java deleted file mode 100644 index 601ad4b35c..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonCollisionsStub.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.HttpRule; -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.httpjson.ApiMethodDescriptor; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; -import com.google.api.gax.httpjson.ProtoMessageResponseParser; -import com.google.api.gax.httpjson.ProtoRestSerializer; -import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.common.collect.ImmutableMap; -import com.google.longrunning.Operation; -import com.google.protobuf.TypeRegistry; -import com.google.showcase.v1beta1.Annotation; -import com.google.showcase.v1beta1.Location; -import com.google.showcase.v1beta1.Request; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST stub implementation for the Collisions service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class HttpJsonCollisionsStub extends CollisionsStub { - private static final TypeRegistry typeRegistry = - TypeRegistry.newBuilder() - .add(Location.getDescriptor()) - .add(Annotation.getDescriptor()) - .build(); - - private static final ApiMethodDescriptor - listLocationsMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.location.Locations/ListLocations") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta1/{name=projects/*}/locations", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - getLocationMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.location.Locations/GetLocation") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta1/{name=projects/*/locations/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(com.google.cloud.location.Location.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private final UnaryCallable listLocationsCallable; - private final UnaryCallable - listLocationsPagedCallable; - private final UnaryCallable - getLocationCallable; - - private final BackgroundResource backgroundResources; - private final HttpJsonOperationsStub httpJsonOperationsStub; - private final HttpJsonStubCallableFactory callableFactory; - - public static final HttpJsonCollisionsStub create(CollisionsStubSettings settings) - throws IOException { - return new HttpJsonCollisionsStub(settings, ClientContext.create(settings)); - } - - public static final HttpJsonCollisionsStub create(ClientContext clientContext) - throws IOException { - return new HttpJsonCollisionsStub( - CollisionsStubSettings.newHttpJsonBuilder().build(), clientContext); - } - - public static final HttpJsonCollisionsStub create( - ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { - return new HttpJsonCollisionsStub( - CollisionsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of HttpJsonCollisionsStub, using the given settings. This is protected - * so that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected HttpJsonCollisionsStub(CollisionsStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new HttpJsonCollisionsCallableFactory()); - } - - /** - * Constructs an instance of HttpJsonCollisionsStub, using the given settings. This is protected - * so that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected HttpJsonCollisionsStub( - CollisionsStubSettings settings, - ClientContext clientContext, - HttpJsonStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.httpJsonOperationsStub = - HttpJsonOperationsStub.create( - clientContext, - callableFactory, - typeRegistry, - ImmutableMap.builder() - .put( - "google.longrunning.Operations.CancelOperation", - HttpRule.newBuilder().setPost("/v1beta1/{name=operations/**}:cancel").build()) - .put( - "google.longrunning.Operations.DeleteOperation", - HttpRule.newBuilder().setDelete("/v1beta1/{name=operations/**}").build()) - .put( - "google.longrunning.Operations.GetOperation", - HttpRule.newBuilder().setGet("/v1beta1/{name=operations/**}").build()) - .put( - "google.longrunning.Operations.ListOperations", - HttpRule.newBuilder().setGet("/v1beta1/operations").build()) - .build()); - - HttpJsonCallSettings - listLocationsTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(listLocationsMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - getLocationTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(getLocationMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - - this.listLocationsCallable = - callableFactory.createUnaryCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.listLocationsPagedCallable = - callableFactory.createPagedCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.getLocationCallable = - callableFactory.createUnaryCallable( - getLocationTransportSettings, settings.getLocationSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - @InternalApi - public static List getMethodDescriptors() { - List methodDescriptors = new ArrayList<>(); - methodDescriptors.add(listLocationsMethodDescriptor); - methodDescriptors.add(getLocationMethodDescriptor); - return methodDescriptors; - } - - public HttpJsonOperationsStub getHttpJsonOperationsStub() { - return httpJsonOperationsStub; - } - - @Override - public UnaryCallable listLocationsCallable() { - return listLocationsCallable; - } - - @Override - public UnaryCallable - listLocationsPagedCallable() { - return listLocationsPagedCallable; - } - - @Override - public UnaryCallable - getLocationCallable() { - return getLocationCallable; - } - - @Override - public UnaryCallable doSomethingCallable() { - throw new UnsupportedOperationException( - "Not implemented: doSomethingCallable(). REST transport is not implemented for this method yet."); - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java deleted file mode 100644 index 37726531b0..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedCallableFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonCallableFactory; -import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST callable factory implementation for the Wicked service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class HttpJsonWickedCallableFactory - implements HttpJsonStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - HttpJsonCallSettings httpJsonCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createUnaryCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - HttpJsonCallSettings httpJsonCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createPagedCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - HttpJsonCallSettings httpJsonCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createBatchingCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - HttpJsonCallSettings httpJsonCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - UnaryCallable innerCallable = - HttpJsonCallableFactory.createBaseUnaryCallable( - httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); - HttpJsonOperationSnapshotCallable initialCallable = - new HttpJsonOperationSnapshotCallable( - innerCallable, - httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); - return HttpJsonCallableFactory.createOperationCallable( - callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - HttpJsonCallSettings httpJsonCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createServerStreamingCallable( - httpJsonCallSettings, callSettings, clientContext); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java deleted file mode 100644 index d45cbba41e..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/HttpJsonWickedStub.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.httpjson.ApiMethodDescriptor; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; -import com.google.api.gax.httpjson.ProtoMessageResponseParser; -import com.google.api.gax.httpjson.ProtoRestSerializer; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.protobuf.TypeRegistry; -import com.google.showcase.v1beta1.EvilRequest; -import com.google.showcase.v1beta1.EvilResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST stub implementation for the Wicked service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class HttpJsonWickedStub extends WickedStub { - private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); - - private static final ApiMethodDescriptor - listLocationsMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.location.Locations/ListLocations") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta1/{name=projects/*}/locations", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ListLocationsResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - getLocationMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.location.Locations/GetLocation") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta1/{name=projects/*/locations/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Location.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private final UnaryCallable listLocationsCallable; - private final UnaryCallable - listLocationsPagedCallable; - private final UnaryCallable getLocationCallable; - - private final BackgroundResource backgroundResources; - private final HttpJsonStubCallableFactory callableFactory; - - public static final HttpJsonWickedStub create(WickedStubSettings settings) throws IOException { - return new HttpJsonWickedStub(settings, ClientContext.create(settings)); - } - - public static final HttpJsonWickedStub create(ClientContext clientContext) throws IOException { - return new HttpJsonWickedStub(WickedStubSettings.newHttpJsonBuilder().build(), clientContext); - } - - public static final HttpJsonWickedStub create( - ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { - return new HttpJsonWickedStub( - WickedStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of HttpJsonWickedStub, using the given settings. This is protected so - * that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected HttpJsonWickedStub(WickedStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new HttpJsonWickedCallableFactory()); - } - - /** - * Constructs an instance of HttpJsonWickedStub, using the given settings. This is protected so - * that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected HttpJsonWickedStub( - WickedStubSettings settings, - ClientContext clientContext, - HttpJsonStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - - HttpJsonCallSettings - listLocationsTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(listLocationsMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings getLocationTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(getLocationMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - - this.listLocationsCallable = - callableFactory.createUnaryCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.listLocationsPagedCallable = - callableFactory.createPagedCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.getLocationCallable = - callableFactory.createUnaryCallable( - getLocationTransportSettings, settings.getLocationSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - @InternalApi - public static List getMethodDescriptors() { - List methodDescriptors = new ArrayList<>(); - methodDescriptors.add(listLocationsMethodDescriptor); - methodDescriptors.add(getLocationMethodDescriptor); - return methodDescriptors; - } - - @Override - public UnaryCallable listLocationsCallable() { - return listLocationsCallable; - } - - @Override - public UnaryCallable - listLocationsPagedCallable() { - return listLocationsPagedCallable; - } - - @Override - public UnaryCallable getLocationCallable() { - return getLocationCallable; - } - - @Override - public UnaryCallable craftEvilPlanCallable() { - throw new UnsupportedOperationException( - "Not implemented: craftEvilPlanCallable(). REST transport is not implemented for this method yet."); - } - - @Override - public BidiStreamingCallable brainstormEvilPlansCallable() { - throw new UnsupportedOperationException( - "Not implemented: brainstormEvilPlansCallable(). REST transport is not implemented for this method yet."); - } - - @Override - public ClientStreamingCallable persuadeEvilPlanCallable() { - throw new UnsupportedOperationException( - "Not implemented: persuadeEvilPlanCallable(). REST transport is not implemented for this method yet."); - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java deleted file mode 100644 index 0693ab1315..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStub.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.showcase.v1beta1.EvilRequest; -import com.google.showcase.v1beta1.EvilResponse; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the Wicked service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public abstract class WickedStub implements BackgroundResource { - - public UnaryCallable craftEvilPlanCallable() { - throw new UnsupportedOperationException("Not implemented: craftEvilPlanCallable()"); - } - - public BidiStreamingCallable brainstormEvilPlansCallable() { - throw new UnsupportedOperationException("Not implemented: brainstormEvilPlansCallable()"); - } - - public ClientStreamingCallable persuadeEvilPlanCallable() { - throw new UnsupportedOperationException("Not implemented: persuadeEvilPlanCallable()"); - } - - public UnaryCallable - listLocationsPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); - } - - public UnaryCallable listLocationsCallable() { - throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); - } - - public UnaryCallable getLocationCallable() { - throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java b/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java deleted file mode 100644 index dfb54a1ad3..0000000000 --- a/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/WickedStubSettings.java +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1.stub; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.ApiFuture; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GaxProperties; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.GrpcTransportChannel; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.HttpJsonTransportChannel; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.ApiCallContext; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.PagedListDescriptor; -import com.google.api.gax.rpc.PagedListResponseFactory; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.showcase.v1beta1.EvilRequest; -import com.google.showcase.v1beta1.EvilResponse; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link WickedStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (localhost) and default port (7469) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the total timeout of craftEvilPlan to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * WickedStubSettings.Builder wickedSettingsBuilder = WickedStubSettings.newBuilder();
- * wickedSettingsBuilder
- *     .craftEvilPlanSettings()
- *     .setRetrySettings(
- *         wickedSettingsBuilder
- *             .craftEvilPlanSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * WickedStubSettings wickedSettings = wickedSettingsBuilder.build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class WickedStubSettings extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().build(); - - private final UnaryCallSettings craftEvilPlanSettings; - private final StreamingCallSettings brainstormEvilPlansSettings; - private final StreamingCallSettings persuadeEvilPlanSettings; - private final PagedCallSettings< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings; - private final UnaryCallSettings getLocationSettings; - - private static final PagedListDescriptor - LIST_LOCATIONS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { - return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { - return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListLocationsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListLocationsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListLocationsResponse payload) { - return payload.getLocationsList() == null - ? ImmutableList.of() - : payload.getLocationsList(); - } - }; - - private static final PagedListResponseFactory< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - LIST_LOCATIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListLocationsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); - return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - /** Returns the object with the settings used for calls to craftEvilPlan. */ - public UnaryCallSettings craftEvilPlanSettings() { - return craftEvilPlanSettings; - } - - /** Returns the object with the settings used for calls to brainstormEvilPlans. */ - public StreamingCallSettings brainstormEvilPlansSettings() { - return brainstormEvilPlansSettings; - } - - /** Returns the object with the settings used for calls to persuadeEvilPlan. */ - public StreamingCallSettings persuadeEvilPlanSettings() { - return persuadeEvilPlanSettings; - } - - /** Returns the object with the settings used for calls to listLocations. */ - public PagedCallSettings - listLocationsSettings() { - return listLocationsSettings; - } - - /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings getLocationSettings() { - return getLocationSettings; - } - - public WickedStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcWickedStub.create(this); - } - if (getTransportChannelProvider() - .getTransportName() - .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { - return HttpJsonWickedStub.create(this); - } - throw new UnsupportedOperationException( - String.format( - "Transport not supported: %s", getTransportChannelProvider().getTransportName())); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "localhost:7469"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "localhost:7469"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return InstantiatingHttpJsonChannelProvider.newBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(WickedStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(WickedStubSettings.class)) - .setTransportToken( - GaxHttpJsonProperties.getHttpJsonTokenName(), - GaxHttpJsonProperties.getHttpJsonVersion()); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return WickedStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected WickedStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - craftEvilPlanSettings = settingsBuilder.craftEvilPlanSettings().build(); - brainstormEvilPlansSettings = settingsBuilder.brainstormEvilPlansSettings().build(); - persuadeEvilPlanSettings = settingsBuilder.persuadeEvilPlanSettings().build(); - listLocationsSettings = settingsBuilder.listLocationsSettings().build(); - getLocationSettings = settingsBuilder.getLocationSettings().build(); - } - - /** Builder for WickedStubSettings. */ - public static class Builder extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder craftEvilPlanSettings; - private final StreamingCallSettings.Builder - brainstormEvilPlansSettings; - private final StreamingCallSettings.Builder persuadeEvilPlanSettings; - private final PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings; - private final UnaryCallSettings.Builder getLocationSettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - craftEvilPlanSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - brainstormEvilPlansSettings = StreamingCallSettings.newBuilder(); - persuadeEvilPlanSettings = StreamingCallSettings.newBuilder(); - listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); - getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - craftEvilPlanSettings, listLocationsSettings, getLocationSettings); - initDefaults(this); - } - - protected Builder(WickedStubSettings settings) { - super(settings); - - craftEvilPlanSettings = settings.craftEvilPlanSettings.toBuilder(); - brainstormEvilPlansSettings = settings.brainstormEvilPlansSettings.toBuilder(); - persuadeEvilPlanSettings = settings.persuadeEvilPlanSettings.toBuilder(); - listLocationsSettings = settings.listLocationsSettings.toBuilder(); - getLocationSettings = settings.getLocationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - craftEvilPlanSettings, listLocationsSettings, getLocationSettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder createHttpJsonDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .craftEvilPlanSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .listLocationsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .getLocationSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to craftEvilPlan. */ - public UnaryCallSettings.Builder craftEvilPlanSettings() { - return craftEvilPlanSettings; - } - - /** Returns the builder for the settings used for calls to brainstormEvilPlans. */ - public StreamingCallSettings.Builder brainstormEvilPlansSettings() { - return brainstormEvilPlansSettings; - } - - /** Returns the builder for the settings used for calls to persuadeEvilPlan. */ - public StreamingCallSettings.Builder persuadeEvilPlanSettings() { - return persuadeEvilPlanSettings; - } - - /** Returns the builder for the settings used for calls to listLocations. */ - public PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings() { - return listLocationsSettings; - } - - /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder getLocationSettings() { - return getLocationSettings; - } - - @Override - public WickedStubSettings build() throws IOException { - return new WickedStubSettings(this); - } - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java deleted file mode 100644 index 0aa72be007..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientHttpJsonTest.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.testing.MockHttpService; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ApiException; -import com.google.api.gax.rpc.ApiExceptionFactory; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.testing.FakeStatusCode; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.Lists; -import com.google.protobuf.Any; -import com.google.showcase.v1beta1.stub.HttpJsonCollisionsStub; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class CollisionsClientHttpJsonTest { - private static MockHttpService mockService; - private static CollisionsClient client; - - @BeforeClass - public static void startStaticServer() throws IOException { - mockService = - new MockHttpService( - HttpJsonCollisionsStub.getMethodDescriptors(), CollisionsSettings.getDefaultEndpoint()); - CollisionsSettings settings = - CollisionsSettings.newHttpJsonBuilder() - .setTransportChannelProvider( - CollisionsSettings.defaultHttpJsonTransportProviderBuilder() - .setHttpTransport(mockService) - .build()) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = CollisionsClient.create(settings); - } - - @AfterClass - public static void stopServer() { - client.close(); - } - - @Before - public void setUp() {} - - @After - public void tearDown() throws Exception { - mockService.reset(); - } - - @Test - public void doSomethingUnsupportedMethodTest() throws Exception { - // The doSomething() method is not supported in REST transport. - // This empty test is generated for technical reasons. - } - - @Test - public void listLocationsTest() throws Exception { - Location responsesElement = Location.newBuilder().build(); - ListLocationsResponse expectedResponse = - ListLocationsResponse.newBuilder() - .setNextPageToken("") - .addAllLocations(Arrays.asList(responsesElement)) - .build(); - mockService.addResponse(expectedResponse); - - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("projects/project-3664") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - - ListLocationsPagedResponse pagedListResponse = client.listLocations(request); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listLocationsExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("projects/project-3664") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - client.listLocations(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getLocationTest() throws Exception { - Location expectedResponse = - Location.newBuilder() - .setName("name3373707") - .setLocationId("locationId1541836720") - .setDisplayName("displayName1714148973") - .putAllLabels(new HashMap()) - .setMetadata(Any.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - GetLocationRequest request = - GetLocationRequest.newBuilder() - .setName("projects/project-9062/locations/location-9062") - .build(); - - Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getLocationExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - GetLocationRequest request = - GetLocationRequest.newBuilder() - .setName("projects/project-9062/locations/location-9062") - .build(); - client.getLocation(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java deleted file mode 100644 index a1c6bf43d7..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/CollisionsClientTest.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import static com.google.showcase.v1beta1.CollisionsClient.ListLocationsPagedResponse; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.Lists; -import com.google.longrunning.Operation; -import com.google.protobuf.AbstractMessage; -import com.google.protobuf.Any; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class CollisionsClientTest { - private static MockCollisions mockCollisions; - private static MockLocations mockLocations; - private static MockServiceHelper mockServiceHelper; - private LocalChannelProvider channelProvider; - private CollisionsClient client; - - @BeforeClass - public static void startStaticServer() { - mockCollisions = new MockCollisions(); - mockLocations = new MockLocations(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList(mockCollisions, mockLocations)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - CollisionsSettings settings = - CollisionsSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = CollisionsClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void doSomethingTest() throws Exception { - Annotation expectedResponse = Annotation.newBuilder().setName("name3373707").build(); - Operation resultOperation = - Operation.newBuilder() - .setName("doSomethingTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockCollisions.addResponse(resultOperation); - - Request request = - Request.newBuilder() - .setName("name3373707") - .setAnnotation(Annotation.newBuilder().build()) - .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) - .build(); - - Annotation actualResponse = client.doSomethingAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockCollisions.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - Request actualRequest = ((Request) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getAnnotation(), actualRequest.getAnnotation()); - Assert.assertEquals(request.getLocation(), actualRequest.getLocation()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void doSomethingExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockCollisions.addException(exception); - - try { - Request request = - Request.newBuilder() - .setName("name3373707") - .setAnnotation(Annotation.newBuilder().build()) - .setLocation(com.google.showcase.v1beta1.Location.newBuilder().build()) - .build(); - client.doSomethingAsync(request).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } - - @Test - public void listLocationsTest() throws Exception { - Location responsesElement = Location.newBuilder().build(); - ListLocationsResponse expectedResponse = - ListLocationsResponse.newBuilder() - .setNextPageToken("") - .addAllLocations(Arrays.asList(responsesElement)) - .build(); - mockLocations.addResponse(expectedResponse); - - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("name3373707") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - - ListLocationsPagedResponse pagedListResponse = client.listLocations(request); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); - - List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listLocationsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLocations.addException(exception); - - try { - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("name3373707") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - client.listLocations(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getLocationTest() throws Exception { - Location expectedResponse = - Location.newBuilder() - .setName("name3373707") - .setLocationId("locationId1541836720") - .setDisplayName("displayName1714148973") - .putAllLabels(new HashMap()) - .setMetadata(Any.newBuilder().build()) - .build(); - mockLocations.addResponse(expectedResponse); - - GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); - - Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getLocationExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLocations.addException(exception); - - try { - GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); - client.getLocation(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java deleted file mode 100644 index 580b7c4d51..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisions.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockCollisions implements MockGrpcService { - private final MockCollisionsImpl serviceImpl; - - public MockCollisions() { - serviceImpl = new MockCollisionsImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(AbstractMessage response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java deleted file mode 100644 index ec284c97a7..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockCollisionsImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.longrunning.Operation; -import com.google.protobuf.AbstractMessage; -import com.google.showcase.v1beta1.CollisionsGrpc.CollisionsImplBase; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockCollisionsImpl extends CollisionsImplBase { - private List requests; - private Queue responses; - - public MockCollisionsImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(AbstractMessage response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void doSomething(Request request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Operation) { - requests.add(request); - responseObserver.onNext(((Operation) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method doSomething, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Operation.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java deleted file mode 100644 index 219dc25a91..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWicked.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockWicked implements MockGrpcService { - private final MockWickedImpl serviceImpl; - - public MockWicked() { - serviceImpl = new MockWickedImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(AbstractMessage response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java deleted file mode 100644 index 0fdad0b607..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/MockWickedImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.protobuf.AbstractMessage; -import com.google.showcase.v1beta1.WickedGrpc.WickedImplBase; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockWickedImpl extends WickedImplBase { - private List requests; - private Queue responses; - - public MockWickedImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(AbstractMessage response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void craftEvilPlan(EvilRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof EvilResponse) { - requests.add(request); - responseObserver.onNext(((EvilResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method CraftEvilPlan, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - EvilResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public StreamObserver brainstormEvilPlans( - final StreamObserver responseObserver) { - StreamObserver requestObserver = - new StreamObserver() { - @Override - public void onNext(EvilRequest value) { - requests.add(value); - final Object response = responses.remove(); - if (response instanceof EvilResponse) { - responseObserver.onNext(((EvilResponse) response)); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method BrainstormEvilPlans, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - EvilResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void onError(Throwable t) { - responseObserver.onError(t); - } - - @Override - public void onCompleted() { - responseObserver.onCompleted(); - } - }; - return requestObserver; - } - - @Override - public StreamObserver persuadeEvilPlan( - final StreamObserver responseObserver) { - StreamObserver requestObserver = - new StreamObserver() { - @Override - public void onNext(EvilRequest value) { - requests.add(value); - final Object response = responses.remove(); - if (response instanceof EvilResponse) { - responseObserver.onNext(((EvilResponse) response)); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method PersuadeEvilPlan, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - EvilResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void onError(Throwable t) { - responseObserver.onError(t); - } - - @Override - public void onCompleted() { - responseObserver.onCompleted(); - } - }; - return requestObserver; - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java deleted file mode 100644 index 9d3ca75149..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientHttpJsonTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.testing.MockHttpService; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ApiException; -import com.google.api.gax.rpc.ApiExceptionFactory; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.testing.FakeStatusCode; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.Lists; -import com.google.protobuf.Any; -import com.google.showcase.v1beta1.stub.HttpJsonWickedStub; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class WickedClientHttpJsonTest { - private static MockHttpService mockService; - private static WickedClient client; - - @BeforeClass - public static void startStaticServer() throws IOException { - mockService = - new MockHttpService( - HttpJsonWickedStub.getMethodDescriptors(), WickedSettings.getDefaultEndpoint()); - WickedSettings settings = - WickedSettings.newHttpJsonBuilder() - .setTransportChannelProvider( - WickedSettings.defaultHttpJsonTransportProviderBuilder() - .setHttpTransport(mockService) - .build()) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = WickedClient.create(settings); - } - - @AfterClass - public static void stopServer() { - client.close(); - } - - @Before - public void setUp() {} - - @After - public void tearDown() throws Exception { - mockService.reset(); - } - - @Test - public void craftEvilPlanUnsupportedMethodTest() throws Exception { - // The craftEvilPlan() method is not supported in REST transport. - // This empty test is generated for technical reasons. - } - - @Test - public void brainstormEvilPlansUnsupportedMethodTest() throws Exception { - // The brainstormEvilPlans() method is not supported in REST transport. - // This empty test is generated for technical reasons. - } - - @Test - public void persuadeEvilPlanUnsupportedMethodTest() throws Exception { - // The persuadeEvilPlan() method is not supported in REST transport. - // This empty test is generated for technical reasons. - } - - @Test - public void listLocationsTest() throws Exception { - Location responsesElement = Location.newBuilder().build(); - ListLocationsResponse expectedResponse = - ListLocationsResponse.newBuilder() - .setNextPageToken("") - .addAllLocations(Arrays.asList(responsesElement)) - .build(); - mockService.addResponse(expectedResponse); - - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("projects/project-3664") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - - ListLocationsPagedResponse pagedListResponse = client.listLocations(request); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listLocationsExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("projects/project-3664") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - client.listLocations(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getLocationTest() throws Exception { - Location expectedResponse = - Location.newBuilder() - .setName("name3373707") - .setLocationId("locationId1541836720") - .setDisplayName("displayName1714148973") - .putAllLabels(new HashMap()) - .setMetadata(Any.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - GetLocationRequest request = - GetLocationRequest.newBuilder() - .setName("projects/project-9062/locations/location-9062") - .build(); - - Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getLocationExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - GetLocationRequest request = - GetLocationRequest.newBuilder() - .setName("projects/project-9062/locations/location-9062") - .build(); - client.getLocation(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java b/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java deleted file mode 100644 index 67bf9d3567..0000000000 --- a/showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/WickedClientTest.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.showcase.v1beta1; - -import static com.google.showcase.v1beta1.WickedClient.ListLocationsPagedResponse; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.grpc.testing.MockStreamObserver; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ApiStreamObserver; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.Lists; -import com.google.protobuf.AbstractMessage; -import com.google.protobuf.Any; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class WickedClientTest { - private static MockLocations mockLocations; - private static MockServiceHelper mockServiceHelper; - private static MockWicked mockWicked; - private LocalChannelProvider channelProvider; - private WickedClient client; - - @BeforeClass - public static void startStaticServer() { - mockWicked = new MockWicked(); - mockLocations = new MockLocations(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList(mockWicked, mockLocations)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - WickedSettings settings = - WickedSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = WickedClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void craftEvilPlanTest() throws Exception { - EvilResponse expectedResponse = - EvilResponse.newBuilder().setMaliciousPlan("maliciousPlan712757759").build(); - mockWicked.addResponse(expectedResponse); - - EvilRequest request = - EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); - - EvilResponse actualResponse = client.craftEvilPlan(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockWicked.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - EvilRequest actualRequest = ((EvilRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getMaliciousIdea(), actualRequest.getMaliciousIdea()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void craftEvilPlanExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockWicked.addException(exception); - - try { - EvilRequest request = - EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); - client.craftEvilPlan(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void brainstormEvilPlansTest() throws Exception { - EvilResponse expectedResponse = - EvilResponse.newBuilder().setMaliciousPlan("maliciousPlan712757759").build(); - mockWicked.addResponse(expectedResponse); - EvilRequest request = - EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); - - MockStreamObserver responseObserver = new MockStreamObserver<>(); - - BidiStreamingCallable callable = - client.brainstormEvilPlansCallable(); - ApiStreamObserver requestObserver = callable.bidiStreamingCall(responseObserver); - - requestObserver.onNext(request); - requestObserver.onCompleted(); - - List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); - } - - @Test - public void brainstormEvilPlansExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockWicked.addException(exception); - EvilRequest request = - EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); - - MockStreamObserver responseObserver = new MockStreamObserver<>(); - - BidiStreamingCallable callable = - client.brainstormEvilPlansCallable(); - ApiStreamObserver requestObserver = callable.bidiStreamingCall(responseObserver); - - requestObserver.onNext(request); - - try { - List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); - } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); - InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } - - @Test - public void persuadeEvilPlanTest() throws Exception { - EvilResponse expectedResponse = - EvilResponse.newBuilder().setMaliciousPlan("maliciousPlan712757759").build(); - mockWicked.addResponse(expectedResponse); - EvilRequest request = - EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); - - MockStreamObserver responseObserver = new MockStreamObserver<>(); - - ClientStreamingCallable callable = client.persuadeEvilPlanCallable(); - ApiStreamObserver requestObserver = callable.clientStreamingCall(responseObserver); - - requestObserver.onNext(request); - requestObserver.onCompleted(); - - List actualResponses = responseObserver.future().get(); - Assert.assertEquals(1, actualResponses.size()); - Assert.assertEquals(expectedResponse, actualResponses.get(0)); - } - - @Test - public void persuadeEvilPlanExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockWicked.addException(exception); - EvilRequest request = - EvilRequest.newBuilder().setMaliciousIdea("maliciousIdea712541645").build(); - - MockStreamObserver responseObserver = new MockStreamObserver<>(); - - ClientStreamingCallable callable = client.persuadeEvilPlanCallable(); - ApiStreamObserver requestObserver = callable.clientStreamingCall(responseObserver); - - requestObserver.onNext(request); - - try { - List actualResponses = responseObserver.future().get(); - Assert.fail("No exception thrown"); - } catch (ExecutionException e) { - Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); - InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } - - @Test - public void listLocationsTest() throws Exception { - Location responsesElement = Location.newBuilder().build(); - ListLocationsResponse expectedResponse = - ListLocationsResponse.newBuilder() - .setNextPageToken("") - .addAllLocations(Arrays.asList(responsesElement)) - .build(); - mockLocations.addResponse(expectedResponse); - - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("name3373707") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - - ListLocationsPagedResponse pagedListResponse = client.listLocations(request); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); - - List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listLocationsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLocations.addException(exception); - - try { - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("name3373707") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - client.listLocations(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getLocationTest() throws Exception { - Location expectedResponse = - Location.newBuilder() - .setName("name3373707") - .setLocationId("locationId1541836720") - .setDisplayName("displayName1714148973") - .putAllLabels(new HashMap()) - .setMetadata(Any.newBuilder().build()) - .build(); - mockLocations.addResponse(expectedResponse); - - GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); - - Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getLocationExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLocations.addException(exception); - - try { - GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); - client.getLocation(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java b/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java deleted file mode 100644 index ad352a06e0..0000000000 --- a/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsGrpc.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.google.showcase.v1beta1; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: showcase/gapic-showcase-extended/proto/collisions.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class CollisionsGrpc { - - private CollisionsGrpc() {} - - public static final String SERVICE_NAME = "google.showcase.v1beta1.Collisions"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getDoSomethingMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "doSomething", - requestType = com.google.showcase.v1beta1.Request.class, - responseType = com.google.longrunning.Operation.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getDoSomethingMethod() { - io.grpc.MethodDescriptor getDoSomethingMethod; - if ((getDoSomethingMethod = CollisionsGrpc.getDoSomethingMethod) == null) { - synchronized (CollisionsGrpc.class) { - if ((getDoSomethingMethod = CollisionsGrpc.getDoSomethingMethod) == null) { - CollisionsGrpc.getDoSomethingMethod = getDoSomethingMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "doSomething")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.Request.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.longrunning.Operation.getDefaultInstance())) - .setSchemaDescriptor(new CollisionsMethodDescriptorSupplier("doSomething")) - .build(); - } - } - } - return getDoSomethingMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static CollisionsStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public CollisionsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new CollisionsStub(channel, callOptions); - } - }; - return CollisionsStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static CollisionsBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public CollisionsBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new CollisionsBlockingStub(channel, callOptions); - } - }; - return CollisionsBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static CollisionsFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public CollisionsFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new CollisionsFutureStub(channel, callOptions); - } - }; - return CollisionsFutureStub.newStub(factory, channel); - } - - /** - */ - public interface AsyncService { - - /** - */ - default void doSomething(com.google.showcase.v1beta1.Request request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDoSomethingMethod(), responseObserver); - } - } - - /** - * Base class for the server implementation of the service Collisions. - */ - public static abstract class CollisionsImplBase - implements io.grpc.BindableService, AsyncService { - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return CollisionsGrpc.bindService(this); - } - } - - /** - * A stub to allow clients to do asynchronous rpc calls to service Collisions. - */ - public static final class CollisionsStub - extends io.grpc.stub.AbstractAsyncStub { - private CollisionsStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected CollisionsStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new CollisionsStub(channel, callOptions); - } - - /** - */ - public void doSomething(com.google.showcase.v1beta1.Request request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getDoSomethingMethod(), getCallOptions()), request, responseObserver); - } - } - - /** - * A stub to allow clients to do synchronous rpc calls to service Collisions. - */ - public static final class CollisionsBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private CollisionsBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected CollisionsBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new CollisionsBlockingStub(channel, callOptions); - } - - /** - */ - public com.google.longrunning.Operation doSomething(com.google.showcase.v1beta1.Request request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getDoSomethingMethod(), getCallOptions(), request); - } - } - - /** - * A stub to allow clients to do ListenableFuture-style rpc calls to service Collisions. - */ - public static final class CollisionsFutureStub - extends io.grpc.stub.AbstractFutureStub { - private CollisionsFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected CollisionsFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new CollisionsFutureStub(channel, callOptions); - } - - /** - */ - public com.google.common.util.concurrent.ListenableFuture doSomething( - com.google.showcase.v1beta1.Request request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getDoSomethingMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_DO_SOMETHING = 0; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AsyncService serviceImpl; - private final int methodId; - - MethodHandlers(AsyncService serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_DO_SOMETHING: - serviceImpl.doSomething((com.google.showcase.v1beta1.Request) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - } - - public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getDoSomethingMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.showcase.v1beta1.Request, - com.google.longrunning.Operation>( - service, METHODID_DO_SOMETHING))) - .build(); - } - - private static abstract class CollisionsBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - CollisionsBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("Collisions"); - } - } - - private static final class CollisionsFileDescriptorSupplier - extends CollisionsBaseDescriptorSupplier { - CollisionsFileDescriptorSupplier() {} - } - - private static final class CollisionsMethodDescriptorSupplier - extends CollisionsBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - CollisionsMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (CollisionsGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new CollisionsFileDescriptorSupplier()) - .addMethod(getDoSomethingMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java b/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java deleted file mode 100644 index babc778d11..0000000000 --- a/showcase/grpc-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedGrpc.java +++ /dev/null @@ -1,409 +0,0 @@ -package com.google.showcase.v1beta1; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: showcase/gapic-showcase-extended/proto/wicked.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class WickedGrpc { - - private WickedGrpc() {} - - public static final String SERVICE_NAME = "google.showcase.v1beta1.Wicked"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getCraftEvilPlanMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "CraftEvilPlan", - requestType = com.google.showcase.v1beta1.EvilRequest.class, - responseType = com.google.showcase.v1beta1.EvilResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getCraftEvilPlanMethod() { - io.grpc.MethodDescriptor getCraftEvilPlanMethod; - if ((getCraftEvilPlanMethod = WickedGrpc.getCraftEvilPlanMethod) == null) { - synchronized (WickedGrpc.class) { - if ((getCraftEvilPlanMethod = WickedGrpc.getCraftEvilPlanMethod) == null) { - WickedGrpc.getCraftEvilPlanMethod = getCraftEvilPlanMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CraftEvilPlan")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.EvilRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.EvilResponse.getDefaultInstance())) - .setSchemaDescriptor(new WickedMethodDescriptorSupplier("CraftEvilPlan")) - .build(); - } - } - } - return getCraftEvilPlanMethod; - } - - private static volatile io.grpc.MethodDescriptor getBrainstormEvilPlansMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "BrainstormEvilPlans", - requestType = com.google.showcase.v1beta1.EvilRequest.class, - responseType = com.google.showcase.v1beta1.EvilResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - public static io.grpc.MethodDescriptor getBrainstormEvilPlansMethod() { - io.grpc.MethodDescriptor getBrainstormEvilPlansMethod; - if ((getBrainstormEvilPlansMethod = WickedGrpc.getBrainstormEvilPlansMethod) == null) { - synchronized (WickedGrpc.class) { - if ((getBrainstormEvilPlansMethod = WickedGrpc.getBrainstormEvilPlansMethod) == null) { - WickedGrpc.getBrainstormEvilPlansMethod = getBrainstormEvilPlansMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "BrainstormEvilPlans")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.EvilRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.EvilResponse.getDefaultInstance())) - .setSchemaDescriptor(new WickedMethodDescriptorSupplier("BrainstormEvilPlans")) - .build(); - } - } - } - return getBrainstormEvilPlansMethod; - } - - private static volatile io.grpc.MethodDescriptor getPersuadeEvilPlanMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "PersuadeEvilPlan", - requestType = com.google.showcase.v1beta1.EvilRequest.class, - responseType = com.google.showcase.v1beta1.EvilResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) - public static io.grpc.MethodDescriptor getPersuadeEvilPlanMethod() { - io.grpc.MethodDescriptor getPersuadeEvilPlanMethod; - if ((getPersuadeEvilPlanMethod = WickedGrpc.getPersuadeEvilPlanMethod) == null) { - synchronized (WickedGrpc.class) { - if ((getPersuadeEvilPlanMethod = WickedGrpc.getPersuadeEvilPlanMethod) == null) { - WickedGrpc.getPersuadeEvilPlanMethod = getPersuadeEvilPlanMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "PersuadeEvilPlan")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.EvilRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.google.showcase.v1beta1.EvilResponse.getDefaultInstance())) - .setSchemaDescriptor(new WickedMethodDescriptorSupplier("PersuadeEvilPlan")) - .build(); - } - } - } - return getPersuadeEvilPlanMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static WickedStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public WickedStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new WickedStub(channel, callOptions); - } - }; - return WickedStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static WickedBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public WickedBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new WickedBlockingStub(channel, callOptions); - } - }; - return WickedBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static WickedFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public WickedFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new WickedFutureStub(channel, callOptions); - } - }; - return WickedFutureStub.newStub(factory, channel); - } - - /** - */ - public interface AsyncService { - - /** - */ - default void craftEvilPlan(com.google.showcase.v1beta1.EvilRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCraftEvilPlanMethod(), responseObserver); - } - - /** - */ - default io.grpc.stub.StreamObserver brainstormEvilPlans( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getBrainstormEvilPlansMethod(), responseObserver); - } - - /** - */ - default io.grpc.stub.StreamObserver persuadeEvilPlan( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getPersuadeEvilPlanMethod(), responseObserver); - } - } - - /** - * Base class for the server implementation of the service Wicked. - */ - public static abstract class WickedImplBase - implements io.grpc.BindableService, AsyncService { - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return WickedGrpc.bindService(this); - } - } - - /** - * A stub to allow clients to do asynchronous rpc calls to service Wicked. - */ - public static final class WickedStub - extends io.grpc.stub.AbstractAsyncStub { - private WickedStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected WickedStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new WickedStub(channel, callOptions); - } - - /** - */ - public void craftEvilPlan(com.google.showcase.v1beta1.EvilRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getCraftEvilPlanMethod(), getCallOptions()), request, responseObserver); - } - - /** - */ - public io.grpc.stub.StreamObserver brainstormEvilPlans( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( - getChannel().newCall(getBrainstormEvilPlansMethod(), getCallOptions()), responseObserver); - } - - /** - */ - public io.grpc.stub.StreamObserver persuadeEvilPlan( - io.grpc.stub.StreamObserver responseObserver) { - return io.grpc.stub.ClientCalls.asyncClientStreamingCall( - getChannel().newCall(getPersuadeEvilPlanMethod(), getCallOptions()), responseObserver); - } - } - - /** - * A stub to allow clients to do synchronous rpc calls to service Wicked. - */ - public static final class WickedBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private WickedBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected WickedBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new WickedBlockingStub(channel, callOptions); - } - - /** - */ - public com.google.showcase.v1beta1.EvilResponse craftEvilPlan(com.google.showcase.v1beta1.EvilRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getCraftEvilPlanMethod(), getCallOptions(), request); - } - } - - /** - * A stub to allow clients to do ListenableFuture-style rpc calls to service Wicked. - */ - public static final class WickedFutureStub - extends io.grpc.stub.AbstractFutureStub { - private WickedFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected WickedFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new WickedFutureStub(channel, callOptions); - } - - /** - */ - public com.google.common.util.concurrent.ListenableFuture craftEvilPlan( - com.google.showcase.v1beta1.EvilRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getCraftEvilPlanMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_CRAFT_EVIL_PLAN = 0; - private static final int METHODID_BRAINSTORM_EVIL_PLANS = 1; - private static final int METHODID_PERSUADE_EVIL_PLAN = 2; - - private static final class MethodHandlers implements - io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AsyncService serviceImpl; - private final int methodId; - - MethodHandlers(AsyncService serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_CRAFT_EVIL_PLAN: - serviceImpl.craftEvilPlan((com.google.showcase.v1beta1.EvilRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_BRAINSTORM_EVIL_PLANS: - return (io.grpc.stub.StreamObserver) serviceImpl.brainstormEvilPlans( - (io.grpc.stub.StreamObserver) responseObserver); - case METHODID_PERSUADE_EVIL_PLAN: - return (io.grpc.stub.StreamObserver) serviceImpl.persuadeEvilPlan( - (io.grpc.stub.StreamObserver) responseObserver); - default: - throw new AssertionError(); - } - } - } - - public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getCraftEvilPlanMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.showcase.v1beta1.EvilRequest, - com.google.showcase.v1beta1.EvilResponse>( - service, METHODID_CRAFT_EVIL_PLAN))) - .addMethod( - getBrainstormEvilPlansMethod(), - io.grpc.stub.ServerCalls.asyncBidiStreamingCall( - new MethodHandlers< - com.google.showcase.v1beta1.EvilRequest, - com.google.showcase.v1beta1.EvilResponse>( - service, METHODID_BRAINSTORM_EVIL_PLANS))) - .addMethod( - getPersuadeEvilPlanMethod(), - io.grpc.stub.ServerCalls.asyncClientStreamingCall( - new MethodHandlers< - com.google.showcase.v1beta1.EvilRequest, - com.google.showcase.v1beta1.EvilResponse>( - service, METHODID_PERSUADE_EVIL_PLAN))) - .build(); - } - - private static abstract class WickedBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - WickedBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.showcase.v1beta1.WickedOuterClass.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("Wicked"); - } - } - - private static final class WickedFileDescriptorSupplier - extends WickedBaseDescriptorSupplier { - WickedFileDescriptorSupplier() {} - } - - private static final class WickedMethodDescriptorSupplier - extends WickedBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - WickedMethodDescriptorSupplier(String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (WickedGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new WickedFileDescriptorSupplier()) - .addMethod(getCraftEvilPlanMethod()) - .addMethod(getBrainstormEvilPlansMethod()) - .addMethod(getPersuadeEvilPlanMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java deleted file mode 100644 index e36e50a459..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Annotation.java +++ /dev/null @@ -1,544 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -/** - * Protobuf type {@code google.showcase.v1beta1.Annotation} - */ -public final class Annotation extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Annotation) - AnnotationOrBuilder { -private static final long serialVersionUID = 0L; - // Use Annotation.newBuilder() to construct. - private Annotation(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Annotation() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Annotation(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Annotation.class, com.google.showcase.v1beta1.Annotation.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - @SuppressWarnings("serial") - private volatile java.lang.Object name_ = ""; - /** - * string name = 1; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * string name = 1; - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.showcase.v1beta1.Annotation)) { - return super.equals(obj); - } - com.google.showcase.v1beta1.Annotation other = (com.google.showcase.v1beta1.Annotation) obj; - - if (!getName() - .equals(other.getName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.showcase.v1beta1.Annotation parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Annotation parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Annotation parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.Annotation parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Annotation parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Annotation parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.google.showcase.v1beta1.Annotation prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.showcase.v1beta1.Annotation} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Annotation) - com.google.showcase.v1beta1.AnnotationOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Annotation.class, com.google.showcase.v1beta1.Annotation.Builder.class); - } - - // Construct using com.google.showcase.v1beta1.Annotation.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - name_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Annotation_descriptor; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Annotation getDefaultInstanceForType() { - return com.google.showcase.v1beta1.Annotation.getDefaultInstance(); - } - - @java.lang.Override - public com.google.showcase.v1beta1.Annotation build() { - com.google.showcase.v1beta1.Annotation result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Annotation buildPartial() { - com.google.showcase.v1beta1.Annotation result = new com.google.showcase.v1beta1.Annotation(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.showcase.v1beta1.Annotation result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.name_ = name_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.Annotation) { - return mergeFrom((com.google.showcase.v1beta1.Annotation)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.showcase.v1beta1.Annotation other) { - if (other == com.google.showcase.v1beta1.Annotation.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - bitField0_ |= 0x00000001; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - name_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private java.lang.Object name_ = ""; - /** - * string name = 1; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string name = 1; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string name = 1; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - name_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * string name = 1; - * @return This builder for chaining. - */ - public Builder clearName() { - name_ = getDefaultInstance().getName(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * string name = 1; - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - name_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Annotation) - } - - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Annotation) - private static final com.google.showcase.v1beta1.Annotation DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Annotation(); - } - - public static com.google.showcase.v1beta1.Annotation getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Annotation parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Annotation getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java deleted file mode 100644 index 6801f02095..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/AnnotationOrBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -public interface AnnotationOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Annotation) - com.google.protobuf.MessageOrBuilder { - - /** - * string name = 1; - * @return The name. - */ - java.lang.String getName(); - /** - * string name = 1; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java deleted file mode 100644 index 326d872182..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/CollisionsOuterClass.java +++ /dev/null @@ -1,90 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -public final class CollisionsOuterClass { - private CollisionsOuterClass() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_Request_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_Request_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_Annotation_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_Location_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_Location_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n7showcase/gapic-showcase-extended/proto" + - "/collisions.proto\022\027google.showcase.v1bet" + - "a1\032\027google/api/client.proto\032#google/long" + - "running/operations.proto\"\205\001\n\007Request\022\014\n\004" + - "name\030\001 \001(\t\0227\n\nannotation\030\002 \001(\0132#.google." + - "showcase.v1beta1.Annotation\0223\n\010location\030" + - "\003 \001(\0132!.google.showcase.v1beta1.Location" + - "\"\032\n\nAnnotation\022\014\n\004name\030\001 \001(\t\"\030\n\010Location" + - "\022\014\n\004name\030\001 \001(\t2\212\001\n\nCollisions\022i\n\013doSomet" + - "hing\022 .google.showcase.v1beta1.Request\032\035" + - ".google.longrunning.Operation\"\031\312A\026\n\nAnno" + - "tation\022\010Location\032\021\312A\016localhost:7469B\037\n\033c" + - "om.google.showcase.v1beta1P\001b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.ClientProto.getDescriptor(), - com.google.longrunning.OperationsProto.getDescriptor(), - }); - internal_static_google_showcase_v1beta1_Request_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_google_showcase_v1beta1_Request_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_Request_descriptor, - new java.lang.String[] { "Name", "Annotation", "Location", }); - internal_static_google_showcase_v1beta1_Annotation_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_google_showcase_v1beta1_Annotation_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_Annotation_descriptor, - new java.lang.String[] { "Name", }); - internal_static_google_showcase_v1beta1_Location_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_google_showcase_v1beta1_Location_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_Location_descriptor, - new java.lang.String[] { "Name", }); - com.google.protobuf.ExtensionRegistry registry = - com.google.protobuf.ExtensionRegistry.newInstance(); - registry.add(com.google.api.ClientProto.defaultHost); - registry.add(com.google.longrunning.OperationsProto.operationInfo); - com.google.protobuf.Descriptors.FileDescriptor - .internalUpdateFileDescriptor(descriptor, registry); - com.google.api.ClientProto.getDescriptor(); - com.google.longrunning.OperationsProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java deleted file mode 100644 index ed713fa0b7..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequest.java +++ /dev/null @@ -1,544 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/wicked.proto - -package com.google.showcase.v1beta1; - -/** - * Protobuf type {@code google.showcase.v1beta1.EvilRequest} - */ -public final class EvilRequest extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.EvilRequest) - EvilRequestOrBuilder { -private static final long serialVersionUID = 0L; - // Use EvilRequest.newBuilder() to construct. - private EvilRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private EvilRequest() { - maliciousIdea_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new EvilRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.EvilRequest.class, com.google.showcase.v1beta1.EvilRequest.Builder.class); - } - - public static final int MALICIOUS_IDEA_FIELD_NUMBER = 1; - @SuppressWarnings("serial") - private volatile java.lang.Object maliciousIdea_ = ""; - /** - * string malicious_idea = 1; - * @return The maliciousIdea. - */ - @java.lang.Override - public java.lang.String getMaliciousIdea() { - java.lang.Object ref = maliciousIdea_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - maliciousIdea_ = s; - return s; - } - } - /** - * string malicious_idea = 1; - * @return The bytes for maliciousIdea. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getMaliciousIdeaBytes() { - java.lang.Object ref = maliciousIdea_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - maliciousIdea_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousIdea_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, maliciousIdea_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousIdea_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, maliciousIdea_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.showcase.v1beta1.EvilRequest)) { - return super.equals(obj); - } - com.google.showcase.v1beta1.EvilRequest other = (com.google.showcase.v1beta1.EvilRequest) obj; - - if (!getMaliciousIdea() - .equals(other.getMaliciousIdea())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + MALICIOUS_IDEA_FIELD_NUMBER; - hash = (53 * hash) + getMaliciousIdea().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.EvilRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.EvilRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.google.showcase.v1beta1.EvilRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.showcase.v1beta1.EvilRequest} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.EvilRequest) - com.google.showcase.v1beta1.EvilRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.EvilRequest.class, com.google.showcase.v1beta1.EvilRequest.Builder.class); - } - - // Construct using com.google.showcase.v1beta1.EvilRequest.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - maliciousIdea_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilRequest_descriptor; - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilRequest getDefaultInstanceForType() { - return com.google.showcase.v1beta1.EvilRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilRequest build() { - com.google.showcase.v1beta1.EvilRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilRequest buildPartial() { - com.google.showcase.v1beta1.EvilRequest result = new com.google.showcase.v1beta1.EvilRequest(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.showcase.v1beta1.EvilRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.maliciousIdea_ = maliciousIdea_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.EvilRequest) { - return mergeFrom((com.google.showcase.v1beta1.EvilRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.showcase.v1beta1.EvilRequest other) { - if (other == com.google.showcase.v1beta1.EvilRequest.getDefaultInstance()) return this; - if (!other.getMaliciousIdea().isEmpty()) { - maliciousIdea_ = other.maliciousIdea_; - bitField0_ |= 0x00000001; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - maliciousIdea_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private java.lang.Object maliciousIdea_ = ""; - /** - * string malicious_idea = 1; - * @return The maliciousIdea. - */ - public java.lang.String getMaliciousIdea() { - java.lang.Object ref = maliciousIdea_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - maliciousIdea_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string malicious_idea = 1; - * @return The bytes for maliciousIdea. - */ - public com.google.protobuf.ByteString - getMaliciousIdeaBytes() { - java.lang.Object ref = maliciousIdea_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - maliciousIdea_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string malicious_idea = 1; - * @param value The maliciousIdea to set. - * @return This builder for chaining. - */ - public Builder setMaliciousIdea( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - maliciousIdea_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * string malicious_idea = 1; - * @return This builder for chaining. - */ - public Builder clearMaliciousIdea() { - maliciousIdea_ = getDefaultInstance().getMaliciousIdea(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * string malicious_idea = 1; - * @param value The bytes for maliciousIdea to set. - * @return This builder for chaining. - */ - public Builder setMaliciousIdeaBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - maliciousIdea_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.EvilRequest) - } - - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.EvilRequest) - private static final com.google.showcase.v1beta1.EvilRequest DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.EvilRequest(); - } - - public static com.google.showcase.v1beta1.EvilRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public EvilRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java deleted file mode 100644 index 3b9d11f981..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilRequestOrBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/wicked.proto - -package com.google.showcase.v1beta1; - -public interface EvilRequestOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.EvilRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * string malicious_idea = 1; - * @return The maliciousIdea. - */ - java.lang.String getMaliciousIdea(); - /** - * string malicious_idea = 1; - * @return The bytes for maliciousIdea. - */ - com.google.protobuf.ByteString - getMaliciousIdeaBytes(); -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java deleted file mode 100644 index 96c096134f..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponse.java +++ /dev/null @@ -1,544 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/wicked.proto - -package com.google.showcase.v1beta1; - -/** - * Protobuf type {@code google.showcase.v1beta1.EvilResponse} - */ -public final class EvilResponse extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.EvilResponse) - EvilResponseOrBuilder { -private static final long serialVersionUID = 0L; - // Use EvilResponse.newBuilder() to construct. - private EvilResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private EvilResponse() { - maliciousPlan_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new EvilResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.EvilResponse.class, com.google.showcase.v1beta1.EvilResponse.Builder.class); - } - - public static final int MALICIOUS_PLAN_FIELD_NUMBER = 1; - @SuppressWarnings("serial") - private volatile java.lang.Object maliciousPlan_ = ""; - /** - * string malicious_plan = 1; - * @return The maliciousPlan. - */ - @java.lang.Override - public java.lang.String getMaliciousPlan() { - java.lang.Object ref = maliciousPlan_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - maliciousPlan_ = s; - return s; - } - } - /** - * string malicious_plan = 1; - * @return The bytes for maliciousPlan. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getMaliciousPlanBytes() { - java.lang.Object ref = maliciousPlan_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - maliciousPlan_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousPlan_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, maliciousPlan_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(maliciousPlan_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, maliciousPlan_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.showcase.v1beta1.EvilResponse)) { - return super.equals(obj); - } - com.google.showcase.v1beta1.EvilResponse other = (com.google.showcase.v1beta1.EvilResponse) obj; - - if (!getMaliciousPlan() - .equals(other.getMaliciousPlan())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + MALICIOUS_PLAN_FIELD_NUMBER; - hash = (53 * hash) + getMaliciousPlan().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.EvilResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.EvilResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.google.showcase.v1beta1.EvilResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.showcase.v1beta1.EvilResponse} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.EvilResponse) - com.google.showcase.v1beta1.EvilResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.EvilResponse.class, com.google.showcase.v1beta1.EvilResponse.Builder.class); - } - - // Construct using com.google.showcase.v1beta1.EvilResponse.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - maliciousPlan_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.google.showcase.v1beta1.WickedOuterClass.internal_static_google_showcase_v1beta1_EvilResponse_descriptor; - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilResponse getDefaultInstanceForType() { - return com.google.showcase.v1beta1.EvilResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilResponse build() { - com.google.showcase.v1beta1.EvilResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilResponse buildPartial() { - com.google.showcase.v1beta1.EvilResponse result = new com.google.showcase.v1beta1.EvilResponse(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.showcase.v1beta1.EvilResponse result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.maliciousPlan_ = maliciousPlan_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.EvilResponse) { - return mergeFrom((com.google.showcase.v1beta1.EvilResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.showcase.v1beta1.EvilResponse other) { - if (other == com.google.showcase.v1beta1.EvilResponse.getDefaultInstance()) return this; - if (!other.getMaliciousPlan().isEmpty()) { - maliciousPlan_ = other.maliciousPlan_; - bitField0_ |= 0x00000001; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - maliciousPlan_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private java.lang.Object maliciousPlan_ = ""; - /** - * string malicious_plan = 1; - * @return The maliciousPlan. - */ - public java.lang.String getMaliciousPlan() { - java.lang.Object ref = maliciousPlan_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - maliciousPlan_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string malicious_plan = 1; - * @return The bytes for maliciousPlan. - */ - public com.google.protobuf.ByteString - getMaliciousPlanBytes() { - java.lang.Object ref = maliciousPlan_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - maliciousPlan_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string malicious_plan = 1; - * @param value The maliciousPlan to set. - * @return This builder for chaining. - */ - public Builder setMaliciousPlan( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - maliciousPlan_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * string malicious_plan = 1; - * @return This builder for chaining. - */ - public Builder clearMaliciousPlan() { - maliciousPlan_ = getDefaultInstance().getMaliciousPlan(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * string malicious_plan = 1; - * @param value The bytes for maliciousPlan to set. - * @return This builder for chaining. - */ - public Builder setMaliciousPlanBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - maliciousPlan_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.EvilResponse) - } - - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.EvilResponse) - private static final com.google.showcase.v1beta1.EvilResponse DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.EvilResponse(); - } - - public static com.google.showcase.v1beta1.EvilResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public EvilResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.showcase.v1beta1.EvilResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java deleted file mode 100644 index 4c78259881..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/EvilResponseOrBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/wicked.proto - -package com.google.showcase.v1beta1; - -public interface EvilResponseOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.EvilResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * string malicious_plan = 1; - * @return The maliciousPlan. - */ - java.lang.String getMaliciousPlan(); - /** - * string malicious_plan = 1; - * @return The bytes for maliciousPlan. - */ - com.google.protobuf.ByteString - getMaliciousPlanBytes(); -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java deleted file mode 100644 index 7e9c559fef..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Location.java +++ /dev/null @@ -1,544 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -/** - * Protobuf type {@code google.showcase.v1beta1.Location} - */ -public final class Location extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Location) - LocationOrBuilder { -private static final long serialVersionUID = 0L; - // Use Location.newBuilder() to construct. - private Location(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Location() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Location(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - @SuppressWarnings("serial") - private volatile java.lang.Object name_ = ""; - /** - * string name = 1; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * string name = 1; - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.showcase.v1beta1.Location)) { - return super.equals(obj); - } - com.google.showcase.v1beta1.Location other = (com.google.showcase.v1beta1.Location) obj; - - if (!getName() - .equals(other.getName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.showcase.v1beta1.Location parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Location parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Location parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Location parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Location parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Location parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Location parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Location parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.Location parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Location parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.Location parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Location parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.google.showcase.v1beta1.Location prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.showcase.v1beta1.Location} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Location) - com.google.showcase.v1beta1.LocationOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Location.class, com.google.showcase.v1beta1.Location.Builder.class); - } - - // Construct using com.google.showcase.v1beta1.Location.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - name_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Location_descriptor; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { - return com.google.showcase.v1beta1.Location.getDefaultInstance(); - } - - @java.lang.Override - public com.google.showcase.v1beta1.Location build() { - com.google.showcase.v1beta1.Location result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Location buildPartial() { - com.google.showcase.v1beta1.Location result = new com.google.showcase.v1beta1.Location(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.showcase.v1beta1.Location result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.name_ = name_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.Location) { - return mergeFrom((com.google.showcase.v1beta1.Location)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.showcase.v1beta1.Location other) { - if (other == com.google.showcase.v1beta1.Location.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - bitField0_ |= 0x00000001; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - name_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private java.lang.Object name_ = ""; - /** - * string name = 1; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string name = 1; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string name = 1; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - name_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * string name = 1; - * @return This builder for chaining. - */ - public Builder clearName() { - name_ = getDefaultInstance().getName(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * string name = 1; - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - name_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Location) - } - - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Location) - private static final com.google.showcase.v1beta1.Location DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Location(); - } - - public static com.google.showcase.v1beta1.Location getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Location parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Location getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java deleted file mode 100644 index 37f73be8aa..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/LocationOrBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -public interface LocationOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Location) - com.google.protobuf.MessageOrBuilder { - - /** - * string name = 1; - * @return The name. - */ - java.lang.String getName(); - /** - * string name = 1; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java deleted file mode 100644 index 70ebe31042..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/Request.java +++ /dev/null @@ -1,906 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -/** - * Protobuf type {@code google.showcase.v1beta1.Request} - */ -public final class Request extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:google.showcase.v1beta1.Request) - RequestOrBuilder { -private static final long serialVersionUID = 0L; - // Use Request.newBuilder() to construct. - private Request(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - private Request() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Request(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Request.class, com.google.showcase.v1beta1.Request.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - @SuppressWarnings("serial") - private volatile java.lang.Object name_ = ""; - /** - * string name = 1; - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * string name = 1; - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int ANNOTATION_FIELD_NUMBER = 2; - private com.google.showcase.v1beta1.Annotation annotation_; - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - * @return Whether the annotation field is set. - */ - @java.lang.Override - public boolean hasAnnotation() { - return annotation_ != null; - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - * @return The annotation. - */ - @java.lang.Override - public com.google.showcase.v1beta1.Annotation getAnnotation() { - return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - @java.lang.Override - public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() { - return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; - } - - public static final int LOCATION_FIELD_NUMBER = 3; - private com.google.showcase.v1beta1.Location location_; - /** - * .google.showcase.v1beta1.Location location = 3; - * @return Whether the location field is set. - */ - @java.lang.Override - public boolean hasLocation() { - return location_ != null; - } - /** - * .google.showcase.v1beta1.Location location = 3; - * @return The location. - */ - @java.lang.Override - public com.google.showcase.v1beta1.Location getLocation() { - return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - @java.lang.Override - public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { - return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; - } - - private byte memoizedIsInitialized = -1; - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (annotation_ != null) { - output.writeMessage(2, getAnnotation()); - } - if (location_ != null) { - output.writeMessage(3, getLocation()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (annotation_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, getAnnotation()); - } - if (location_ != null) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, getLocation()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.showcase.v1beta1.Request)) { - return super.equals(obj); - } - com.google.showcase.v1beta1.Request other = (com.google.showcase.v1beta1.Request) obj; - - if (!getName() - .equals(other.getName())) return false; - if (hasAnnotation() != other.hasAnnotation()) return false; - if (hasAnnotation()) { - if (!getAnnotation() - .equals(other.getAnnotation())) return false; - } - if (hasLocation() != other.hasLocation()) return false; - if (hasLocation()) { - if (!getLocation() - .equals(other.getLocation())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - if (hasAnnotation()) { - hash = (37 * hash) + ANNOTATION_FIELD_NUMBER; - hash = (53 * hash) + getAnnotation().hashCode(); - } - if (hasLocation()) { - hash = (37 * hash) + LOCATION_FIELD_NUMBER; - hash = (53 * hash) + getLocation().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.showcase.v1beta1.Request parseFrom( - java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Request parseFrom( - java.nio.ByteBuffer data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Request parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Request parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Request parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.google.showcase.v1beta1.Request parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.google.showcase.v1beta1.Request parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Request parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.Request parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Request parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.google.showcase.v1beta1.Request parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.google.showcase.v1beta1.Request parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.google.showcase.v1beta1.Request prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code google.showcase.v1beta1.Request} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:google.showcase.v1beta1.Request) - com.google.showcase.v1beta1.RequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.showcase.v1beta1.Request.class, com.google.showcase.v1beta1.Request.Builder.class); - } - - // Construct using com.google.showcase.v1beta1.Request.newBuilder() - private Builder() { - - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - - } - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - name_ = ""; - annotation_ = null; - if (annotationBuilder_ != null) { - annotationBuilder_.dispose(); - annotationBuilder_ = null; - } - location_ = null; - if (locationBuilder_ != null) { - locationBuilder_.dispose(); - locationBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.google.showcase.v1beta1.CollisionsOuterClass.internal_static_google_showcase_v1beta1_Request_descriptor; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Request getDefaultInstanceForType() { - return com.google.showcase.v1beta1.Request.getDefaultInstance(); - } - - @java.lang.Override - public com.google.showcase.v1beta1.Request build() { - com.google.showcase.v1beta1.Request result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Request buildPartial() { - com.google.showcase.v1beta1.Request result = new com.google.showcase.v1beta1.Request(this); - if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.showcase.v1beta1.Request result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.name_ = name_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.annotation_ = annotationBuilder_ == null - ? annotation_ - : annotationBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) != 0)) { - result.location_ = locationBuilder_ == null - ? location_ - : locationBuilder_.build(); - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.setField(field, value); - } - @java.lang.Override - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - @java.lang.Override - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - java.lang.Object value) { - return super.addRepeatedField(field, value); - } - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.showcase.v1beta1.Request) { - return mergeFrom((com.google.showcase.v1beta1.Request)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.showcase.v1beta1.Request other) { - if (other == com.google.showcase.v1beta1.Request.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - bitField0_ |= 0x00000001; - onChanged(); - } - if (other.hasAnnotation()) { - mergeAnnotation(other.getAnnotation()); - } - if (other.hasLocation()) { - mergeLocation(other.getLocation()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - name_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000001; - break; - } // case 10 - case 18: { - input.readMessage( - getAnnotationFieldBuilder().getBuilder(), - extensionRegistry); - bitField0_ |= 0x00000002; - break; - } // case 18 - case 26: { - input.readMessage( - getLocationFieldBuilder().getBuilder(), - extensionRegistry); - bitField0_ |= 0x00000004; - break; - } // case 26 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - private int bitField0_; - - private java.lang.Object name_ = ""; - /** - * string name = 1; - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * string name = 1; - * @return The bytes for name. - */ - public com.google.protobuf.ByteString - getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * string name = 1; - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName( - java.lang.String value) { - if (value == null) { throw new NullPointerException(); } - name_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * string name = 1; - * @return This builder for chaining. - */ - public Builder clearName() { - name_ = getDefaultInstance().getName(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * string name = 1; - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { throw new NullPointerException(); } - checkByteStringIsUtf8(value); - name_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - - private com.google.showcase.v1beta1.Annotation annotation_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Annotation, com.google.showcase.v1beta1.Annotation.Builder, com.google.showcase.v1beta1.AnnotationOrBuilder> annotationBuilder_; - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - * @return Whether the annotation field is set. - */ - public boolean hasAnnotation() { - return ((bitField0_ & 0x00000002) != 0); - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - * @return The annotation. - */ - public com.google.showcase.v1beta1.Annotation getAnnotation() { - if (annotationBuilder_ == null) { - return annotation_ == null ? com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; - } else { - return annotationBuilder_.getMessage(); - } - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - public Builder setAnnotation(com.google.showcase.v1beta1.Annotation value) { - if (annotationBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - annotation_ = value; - } else { - annotationBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - public Builder setAnnotation( - com.google.showcase.v1beta1.Annotation.Builder builderForValue) { - if (annotationBuilder_ == null) { - annotation_ = builderForValue.build(); - } else { - annotationBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - public Builder mergeAnnotation(com.google.showcase.v1beta1.Annotation value) { - if (annotationBuilder_ == null) { - if (((bitField0_ & 0x00000002) != 0) && - annotation_ != null && - annotation_ != com.google.showcase.v1beta1.Annotation.getDefaultInstance()) { - getAnnotationBuilder().mergeFrom(value); - } else { - annotation_ = value; - } - } else { - annotationBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - public Builder clearAnnotation() { - bitField0_ = (bitField0_ & ~0x00000002); - annotation_ = null; - if (annotationBuilder_ != null) { - annotationBuilder_.dispose(); - annotationBuilder_ = null; - } - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - public com.google.showcase.v1beta1.Annotation.Builder getAnnotationBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getAnnotationFieldBuilder().getBuilder(); - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - public com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder() { - if (annotationBuilder_ != null) { - return annotationBuilder_.getMessageOrBuilder(); - } else { - return annotation_ == null ? - com.google.showcase.v1beta1.Annotation.getDefaultInstance() : annotation_; - } - } - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Annotation, com.google.showcase.v1beta1.Annotation.Builder, com.google.showcase.v1beta1.AnnotationOrBuilder> - getAnnotationFieldBuilder() { - if (annotationBuilder_ == null) { - annotationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Annotation, com.google.showcase.v1beta1.Annotation.Builder, com.google.showcase.v1beta1.AnnotationOrBuilder>( - getAnnotation(), - getParentForChildren(), - isClean()); - annotation_ = null; - } - return annotationBuilder_; - } - - private com.google.showcase.v1beta1.Location location_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> locationBuilder_; - /** - * .google.showcase.v1beta1.Location location = 3; - * @return Whether the location field is set. - */ - public boolean hasLocation() { - return ((bitField0_ & 0x00000004) != 0); - } - /** - * .google.showcase.v1beta1.Location location = 3; - * @return The location. - */ - public com.google.showcase.v1beta1.Location getLocation() { - if (locationBuilder_ == null) { - return location_ == null ? com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; - } else { - return locationBuilder_.getMessage(); - } - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - public Builder setLocation(com.google.showcase.v1beta1.Location value) { - if (locationBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - location_ = value; - } else { - locationBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - public Builder setLocation( - com.google.showcase.v1beta1.Location.Builder builderForValue) { - if (locationBuilder_ == null) { - location_ = builderForValue.build(); - } else { - locationBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - public Builder mergeLocation(com.google.showcase.v1beta1.Location value) { - if (locationBuilder_ == null) { - if (((bitField0_ & 0x00000004) != 0) && - location_ != null && - location_ != com.google.showcase.v1beta1.Location.getDefaultInstance()) { - getLocationBuilder().mergeFrom(value); - } else { - location_ = value; - } - } else { - locationBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - public Builder clearLocation() { - bitField0_ = (bitField0_ & ~0x00000004); - location_ = null; - if (locationBuilder_ != null) { - locationBuilder_.dispose(); - locationBuilder_ = null; - } - onChanged(); - return this; - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - public com.google.showcase.v1beta1.Location.Builder getLocationBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getLocationFieldBuilder().getBuilder(); - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - public com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder() { - if (locationBuilder_ != null) { - return locationBuilder_.getMessageOrBuilder(); - } else { - return location_ == null ? - com.google.showcase.v1beta1.Location.getDefaultInstance() : location_; - } - } - /** - * .google.showcase.v1beta1.Location location = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder> - getLocationFieldBuilder() { - if (locationBuilder_ == null) { - locationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.google.showcase.v1beta1.Location, com.google.showcase.v1beta1.Location.Builder, com.google.showcase.v1beta1.LocationOrBuilder>( - getLocation(), - getParentForChildren(), - isClean()); - location_ = null; - } - return locationBuilder_; - } - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:google.showcase.v1beta1.Request) - } - - // @@protoc_insertion_point(class_scope:google.showcase.v1beta1.Request) - private static final com.google.showcase.v1beta1.Request DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.google.showcase.v1beta1.Request(); - } - - public static com.google.showcase.v1beta1.Request getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser - PARSER = new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Request parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.showcase.v1beta1.Request getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - -} - diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java deleted file mode 100644 index a8febedd64..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/RequestOrBuilder.java +++ /dev/null @@ -1,51 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/collisions.proto - -package com.google.showcase.v1beta1; - -public interface RequestOrBuilder extends - // @@protoc_insertion_point(interface_extends:google.showcase.v1beta1.Request) - com.google.protobuf.MessageOrBuilder { - - /** - * string name = 1; - * @return The name. - */ - java.lang.String getName(); - /** - * string name = 1; - * @return The bytes for name. - */ - com.google.protobuf.ByteString - getNameBytes(); - - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - * @return Whether the annotation field is set. - */ - boolean hasAnnotation(); - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - * @return The annotation. - */ - com.google.showcase.v1beta1.Annotation getAnnotation(); - /** - * .google.showcase.v1beta1.Annotation annotation = 2; - */ - com.google.showcase.v1beta1.AnnotationOrBuilder getAnnotationOrBuilder(); - - /** - * .google.showcase.v1beta1.Location location = 3; - * @return Whether the location field is set. - */ - boolean hasLocation(); - /** - * .google.showcase.v1beta1.Location location = 3; - * @return The location. - */ - com.google.showcase.v1beta1.Location getLocation(); - /** - * .google.showcase.v1beta1.Location location = 3; - */ - com.google.showcase.v1beta1.LocationOrBuilder getLocationOrBuilder(); -} diff --git a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java b/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java deleted file mode 100644 index 7498bd3edd..0000000000 --- a/showcase/proto-gapic-showcase-v1beta1/src/main/java/com/google/showcase/v1beta1/WickedOuterClass.java +++ /dev/null @@ -1,79 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: showcase/gapic-showcase-extended/proto/wicked.proto - -package com.google.showcase.v1beta1; - -public final class WickedOuterClass { - private WickedOuterClass() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_EvilRequest_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_showcase_v1beta1_EvilResponse_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n3showcase/gapic-showcase-extended/proto" + - "/wicked.proto\022\027google.showcase.v1beta1\032\027" + - "google/api/client.proto\"%\n\013EvilRequest\022\026" + - "\n\016malicious_idea\030\001 \001(\t\"&\n\014EvilResponse\022\026" + - "\n\016malicious_plan\030\001 \001(\t2\304\002\n\006Wicked\022\\\n\rCra" + - "ftEvilPlan\022$.google.showcase.v1beta1.Evi" + - "lRequest\032%.google.showcase.v1beta1.EvilR" + - "esponse\022f\n\023BrainstormEvilPlans\022$.google." + - "showcase.v1beta1.EvilRequest\032%.google.sh" + - "owcase.v1beta1.EvilResponse(\0010\001\022a\n\020Persu" + - "adeEvilPlan\022$.google.showcase.v1beta1.Ev" + - "ilRequest\032%.google.showcase.v1beta1.Evil" + - "Response(\001\032\021\312A\016localhost:7469Bq\n\033com.goo" + - "gle.showcase.v1beta1P\001Z4github.com/googl" + - "eapis/gapic-showcase/server/genproto\352\002\031G" + - "oogle::Showcase::V1beta1b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.ClientProto.getDescriptor(), - }); - internal_static_google_showcase_v1beta1_EvilRequest_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_google_showcase_v1beta1_EvilRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_EvilRequest_descriptor, - new java.lang.String[] { "MaliciousIdea", }); - internal_static_google_showcase_v1beta1_EvilResponse_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_google_showcase_v1beta1_EvilResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_showcase_v1beta1_EvilResponse_descriptor, - new java.lang.String[] { "MaliciousPlan", }); - com.google.protobuf.ExtensionRegistry registry = - com.google.protobuf.ExtensionRegistry.newInstance(); - registry.add(com.google.api.ClientProto.defaultHost); - com.google.protobuf.Descriptors.FileDescriptor - .internalUpdateFileDescriptor(descriptor, registry); - com.google.api.ClientProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} From 1ff61f48987f38df0d135e521faa5bac46cce001 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Tue, 13 Jun 2023 10:59:56 -0400 Subject: [PATCH 14/18] test: add unit tests to TypeParserTest --- .../gapic/protoparser/TypeParserTest.java | 56 +++++++++++++++++ .../src/test/proto/collisions.proto | 62 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 gapic-generator-java/src/test/proto/collisions.proto diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java index a79460e915..c04ebb610b 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java @@ -14,19 +14,34 @@ package com.google.api.generator.gapic.protoparser; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import com.google.api.generator.engine.ast.Reference; +import com.google.api.generator.gapic.model.LongrunningOperation; +import com.google.api.generator.gapic.model.Message; +import com.google.protobuf.DescriptorProtos; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.FileDescriptor; import com.google.protobuf.Descriptors.MethodDescriptor; import com.google.protobuf.Descriptors.ServiceDescriptor; +import com.google.showcase.v1beta1.CollisionsOuterClass; import com.google.showcase.v1beta1.EchoOuterClass; import com.google.testgapic.v1beta1.NestedMessageProto; +import java.util.Map; import org.junit.Test; public class TypeParserTest { // TODO(miraleung): Backfill with more tests (e.g. field, message, methods) for Parser.java. + + private static final FileDescriptor COLLISIONS_FILE_DESCRIPTOR = + CollisionsOuterClass.getDescriptor(); + private static final FileDescriptor DESCRIPTOR_PROTOS_FILE_DESCRIPTOR = + DescriptorProtos.getDescriptor(); + private static final ServiceDescriptor COLLISIONS_SERVICE = + COLLISIONS_FILE_DESCRIPTOR.getServices().get(0); + @Test public void parseMessageType_basic() { FileDescriptor echoFileDescriptor = EchoOuterClass.getDescriptor(); @@ -51,4 +66,45 @@ public void parseMessageType_nested() { Reference reference = TypeParser.parseMessageReference(messageDescriptor); assertEquals("com.google.testgapic.v1beta1.Outer.Middle.Inner", reference.fullName()); } + + @Test + public void parseLroResponseMetadataType_shortName_shouldMatchSamePackage() { + Map messageTypes = Parser.parseMessages(COLLISIONS_FILE_DESCRIPTOR); + messageTypes.putAll(Parser.parseMessages(DESCRIPTOR_PROTOS_FILE_DESCRIPTOR)); + MethodDescriptor shouldUseSamePackageTypesLro = COLLISIONS_SERVICE.getMethods().get(0); + + LongrunningOperation testLro = + Parser.parseLro( + TypeParser.getPackage(COLLISIONS_FILE_DESCRIPTOR), + shouldUseSamePackageTypesLro, + messageTypes); + + assertEquals(COLLISIONS_SERVICE.getName(), "Collisions"); + assertThat(messageTypes) + .containsKey("com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation"); + assertThat(messageTypes) + .containsKey("com.google.protobuf.DescriptorProtos.SourceCodeInfo.Location"); + assertThat(testLro.responseType().reference().fullName()) + .isEqualTo("com.google.showcase.v1beta1.Annotation"); + assertThat(testLro.metadataType().reference().fullName()) + .isEqualTo("com.google.showcase.v1beta1.Location"); + } + + @Test + public void parseLroResponseMetadataType_shortName_shouldNotMatch() { + Map messageTypes = Parser.parseMessages(COLLISIONS_FILE_DESCRIPTOR); + messageTypes.putAll(Parser.parseMessages(DESCRIPTOR_PROTOS_FILE_DESCRIPTOR)); + MethodDescriptor shortNameMatchShouldThrowLro = COLLISIONS_SERVICE.getMethods().get(1); + + assertEquals(COLLISIONS_SERVICE.getName(), "Collisions"); + assertThat(messageTypes) + .containsKey("com.google.protobuf.DescriptorProtos.ExtensionRangeOptions.Declaration"); + assertThrows( + NullPointerException.class, + () -> + Parser.parseLro( + TypeParser.getPackage(COLLISIONS_FILE_DESCRIPTOR), + shortNameMatchShouldThrowLro, + messageTypes)); + } } diff --git a/gapic-generator-java/src/test/proto/collisions.proto b/gapic-generator-java/src/test/proto/collisions.proto new file mode 100644 index 0000000000..55c3b92a2e --- /dev/null +++ b/gapic-generator-java/src/test/proto/collisions.proto @@ -0,0 +1,62 @@ +// Copyright 2023 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. + +syntax = "proto3"; + +import "google/api/client.proto"; +import "google/longrunning/operations.proto"; + +package google.showcase.v1beta1; + +option java_package = "com.google.showcase.v1beta1"; +option java_multiple_files = true; + +// This service exercises scenarios where short names of types +// exhibit ambiguity or collide with other types +service Collisions { + + option (google.api.default_host) = "localhost:7469"; + + rpc shouldUseSamePackageTypesLro(Request) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + // collision with com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation + response_type: "Annotation" + // collision with com.google.cloud.location.Location; + metadata_type: "Location" + }; + } + + rpc shortNameMatchShouldThrowLro(Request) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + // collision with com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation + response_type: "Annotation" + // collision with com.google.protobuf.DescriptorProtos.ExtensionRangeOptions.Declaration + metadata_type: "Declaration" + }; + } +} + +message Request { + string name = 1; + Annotation annotation = 2; + Location location = 3; +} + +message Annotation { + string name = 1; +} + +message Location { + string name = 1; +} \ No newline at end of file From 3703269e0b355d5bb06cc8b5bae5bcab68c5d533 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 14 Jun 2023 10:49:02 -0400 Subject: [PATCH 15/18] test: add writer unit test for generics import collision fix --- .../engine/writer/JavaWriterVisitorTest.java | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java b/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java index fa1301f49a..64a36809f5 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java +++ b/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java @@ -2395,6 +2395,83 @@ public void writeClassDefinition_commentsStatementsAndMethods() { assertEquals(expected, writerVisitor.write()); } + @Test + public void writeClassDefinition_withImportCollision() { + + VaporReference firstLocationType = + VaporReference.builder() + .setName("Location") + .setPakkage("com.google.cloud.location") + .build(); + + VaporReference secondLocationType = + VaporReference.builder().setName("Location").setPakkage("com.sun.jdi").build(); + + Variable secondLocationVar = + Variable.builder() + .setName("anotherLocationVar") + .setType(TypeNode.withReference(secondLocationType)) + .build(); + + MethodInvocationExpr genericMethodInvocation = + MethodInvocationExpr.builder() + .setMethodName("bar") + .setStaticReferenceType(TypeNode.withReference(firstLocationType)) + .setGenerics(Arrays.asList(secondLocationType)) + .setArguments(VariableExpr.withVariable(secondLocationVar)) + .setReturnType(TypeNode.STRING) + .build(); + + VariableExpr varExpr = + VariableExpr.builder() + .setVariable(Variable.builder().setName("result").setType(TypeNode.STRING).build()) + .setIsDecl(true) + .build(); + + AssignmentExpr assignmentExpr = + AssignmentExpr.builder() + .setVariableExpr(varExpr) + .setValueExpr(genericMethodInvocation) + .build(); + + List statements = Arrays.asList(ExprStatement.withExpr(assignmentExpr)); + + MethodDefinition methodOne = + MethodDefinition.builder() + .setName("doSomething") + .setScope(ScopeNode.PRIVATE) + .setBody(statements) + .setReturnType(TypeNode.VOID) + .build(); + + List methods = Arrays.asList(methodOne); + + ClassDefinition classDef = + ClassDefinition.builder() + .setPackageString("com.google.example.library.v1.stub") + .setName("FooService") + .setScope(ScopeNode.PUBLIC) + .setMethods(methods) + .build(); + + classDef.accept(writerVisitor); + + String expected = + LineFormatter.lines( + "package com.google.example.library.v1.stub;\n" + + "\n" + + "import com.google.cloud.location.Location;\n" + + "\n" + + "public class FooService {\n" + + "\n" + + " private void doSomething() {\n" + + " String result = Location.bar(anotherLocationVar);\n" + + " }\n" + + "}\n"); + + assertThat(writerVisitor.write()).isEqualTo(expected); + } + @Test public void writeReferenceConstructorExpr_thisConstructorWithArguments() { VaporReference ref = From 06dbf1fab97930d392a077e740a1d743fef7cde8 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 14 Jun 2023 11:41:13 -0400 Subject: [PATCH 16/18] test: undo changes to showcase-extended setup --- showcase/BUILD.bazel | 25 ++++----- .../gapic-showcase-extended/proto/BUILD.bazel | 19 +++---- .../proto/collisions.proto | 51 ------------------- showcase/scripts/update.sh | 4 +- showcase/scripts/verify.sh | 4 +- 5 files changed, 23 insertions(+), 80 deletions(-) delete mode 100644 showcase/gapic-showcase-extended/proto/collisions.proto diff --git a/showcase/BUILD.bazel b/showcase/BUILD.bazel index 5fb79c83a2..9c893230e0 100644 --- a/showcase/BUILD.bazel +++ b/showcase/BUILD.bazel @@ -17,7 +17,7 @@ proto_library_with_info( name = "showcase_proto_with_info", deps = [ "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_proto", - # "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", +# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", "@com_google_googleapis//google/cloud:common_resources_proto", "@com_google_googleapis//google/cloud/location:location_proto" ], @@ -27,7 +27,7 @@ java_proto_library( name = "showcase_java_proto", deps = [ "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_proto", - # "//showcase/gapic-showcase-extended/proto:showcase_proto_extended" +# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended" ], ) @@ -37,13 +37,13 @@ java_grpc_library( deps = [":showcase_java_proto"], ) -# java_grpc_library( -# name = "showcase_java_grpc_extended", -# srcs = [ -# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", -# ], -# deps = [":showcase_java_proto"], -# ) +#java_grpc_library( +# name = "showcase_java_grpc_extended", +# srcs = [ +# "//showcase/gapic-showcase-extended/proto:showcase_proto_extended", +# ], +# deps = [":showcase_java_proto"], +#) java_gapic_library( name = "showcase_java_gapic", @@ -56,7 +56,7 @@ java_gapic_library( service_yaml = "@com_google_gapic_showcase//schema/google/showcase/v1beta1:showcase_v1beta1.yaml", test_deps = [ ":showcase_java_grpc", - # ":showcase_java_grpc_extended", +# ":showcase_java_grpc_extended", "@com_google_googleapis//google/cloud/location:location_java_grpc" ], transport = "grpc+rest", @@ -121,10 +121,10 @@ sh_binary( # GRPC Showcase : Update and Verify GRPC_DATA = [ "libshowcase_java_grpc-src.jar", - # "libshowcase_java_grpc_extended-src.jar", +# "libshowcase_java_grpc_extended-src.jar", ":grpc_gapic_showcase_files", ":showcase_java_grpc", - # ":showcase_java_grpc_extended" +# ":showcase_java_grpc_extended" ] sh_binary( @@ -146,6 +146,7 @@ PROTO_DATA = [ "proto-google-cloud-showcase-v1beta1-java.tar.gz", ":proto_gapic_showcase_files", ":showcase_java_proto", +# ":showcase_java_proto_extended", ] sh_binary( diff --git a/showcase/gapic-showcase-extended/proto/BUILD.bazel b/showcase/gapic-showcase-extended/proto/BUILD.bazel index ec22f33770..bc57596d1b 100644 --- a/showcase/gapic-showcase-extended/proto/BUILD.bazel +++ b/showcase/gapic-showcase-extended/proto/BUILD.bazel @@ -16,8 +16,7 @@ Provides proto_library target Exports grpc service config """ - -load("@rules_proto//proto:defs.bzl", "proto_library") +load ("@rules_proto//proto:defs.bzl", "proto_library") # This is an API workspace, having public visibility by default makes perfect sense. package(default_visibility = ["//visibility:public"]) @@ -28,14 +27,8 @@ package(default_visibility = ["//visibility:public"]) # gapic-showcase project is used to test the generated client behavior with a showcase server # gapic-showcase-extension project is used to test the generator's behavior -# proto_library( -# name = "showcase_proto_extended", -# srcs = [ -# ":collisions.proto", -# ":wicked.proto", -# ], -# deps = [ -# "@com_google_googleapis//google/api:client_proto", -# "@com_google_googleapis//google/longrunning:operations_proto", -# ], -# ) +#proto_library( +# name = "showcase_proto_extended", +# srcs = [], +# deps = [] +#) \ No newline at end of file diff --git a/showcase/gapic-showcase-extended/proto/collisions.proto b/showcase/gapic-showcase-extended/proto/collisions.proto deleted file mode 100644 index aaf2f92f9b..0000000000 --- a/showcase/gapic-showcase-extended/proto/collisions.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2023 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. - -syntax = "proto3"; - -import "google/api/client.proto"; -import "google/longrunning/operations.proto"; - -package google.showcase.v1beta1; - -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; - -// This service exercises scenarios where short names of types -// exhibit ambiguity or collide with other types -service Collisions { - - option (google.api.default_host) = "localhost:7469"; - - rpc doSomething(Request) returns (google.longrunning.Operation) { - option (google.longrunning.operation_info) = { - response_type: "Annotation" - metadata_type: "Location" - }; - } -} - -message Request { - string name = 1; - Annotation annotation = 2; - Location location = 3; -} - -message Annotation { - string name = 1; -} - -message Location { - string name = 1; -} \ No newline at end of file diff --git a/showcase/scripts/update.sh b/showcase/scripts/update.sh index a0e6547ed5..f7b7e4ee7a 100755 --- a/showcase/scripts/update.sh +++ b/showcase/scripts/update.sh @@ -40,13 +40,13 @@ case $1 in grpc) GRPC_PROJECT_DIR=grpc-gapic-showcase-v1beta1 GRPC_JAR=$(find . -name 'libshowcase_java_grpc-src.jar') - # GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') +# GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') clear_existing $GRPC_PROJECT_DIR create_unpack_dir grpc_unpacked GRPC_UNPACK_DIR=$PWD jar xf "$BAZEL_ROOT/$GRPC_JAR" - # jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" +# jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" cd "$BUILD_WORKSPACE_DIRECTORY/showcase/$GRPC_PROJECT_DIR" mkdir -p ./src/main/java/com cp -r "$GRPC_UNPACK_DIR"/com/* ./src/main/java/com diff --git a/showcase/scripts/verify.sh b/showcase/scripts/verify.sh index b7827cb72d..80cac43cad 100755 --- a/showcase/scripts/verify.sh +++ b/showcase/scripts/verify.sh @@ -39,12 +39,12 @@ case $1 in grpc) GRPC_PROJECT_DIR=grpc-gapic-showcase-v1beta1 GRPC_JAR=$(find . -name 'libshowcase_java_grpc-src.jar') - # GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') +# GRPC_JAR_EXTENDED=$(find . -name 'libshowcase_java_grpc_extended-src.jar') create_unpack_dir grpc_unpacked GRPC_UNPACK_DIR=$PWD jar xf "$BAZEL_ROOT/$GRPC_JAR" - # jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" +# jar xf "$BAZEL_ROOT/$GRPC_JAR_EXTENDED" delete_unneeded diff -ru "$SHOWCASE_DIR/$GRPC_PROJECT_DIR"/src/main/java/com "$GRPC_UNPACK_DIR"/com ;; From ba60786f2118c687cb4b070f50a253dc09403da8 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 14 Jun 2023 12:46:20 -0400 Subject: [PATCH 17/18] test: update unit tests for lro type parsing --- .../gapic/protoparser/TypeParserTest.java | 47 +++++++++++++++---- .../src/test/proto/collisions.proto | 20 ++++++-- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java index c04ebb610b..455f04bcae 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java +++ b/gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/TypeParserTest.java @@ -21,13 +21,14 @@ import com.google.api.generator.engine.ast.Reference; import com.google.api.generator.gapic.model.LongrunningOperation; import com.google.api.generator.gapic.model.Message; +import com.google.cloud.location.LocationsProto; import com.google.protobuf.DescriptorProtos; import com.google.protobuf.Descriptors.Descriptor; import com.google.protobuf.Descriptors.FileDescriptor; import com.google.protobuf.Descriptors.MethodDescriptor; import com.google.protobuf.Descriptors.ServiceDescriptor; -import com.google.showcase.v1beta1.CollisionsOuterClass; import com.google.showcase.v1beta1.EchoOuterClass; +import com.google.test.collisions.CollisionsOuterClass; import com.google.testgapic.v1beta1.NestedMessageProto; import java.util.Map; import org.junit.Test; @@ -39,6 +40,8 @@ public class TypeParserTest { CollisionsOuterClass.getDescriptor(); private static final FileDescriptor DESCRIPTOR_PROTOS_FILE_DESCRIPTOR = DescriptorProtos.getDescriptor(); + private static final FileDescriptor LOCATION_PROTO_FILE_DESCRIPTOR = + LocationsProto.getDescriptor(); private static final ServiceDescriptor COLLISIONS_SERVICE = COLLISIONS_FILE_DESCRIPTOR.getServices().get(0); @@ -71,23 +74,26 @@ public void parseMessageType_nested() { public void parseLroResponseMetadataType_shortName_shouldMatchSamePackage() { Map messageTypes = Parser.parseMessages(COLLISIONS_FILE_DESCRIPTOR); messageTypes.putAll(Parser.parseMessages(DESCRIPTOR_PROTOS_FILE_DESCRIPTOR)); + messageTypes.putAll(Parser.parseMessages(LOCATION_PROTO_FILE_DESCRIPTOR)); MethodDescriptor shouldUseSamePackageTypesLro = COLLISIONS_SERVICE.getMethods().get(0); + assertEquals(COLLISIONS_SERVICE.getName(), "Collisions"); + assertThat(messageTypes) + .containsKey("com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation"); + assertThat(messageTypes) + .containsKey("com.google.protobuf.DescriptorProtos.SourceCodeInfo.Location"); + assertThat(messageTypes).containsKey("com.google.cloud.location.Location"); + LongrunningOperation testLro = Parser.parseLro( TypeParser.getPackage(COLLISIONS_FILE_DESCRIPTOR), shouldUseSamePackageTypesLro, messageTypes); - assertEquals(COLLISIONS_SERVICE.getName(), "Collisions"); - assertThat(messageTypes) - .containsKey("com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation"); - assertThat(messageTypes) - .containsKey("com.google.protobuf.DescriptorProtos.SourceCodeInfo.Location"); assertThat(testLro.responseType().reference().fullName()) - .isEqualTo("com.google.showcase.v1beta1.Annotation"); + .isEqualTo("com.google.test.collisions.Annotation"); assertThat(testLro.metadataType().reference().fullName()) - .isEqualTo("com.google.showcase.v1beta1.Location"); + .isEqualTo("com.google.test.collisions.Location"); } @Test @@ -99,6 +105,7 @@ public void parseLroResponseMetadataType_shortName_shouldNotMatch() { assertEquals(COLLISIONS_SERVICE.getName(), "Collisions"); assertThat(messageTypes) .containsKey("com.google.protobuf.DescriptorProtos.ExtensionRangeOptions.Declaration"); + assertThrows( NullPointerException.class, () -> @@ -107,4 +114,28 @@ public void parseLroResponseMetadataType_shortName_shouldNotMatch() { shortNameMatchShouldThrowLro, messageTypes)); } + + @Test + public void parseLroResponseMetadataType_shortName_withFullyQualifiedCollision() { + Map messageTypes = Parser.parseMessages(COLLISIONS_FILE_DESCRIPTOR); + messageTypes.putAll(Parser.parseMessages(DESCRIPTOR_PROTOS_FILE_DESCRIPTOR)); + messageTypes.putAll(Parser.parseMessages(LOCATION_PROTO_FILE_DESCRIPTOR)); + MethodDescriptor fullNameForDifferentPackageLro = COLLISIONS_SERVICE.getMethods().get(2); + + assertEquals(COLLISIONS_SERVICE.getName(), "Collisions"); + assertThat(messageTypes).containsKey("com.google.cloud.location.Location"); + assertThat(messageTypes) + .containsKey("com.google.protobuf.DescriptorProtos.SourceCodeInfo.Location"); + + LongrunningOperation testLro = + Parser.parseLro( + TypeParser.getPackage(COLLISIONS_FILE_DESCRIPTOR), + fullNameForDifferentPackageLro, + messageTypes); + + assertThat(testLro.responseType().reference().fullName()) + .isEqualTo("com.google.cloud.location.Location"); + assertThat(testLro.metadataType().reference().fullName()) + .isEqualTo("com.google.test.collisions.Location"); + } } diff --git a/gapic-generator-java/src/test/proto/collisions.proto b/gapic-generator-java/src/test/proto/collisions.proto index 55c3b92a2e..03c1060d8e 100644 --- a/gapic-generator-java/src/test/proto/collisions.proto +++ b/gapic-generator-java/src/test/proto/collisions.proto @@ -19,7 +19,7 @@ import "google/longrunning/operations.proto"; package google.showcase.v1beta1; -option java_package = "com.google.showcase.v1beta1"; +option java_package = "com.google.test.collisions"; option java_multiple_files = true; // This service exercises scenarios where short names of types @@ -30,21 +30,31 @@ service Collisions { rpc shouldUseSamePackageTypesLro(Request) returns (google.longrunning.Operation) { option (google.longrunning.operation_info) = { - // collision with com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation + // collision with google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation response_type: "Annotation" - // collision with com.google.cloud.location.Location; + // collision with google.cloud.location.Location; metadata_type: "Location" }; } rpc shortNameMatchShouldThrowLro(Request) returns (google.longrunning.Operation) { option (google.longrunning.operation_info) = { - // collision with com.google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation + // collision with google.protobuf.DescriptorProtos.GeneratedCodeInfo.Annotation response_type: "Annotation" - // collision with com.google.protobuf.DescriptorProtos.ExtensionRangeOptions.Declaration + // collision with google.protobuf.DescriptorProtos.ExtensionRangeOptions.Declaration + // not a valid short name specification (no such type exist in same package) metadata_type: "Declaration" }; } + + rpc fullNameForDifferentPackageLro(Request) returns (google.longrunning.Operation) { + option (google.longrunning.operation_info) = { + // fully qualified name should match google.cloud.location.Location + response_type: "google.cloud.location.Location" + // short name only should match Location message defined below + metadata_type: "Location" + }; + } } message Request { From ba1d1afbb493c0d001e159f879c4dedab1aeb621 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Wed, 14 Jun 2023 12:57:38 -0400 Subject: [PATCH 18/18] test: update unit tests for writer import collision fix --- .../engine/writer/JavaWriterVisitorTest.java | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java b/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java index 64a36809f5..578e0d661f 100644 --- a/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java +++ b/gapic-generator-java/src/test/java/com/google/api/generator/engine/writer/JavaWriterVisitorTest.java @@ -2398,43 +2398,31 @@ public void writeClassDefinition_commentsStatementsAndMethods() { @Test public void writeClassDefinition_withImportCollision() { - VaporReference firstLocationType = + VaporReference firstType = VaporReference.builder() - .setName("Location") - .setPakkage("com.google.cloud.location") + .setName("Service") + .setPakkage("com.google.api.generator.gapic.model") .build(); - VaporReference secondLocationType = - VaporReference.builder().setName("Location").setPakkage("com.sun.jdi").build(); + VaporReference secondType = + VaporReference.builder().setName("Service").setPakkage("com.google.api").build(); - Variable secondLocationVar = + Variable secondTypeVar = Variable.builder() - .setName("anotherLocationVar") - .setType(TypeNode.withReference(secondLocationType)) + .setName("anotherServiceVar") + .setType(TypeNode.withReference(secondType)) .build(); MethodInvocationExpr genericMethodInvocation = MethodInvocationExpr.builder() - .setMethodName("bar") - .setStaticReferenceType(TypeNode.withReference(firstLocationType)) - .setGenerics(Arrays.asList(secondLocationType)) - .setArguments(VariableExpr.withVariable(secondLocationVar)) + .setMethodName("barMethod") + .setStaticReferenceType(TypeNode.withReference(firstType)) + .setGenerics(Arrays.asList(secondType)) + .setArguments(VariableExpr.withVariable(secondTypeVar)) .setReturnType(TypeNode.STRING) .build(); - VariableExpr varExpr = - VariableExpr.builder() - .setVariable(Variable.builder().setName("result").setType(TypeNode.STRING).build()) - .setIsDecl(true) - .build(); - - AssignmentExpr assignmentExpr = - AssignmentExpr.builder() - .setVariableExpr(varExpr) - .setValueExpr(genericMethodInvocation) - .build(); - - List statements = Arrays.asList(ExprStatement.withExpr(assignmentExpr)); + List statements = Arrays.asList(ExprStatement.withExpr(genericMethodInvocation)); MethodDefinition methodOne = MethodDefinition.builder() @@ -2448,7 +2436,7 @@ public void writeClassDefinition_withImportCollision() { ClassDefinition classDef = ClassDefinition.builder() - .setPackageString("com.google.example.library.v1.stub") + .setPackageString("com.google.example") .setName("FooService") .setScope(ScopeNode.PUBLIC) .setMethods(methods) @@ -2458,14 +2446,14 @@ public void writeClassDefinition_withImportCollision() { String expected = LineFormatter.lines( - "package com.google.example.library.v1.stub;\n" + "package com.google.example;\n" + "\n" - + "import com.google.cloud.location.Location;\n" + + "import com.google.api.generator.gapic.model.Service;\n" + "\n" + "public class FooService {\n" + "\n" + " private void doSomething() {\n" - + " String result = Location.bar(anotherLocationVar);\n" + + " Service.barMethod(anotherServiceVar);\n" + " }\n" + "}\n");