mirror of https://github.com/grpc/grpc-java.git
660 lines
31 KiB
Plaintext
660 lines
31 KiB
Plaintext
package io.grpc.testing.compiler;
|
|
|
|
import static io.grpc.MethodDescriptor.generateFullMethodName;
|
|
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
|
|
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
|
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
|
|
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
|
|
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
|
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
|
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
|
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
|
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
|
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
|
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
|
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|
|
|
/**
|
|
* <pre>
|
|
* Test service that supports all call types.
|
|
* </pre>
|
|
*/
|
|
@javax.annotation.Generated(
|
|
value = "by gRPC proto compiler (version 1.25.0-SNAPSHOT)",
|
|
comments = "Source: grpc/testing/compiler/test.proto")
|
|
public final class TestServiceGrpc {
|
|
|
|
private TestServiceGrpc() {}
|
|
|
|
public static final String SERVICE_NAME = "grpc.testing.compiler.TestService";
|
|
|
|
// Static method descriptors that strictly reflect the proto.
|
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
|
|
io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod;
|
|
|
|
@io.grpc.stub.annotations.RpcMethod(
|
|
fullMethodName = SERVICE_NAME + '/' + "UnaryCall",
|
|
requestType = io.grpc.testing.compiler.Test.SimpleRequest.class,
|
|
responseType = io.grpc.testing.compiler.Test.SimpleResponse.class,
|
|
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
|
public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
|
|
io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod() {
|
|
io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod;
|
|
if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
|
|
synchronized (TestServiceGrpc.class) {
|
|
if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
|
|
TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
|
|
io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse>newBuilder()
|
|
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryCall"))
|
|
.setSampledToLocalTracing(true)
|
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.SimpleRequest.getDefaultInstance()))
|
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.SimpleResponse.getDefaultInstance()))
|
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("UnaryCall"))
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return getUnaryCallMethod;
|
|
}
|
|
|
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
|
|
|
|
@io.grpc.stub.annotations.RpcMethod(
|
|
fullMethodName = SERVICE_NAME + '/' + "StreamingOutputCall",
|
|
requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
|
|
responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
|
|
methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
|
|
public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
|
|
io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
|
|
if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
|
|
synchronized (TestServiceGrpc.class) {
|
|
if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
|
|
TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
|
|
io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
|
|
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
|
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingOutputCall"))
|
|
.setSampledToLocalTracing(true)
|
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
|
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
|
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("StreamingOutputCall"))
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return getStreamingOutputCallMethod;
|
|
}
|
|
|
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
|
|
|
|
@io.grpc.stub.annotations.RpcMethod(
|
|
fullMethodName = SERVICE_NAME + '/' + "StreamingInputCall",
|
|
requestType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class,
|
|
responseType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class,
|
|
methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
|
|
public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
|
|
io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
|
|
if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
|
|
synchronized (TestServiceGrpc.class) {
|
|
if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
|
|
TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
|
|
io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>newBuilder()
|
|
.setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
|
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingInputCall"))
|
|
.setSampledToLocalTracing(true)
|
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingInputCallRequest.getDefaultInstance()))
|
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse.getDefaultInstance()))
|
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("StreamingInputCall"))
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return getStreamingInputCallMethod;
|
|
}
|
|
|
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
|
|
|
|
@io.grpc.stub.annotations.RpcMethod(
|
|
fullMethodName = SERVICE_NAME + '/' + "FullBidiCall",
|
|
requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
|
|
responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
|
|
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
|
public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
|
|
io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
|
|
if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
|
|
synchronized (TestServiceGrpc.class) {
|
|
if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
|
|
TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod =
|
|
io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
|
|
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "FullBidiCall"))
|
|
.setSampledToLocalTracing(true)
|
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
|
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
|
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("FullBidiCall"))
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return getFullBidiCallMethod;
|
|
}
|
|
|
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
|
|
|
|
@io.grpc.stub.annotations.RpcMethod(
|
|
fullMethodName = SERVICE_NAME + '/' + "HalfBidiCall",
|
|
requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
|
|
responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
|
|
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
|
public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
|
|
io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
|
|
if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
|
|
synchronized (TestServiceGrpc.class) {
|
|
if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
|
|
TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod =
|
|
io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
|
|
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "HalfBidiCall"))
|
|
.setSampledToLocalTracing(true)
|
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
|
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
|
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("HalfBidiCall"))
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return getHalfBidiCallMethod;
|
|
}
|
|
|
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod;
|
|
|
|
@io.grpc.stub.annotations.RpcMethod(
|
|
fullMethodName = SERVICE_NAME + '/' + "Import",
|
|
requestType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class,
|
|
responseType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class,
|
|
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
|
public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod() {
|
|
io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod;
|
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
|
synchronized (TestServiceGrpc.class) {
|
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
|
TestServiceGrpc.getImportMethod = getImportMethod =
|
|
io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>newBuilder()
|
|
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Import"))
|
|
.setSampledToLocalTracing(true)
|
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingInputCallRequest.getDefaultInstance()))
|
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse.getDefaultInstance()))
|
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("Import"))
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return getImportMethod;
|
|
}
|
|
|
|
/**
|
|
* Creates a new async stub that supports all call types for the service
|
|
*/
|
|
public static TestServiceStub newStub(io.grpc.Channel channel) {
|
|
return new TestServiceStub(channel);
|
|
}
|
|
|
|
/**
|
|
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
|
*/
|
|
public static TestServiceBlockingStub newBlockingStub(
|
|
io.grpc.Channel channel) {
|
|
return new TestServiceBlockingStub(channel);
|
|
}
|
|
|
|
/**
|
|
* Creates a new ListenableFuture-style stub that supports unary calls on the service
|
|
*/
|
|
public static TestServiceFutureStub newFutureStub(
|
|
io.grpc.Channel channel) {
|
|
return new TestServiceFutureStub(channel);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* Test service that supports all call types.
|
|
* </pre>
|
|
*/
|
|
public static abstract class TestServiceImplBase implements io.grpc.BindableService {
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by one response.
|
|
* The server returns the client payload as-is.
|
|
* </pre>
|
|
*/
|
|
public void unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request,
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
|
|
asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by a sequence of responses (streamed download).
|
|
* The server returns the payload with client desired type and sizes.
|
|
* </pre>
|
|
*/
|
|
public void streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request,
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
|
|
asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* A sequence of requests followed by one response (streamed upload).
|
|
* The server returns the aggregated size of client payload as the result.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> streamingInputCall(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
|
|
return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* A sequence of requests with each request served by the server immediately.
|
|
* As one request could lead to multiple responses, this interface
|
|
* demonstrates the idea of full bidirectionality.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> fullBidiCall(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
|
|
return asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* A sequence of requests followed by a sequence of responses.
|
|
* The server buffers all the client requests and then serves them in order. A
|
|
* stream of responses are returned to the client when the server starts with
|
|
* first request.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> halfBidiCall(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
|
|
return asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
|
* method should have a '_' appended.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> import_(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
|
|
return asyncUnimplementedStreamingCall(getImportMethod(), responseObserver);
|
|
}
|
|
|
|
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
|
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
|
.addMethod(
|
|
getUnaryCallMethod(),
|
|
asyncUnaryCall(
|
|
new MethodHandlers<
|
|
io.grpc.testing.compiler.Test.SimpleRequest,
|
|
io.grpc.testing.compiler.Test.SimpleResponse>(
|
|
this, METHODID_UNARY_CALL)))
|
|
.addMethod(
|
|
getStreamingOutputCallMethod(),
|
|
asyncServerStreamingCall(
|
|
new MethodHandlers<
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
|
|
this, METHODID_STREAMING_OUTPUT_CALL)))
|
|
.addMethod(
|
|
getStreamingInputCallMethod(),
|
|
asyncClientStreamingCall(
|
|
new MethodHandlers<
|
|
io.grpc.testing.compiler.Test.StreamingInputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse>(
|
|
this, METHODID_STREAMING_INPUT_CALL)))
|
|
.addMethod(
|
|
getFullBidiCallMethod(),
|
|
asyncBidiStreamingCall(
|
|
new MethodHandlers<
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
|
|
this, METHODID_FULL_BIDI_CALL)))
|
|
.addMethod(
|
|
getHalfBidiCallMethod(),
|
|
asyncBidiStreamingCall(
|
|
new MethodHandlers<
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
|
|
this, METHODID_HALF_BIDI_CALL)))
|
|
.addMethod(
|
|
getImportMethod(),
|
|
asyncBidiStreamingCall(
|
|
new MethodHandlers<
|
|
io.grpc.testing.compiler.Test.StreamingInputCallRequest,
|
|
io.grpc.testing.compiler.Test.StreamingInputCallResponse>(
|
|
this, METHODID_IMPORT)))
|
|
.build();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* Test service that supports all call types.
|
|
* </pre>
|
|
*/
|
|
public static final class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> {
|
|
private TestServiceStub(io.grpc.Channel channel) {
|
|
super(channel);
|
|
}
|
|
|
|
private TestServiceStub(io.grpc.Channel channel,
|
|
io.grpc.CallOptions callOptions) {
|
|
super(channel, callOptions);
|
|
}
|
|
|
|
@java.lang.Override
|
|
protected TestServiceStub build(io.grpc.Channel channel,
|
|
io.grpc.CallOptions callOptions) {
|
|
return new TestServiceStub(channel, callOptions);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by one response.
|
|
* The server returns the client payload as-is.
|
|
* </pre>
|
|
*/
|
|
public void unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request,
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
|
|
asyncUnaryCall(
|
|
getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by a sequence of responses (streamed download).
|
|
* The server returns the payload with client desired type and sizes.
|
|
* </pre>
|
|
*/
|
|
public void streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request,
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
|
|
asyncServerStreamingCall(
|
|
getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* A sequence of requests followed by one response (streamed upload).
|
|
* The server returns the aggregated size of client payload as the result.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> streamingInputCall(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
|
|
return asyncClientStreamingCall(
|
|
getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* A sequence of requests with each request served by the server immediately.
|
|
* As one request could lead to multiple responses, this interface
|
|
* demonstrates the idea of full bidirectionality.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> fullBidiCall(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
|
|
return asyncBidiStreamingCall(
|
|
getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* A sequence of requests followed by a sequence of responses.
|
|
* The server buffers all the client requests and then serves them in order. A
|
|
* stream of responses are returned to the client when the server starts with
|
|
* first request.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> halfBidiCall(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
|
|
return asyncBidiStreamingCall(
|
|
getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
|
* method should have a '_' appended.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> import_(
|
|
io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
|
|
return asyncBidiStreamingCall(
|
|
getChannel().newCall(getImportMethod(), getCallOptions()), responseObserver);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* Test service that supports all call types.
|
|
* </pre>
|
|
*/
|
|
public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> {
|
|
private TestServiceBlockingStub(io.grpc.Channel channel) {
|
|
super(channel);
|
|
}
|
|
|
|
private TestServiceBlockingStub(io.grpc.Channel channel,
|
|
io.grpc.CallOptions callOptions) {
|
|
super(channel, callOptions);
|
|
}
|
|
|
|
@java.lang.Override
|
|
protected TestServiceBlockingStub build(io.grpc.Channel channel,
|
|
io.grpc.CallOptions callOptions) {
|
|
return new TestServiceBlockingStub(channel, callOptions);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by one response.
|
|
* The server returns the client payload as-is.
|
|
* </pre>
|
|
*/
|
|
public io.grpc.testing.compiler.Test.SimpleResponse unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
|
|
return blockingUnaryCall(
|
|
getChannel(), getUnaryCallMethod(), getCallOptions(), request);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by a sequence of responses (streamed download).
|
|
* The server returns the payload with client desired type and sizes.
|
|
* </pre>
|
|
*/
|
|
public java.util.Iterator<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> streamingOutputCall(
|
|
io.grpc.testing.compiler.Test.StreamingOutputCallRequest request) {
|
|
return blockingServerStreamingCall(
|
|
getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* Test service that supports all call types.
|
|
* </pre>
|
|
*/
|
|
public static final class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> {
|
|
private TestServiceFutureStub(io.grpc.Channel channel) {
|
|
super(channel);
|
|
}
|
|
|
|
private TestServiceFutureStub(io.grpc.Channel channel,
|
|
io.grpc.CallOptions callOptions) {
|
|
super(channel, callOptions);
|
|
}
|
|
|
|
@java.lang.Override
|
|
protected TestServiceFutureStub build(io.grpc.Channel channel,
|
|
io.grpc.CallOptions callOptions) {
|
|
return new TestServiceFutureStub(channel, callOptions);
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* One request followed by one response.
|
|
* The server returns the client payload as-is.
|
|
* </pre>
|
|
*/
|
|
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.Test.SimpleResponse> unaryCall(
|
|
io.grpc.testing.compiler.Test.SimpleRequest request) {
|
|
return futureUnaryCall(
|
|
getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
|
|
}
|
|
}
|
|
|
|
private static final int METHODID_UNARY_CALL = 0;
|
|
private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
|
|
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
|
private static final int METHODID_FULL_BIDI_CALL = 3;
|
|
private static final int METHODID_HALF_BIDI_CALL = 4;
|
|
private static final int METHODID_IMPORT = 5;
|
|
|
|
private static final class MethodHandlers<Req, Resp> implements
|
|
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
|
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
|
|
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
|
|
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
|
|
private final TestServiceImplBase serviceImpl;
|
|
private final int methodId;
|
|
|
|
MethodHandlers(TestServiceImplBase 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<Resp> responseObserver) {
|
|
switch (methodId) {
|
|
case METHODID_UNARY_CALL:
|
|
serviceImpl.unaryCall((io.grpc.testing.compiler.Test.SimpleRequest) request,
|
|
(io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse>) responseObserver);
|
|
break;
|
|
case METHODID_STREAMING_OUTPUT_CALL:
|
|
serviceImpl.streamingOutputCall((io.grpc.testing.compiler.Test.StreamingOutputCallRequest) request,
|
|
(io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
|
|
break;
|
|
default:
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
|
|
@java.lang.Override
|
|
@java.lang.SuppressWarnings("unchecked")
|
|
public io.grpc.stub.StreamObserver<Req> invoke(
|
|
io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
|
switch (methodId) {
|
|
case METHODID_STREAMING_INPUT_CALL:
|
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
|
|
(io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse>) responseObserver);
|
|
case METHODID_FULL_BIDI_CALL:
|
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
|
|
(io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
|
|
case METHODID_HALF_BIDI_CALL:
|
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
|
(io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
|
|
case METHODID_IMPORT:
|
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
|
|
(io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse>) responseObserver);
|
|
default:
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
}
|
|
|
|
private static abstract class TestServiceBaseDescriptorSupplier
|
|
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
|
|
TestServiceBaseDescriptorSupplier() {}
|
|
|
|
@java.lang.Override
|
|
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
|
|
return io.grpc.testing.compiler.Test.getDescriptor();
|
|
}
|
|
|
|
@java.lang.Override
|
|
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
|
|
return getFileDescriptor().findServiceByName("TestService");
|
|
}
|
|
}
|
|
|
|
private static final class TestServiceFileDescriptorSupplier
|
|
extends TestServiceBaseDescriptorSupplier {
|
|
TestServiceFileDescriptorSupplier() {}
|
|
}
|
|
|
|
private static final class TestServiceMethodDescriptorSupplier
|
|
extends TestServiceBaseDescriptorSupplier
|
|
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
|
|
private final String methodName;
|
|
|
|
TestServiceMethodDescriptorSupplier(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 (TestServiceGrpc.class) {
|
|
result = serviceDescriptor;
|
|
if (result == null) {
|
|
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
|
|
.setSchemaDescriptor(new TestServiceFileDescriptorSupplier())
|
|
.addMethod(getUnaryCallMethod())
|
|
.addMethod(getStreamingOutputCallMethod())
|
|
.addMethod(getStreamingInputCallMethod())
|
|
.addMethod(getFullBidiCallMethod())
|
|
.addMethod(getHalfBidiCallMethod())
|
|
.addMethod(getImportMethod())
|
|
.build();
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|