-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test(generator): rename test service and proto to MediaService and add GetMediaMetadata method #14440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
test(generator): rename test service and proto to MediaService and add GetMediaMetadata method #14440
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
...est/java/com/google/api/generator/gapic/composer/grpc/goldens/GrpcMediaServiceStub.golden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| package com.google.showcase.v1beta1.stub; | ||
|
|
||
| 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.ResumableUploadCallable; | ||
| import com.google.api.gax.rpc.UnaryCallable; | ||
| import com.google.common.collect.ImmutableList; | ||
| import com.google.longrunning.stub.GrpcOperationsStub; | ||
| import com.google.showcase.v1beta1.GetMediaMetadataRequest; | ||
| import com.google.showcase.v1beta1.GetMediaMetadataResponse; | ||
| import com.google.showcase.v1beta1.UploadMediaRequest; | ||
| import com.google.showcase.v1beta1.UploadMediaResponse; | ||
| import io.grpc.MethodDescriptor; | ||
| import io.grpc.protobuf.ProtoUtils; | ||
| import java.io.IOException; | ||
| import java.util.concurrent.TimeUnit; | ||
| import javax.annotation.Generated; | ||
| import org.jspecify.annotations.NullMarked; | ||
|
|
||
| // AUTO-GENERATED DOCUMENTATION AND CLASS. | ||
| /** | ||
| * gRPC stub implementation for the MediaService service API. | ||
| * | ||
| * <p>This class is for advanced usage and reflects the underlying API directly. | ||
| */ | ||
| @NullMarked | ||
| @BetaApi | ||
| @Generated("by gapic-generator-java") | ||
| public class GrpcMediaServiceStub extends MediaServiceStub { | ||
| private static final MethodDescriptor<GetMediaMetadataRequest, GetMediaMetadataResponse> | ||
| getMediaMetadataMethodDescriptor = | ||
| MethodDescriptor.<GetMediaMetadataRequest, GetMediaMetadataResponse>newBuilder() | ||
| .setType(MethodDescriptor.MethodType.UNARY) | ||
| .setFullMethodName("google.showcase.v1beta1.MediaService/GetMediaMetadata") | ||
| .setRequestMarshaller( | ||
| ProtoUtils.marshaller(GetMediaMetadataRequest.getDefaultInstance())) | ||
| .setResponseMarshaller( | ||
| ProtoUtils.marshaller(GetMediaMetadataResponse.getDefaultInstance())) | ||
| .setSampledToLocalTracing(true) | ||
| .build(); | ||
|
|
||
| private final UnaryCallable<GetMediaMetadataRequest, GetMediaMetadataResponse> | ||
| getMediaMetadataCallable; | ||
|
|
||
| private final BackgroundResource backgroundResources; | ||
| private final GrpcOperationsStub operationsStub; | ||
| private final HttpJsonMediaServiceResumableUploadStub resumableUploadStub; | ||
| private final GrpcStubCallableFactory callableFactory; | ||
|
|
||
| public static final GrpcMediaServiceStub create(MediaServiceStubSettings settings) | ||
| throws IOException { | ||
| return new GrpcMediaServiceStub(settings, ClientContext.create(settings)); | ||
| } | ||
|
|
||
| public static final GrpcMediaServiceStub create(ClientContext clientContext) throws IOException { | ||
| return new GrpcMediaServiceStub(MediaServiceStubSettings.newBuilder().build(), clientContext); | ||
| } | ||
|
|
||
| public static final GrpcMediaServiceStub create( | ||
| ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { | ||
| return new GrpcMediaServiceStub( | ||
| MediaServiceStubSettings.newBuilder().build(), clientContext, callableFactory); | ||
| } | ||
|
|
||
| /** | ||
| * Constructs an instance of GrpcMediaServiceStub, 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 GrpcMediaServiceStub(MediaServiceStubSettings settings, ClientContext clientContext) | ||
| throws IOException { | ||
| this(settings, clientContext, new GrpcMediaServiceCallableFactory()); | ||
| } | ||
|
|
||
| /** | ||
| * Constructs an instance of GrpcMediaServiceStub, 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 GrpcMediaServiceStub( | ||
| MediaServiceStubSettings settings, | ||
| ClientContext clientContext, | ||
| GrpcStubCallableFactory callableFactory) | ||
| throws IOException { | ||
| this.callableFactory = callableFactory; | ||
| this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); | ||
|
|
||
| GrpcCallSettings<GetMediaMetadataRequest, GetMediaMetadataResponse> | ||
| getMediaMetadataTransportSettings = | ||
| GrpcCallSettings.<GetMediaMetadataRequest, GetMediaMetadataResponse>newBuilder() | ||
| .setMethodDescriptor(getMediaMetadataMethodDescriptor) | ||
| .build(); | ||
|
|
||
| this.getMediaMetadataCallable = | ||
| callableFactory.createUnaryCallable( | ||
| getMediaMetadataTransportSettings, settings.getMediaMetadataSettings(), clientContext); | ||
|
|
||
| this.resumableUploadStub = HttpJsonMediaServiceResumableUploadStub.create(settings); | ||
|
|
||
| this.backgroundResources = | ||
| new BackgroundResourceAggregation( | ||
| ImmutableList.<BackgroundResource>builder() | ||
| .addAll(clientContext.getBackgroundResources()) | ||
| .add(resumableUploadStub) | ||
| .build()); | ||
| } | ||
|
|
||
| public GrpcOperationsStub getOperationsStub() { | ||
| return operationsStub; | ||
| } | ||
|
|
||
| @Override | ||
| public UnaryCallable<GetMediaMetadataRequest, GetMediaMetadataResponse> | ||
| getMediaMetadataCallable() { | ||
| return getMediaMetadataCallable; | ||
| } | ||
|
|
||
| @Override | ||
| public ResumableUploadCallable<UploadMediaRequest, UploadMediaResponse> uploadMediaCallable() { | ||
| return resumableUploadStub.uploadMediaCallable(); | ||
| } | ||
|
|
||
| @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); | ||
| } | ||
| } |
128 changes: 0 additions & 128 deletions
128
...om/google/api/generator/gapic/composer/grpc/goldens/GrpcResumableUploadServiceStub.golden
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Add a comment that this is for unit tests only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.