blob: 996c5d35d7727f93543ce3313eab0e2ec6023edc [file] [log] [blame]
Eric Andersonb22bcdf2016-03-29 14:13:28 -07001package io.grpc.testing.integration;
Eric Anderson99a6d8d2016-03-22 11:31:36 -07002
3import static io.grpc.stub.ClientCalls.asyncUnaryCall;
4import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
5import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
7import static io.grpc.stub.ClientCalls.blockingUnaryCall;
8import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9import static io.grpc.stub.ClientCalls.futureUnaryCall;
10import static io.grpc.MethodDescriptor.generateFullMethodName;
11import static io.grpc.stub.ServerCalls.asyncUnaryCall;
12import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
13import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
14import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +020015import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
16import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
Eric Anderson99a6d8d2016-03-22 11:31:36 -070017
nmittler7e8b5042016-04-15 12:52:00 -070018/**
19 * <pre>
20 * Test service that supports all call types.
21 * </pre>
22 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -070023@javax.annotation.Generated(
Eric Andersone9643bb2016-07-11 16:57:58 -070024 value = "by gRPC proto compiler (version 1.1.0-SNAPSHOT)",
Eric Andersonb22bcdf2016-03-29 14:13:28 -070025 comments = "Source: test.proto")
Eric Anderson99a6d8d2016-03-22 11:31:36 -070026public class TestServiceGrpc {
27
28 private TestServiceGrpc() {}
29
Eric Andersonb22bcdf2016-03-29 14:13:28 -070030 public static final String SERVICE_NAME = "grpc.testing.TestService";
Eric Anderson99a6d8d2016-03-22 11:31:36 -070031
32 // Static method descriptors that strictly reflect the proto.
Eric Anderson7c722e42016-06-07 15:00:29 -070033 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Eric Andersonb22bcdf2016-03-29 14:13:28 -070034 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
35 io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070036 io.grpc.MethodDescriptor.create(
37 io.grpc.MethodDescriptor.MethodType.UNARY,
38 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070039 "grpc.testing.TestService", "UnaryCall"),
40 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()),
41 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance()));
Eric Anderson7c722e42016-06-07 15:00:29 -070042 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Eric Andersonb22bcdf2016-03-29 14:13:28 -070043 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
44 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070045 io.grpc.MethodDescriptor.create(
46 io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
47 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070048 "grpc.testing.TestService", "StreamingOutputCall"),
49 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
50 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
Eric Anderson7c722e42016-06-07 15:00:29 -070051 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Eric Andersonb22bcdf2016-03-29 14:13:28 -070052 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
53 io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070054 io.grpc.MethodDescriptor.create(
55 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
56 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070057 "grpc.testing.TestService", "StreamingInputCall"),
58 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()),
59 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()));
Eric Anderson7c722e42016-06-07 15:00:29 -070060 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Eric Andersonb22bcdf2016-03-29 14:13:28 -070061 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
62 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070063 io.grpc.MethodDescriptor.create(
64 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
65 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070066 "grpc.testing.TestService", "FullBidiCall"),
67 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
68 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
Eric Anderson7c722e42016-06-07 15:00:29 -070069 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Eric Andersonb22bcdf2016-03-29 14:13:28 -070070 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
71 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070072 io.grpc.MethodDescriptor.create(
73 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
74 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070075 "grpc.testing.TestService", "HalfBidiCall"),
76 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
77 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
Eric Anderson99a6d8d2016-03-22 11:31:36 -070078
nmittler7e8b5042016-04-15 12:52:00 -070079 /**
80 * Creates a new async stub that supports all call types for the service
81 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -070082 public static TestServiceStub newStub(io.grpc.Channel channel) {
83 return new TestServiceStub(channel);
84 }
85
nmittler7e8b5042016-04-15 12:52:00 -070086 /**
87 * Creates a new blocking-style stub that supports unary and streaming output calls on the service
88 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -070089 public static TestServiceBlockingStub newBlockingStub(
90 io.grpc.Channel channel) {
91 return new TestServiceBlockingStub(channel);
92 }
93
nmittler7e8b5042016-04-15 12:52:00 -070094 /**
95 * Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
96 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -070097 public static TestServiceFutureStub newFutureStub(
98 io.grpc.Channel channel) {
99 return new TestServiceFutureStub(channel);
100 }
101
nmittler7e8b5042016-04-15 12:52:00 -0700102 /**
103 * <pre>
104 * Test service that supports all call types.
105 * </pre>
106 */
ZHANG Dapeng8f5adf82016-07-22 16:35:00 -0700107 public static abstract class TestServiceImplBase implements io.grpc.BindableService {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700108
nmittler7e8b5042016-04-15 12:52:00 -0700109 /**
110 * <pre>
111 * One request followed by one response.
112 * The server returns the client payload as-is.
113 * </pre>
114 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700115 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
ZHANG Dapenge1091252016-07-21 16:35:18 -0700116 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
117 asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
118 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700119
nmittler7e8b5042016-04-15 12:52:00 -0700120 /**
121 * <pre>
122 * One request followed by a sequence of responses (streamed download).
123 * The server returns the payload with client desired type and sizes.
124 * </pre>
125 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700126 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
ZHANG Dapenge1091252016-07-21 16:35:18 -0700127 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
128 asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
129 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700130
nmittler7e8b5042016-04-15 12:52:00 -0700131 /**
132 * <pre>
133 * A sequence of requests followed by one response (streamed upload).
134 * The server returns the aggregated size of client payload as the result.
135 * </pre>
136 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700137 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
ZHANG Dapenge1091252016-07-21 16:35:18 -0700138 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
139 return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
140 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700141
nmittler7e8b5042016-04-15 12:52:00 -0700142 /**
143 * <pre>
144 * A sequence of requests with each request served by the server immediately.
145 * As one request could lead to multiple responses, this interface
146 * demonstrates the idea of full bidirectionality.
147 * </pre>
148 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700149 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
ZHANG Dapenge1091252016-07-21 16:35:18 -0700150 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
151 return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
152 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700153
nmittler7e8b5042016-04-15 12:52:00 -0700154 /**
155 * <pre>
156 * A sequence of requests followed by a sequence of responses.
157 * The server buffers all the client requests and then serves them in order. A
158 * stream of responses are returned to the client when the server starts with
159 * first request.
160 * </pre>
161 */
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200162 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
163 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
164 return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
165 }
166
167 @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
ZHANG Dapenge1091252016-07-21 16:35:18 -0700168 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
169 .addMethod(
170 METHOD_UNARY_CALL,
171 asyncUnaryCall(
172 new MethodHandlers<
173 io.grpc.testing.integration.Test.SimpleRequest,
174 io.grpc.testing.integration.Test.SimpleResponse>(
175 this, METHODID_UNARY_CALL)))
176 .addMethod(
177 METHOD_STREAMING_OUTPUT_CALL,
178 asyncServerStreamingCall(
179 new MethodHandlers<
180 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
181 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
182 this, METHODID_STREAMING_OUTPUT_CALL)))
183 .addMethod(
184 METHOD_STREAMING_INPUT_CALL,
185 asyncClientStreamingCall(
186 new MethodHandlers<
187 io.grpc.testing.integration.Test.StreamingInputCallRequest,
188 io.grpc.testing.integration.Test.StreamingInputCallResponse>(
189 this, METHODID_STREAMING_INPUT_CALL)))
190 .addMethod(
191 METHOD_FULL_BIDI_CALL,
192 asyncBidiStreamingCall(
193 new MethodHandlers<
194 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
195 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
196 this, METHODID_FULL_BIDI_CALL)))
197 .addMethod(
198 METHOD_HALF_BIDI_CALL,
199 asyncBidiStreamingCall(
200 new MethodHandlers<
201 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
202 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
203 this, METHODID_HALF_BIDI_CALL)))
204 .build();
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200205 }
206 }
207
nmittler7e8b5042016-04-15 12:52:00 -0700208 /**
209 * <pre>
210 * Test service that supports all call types.
211 * </pre>
212 */
ZHANG Dapeng8f5adf82016-07-22 16:35:00 -0700213 public static final class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700214 private TestServiceStub(io.grpc.Channel channel) {
215 super(channel);
216 }
217
218 private TestServiceStub(io.grpc.Channel channel,
219 io.grpc.CallOptions callOptions) {
220 super(channel, callOptions);
221 }
222
223 @java.lang.Override
224 protected TestServiceStub build(io.grpc.Channel channel,
225 io.grpc.CallOptions callOptions) {
226 return new TestServiceStub(channel, callOptions);
227 }
228
ZHANG Dapenge1091252016-07-21 16:35:18 -0700229 /**
230 * <pre>
231 * One request followed by one response.
232 * The server returns the client payload as-is.
233 * </pre>
234 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700235 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
236 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700237 asyncUnaryCall(
238 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
239 }
240
ZHANG Dapenge1091252016-07-21 16:35:18 -0700241 /**
242 * <pre>
243 * One request followed by a sequence of responses (streamed download).
244 * The server returns the payload with client desired type and sizes.
245 * </pre>
246 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700247 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
248 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700249 asyncServerStreamingCall(
250 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
251 }
252
ZHANG Dapenge1091252016-07-21 16:35:18 -0700253 /**
254 * <pre>
255 * A sequence of requests followed by one response (streamed upload).
256 * The server returns the aggregated size of client payload as the result.
257 * </pre>
258 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700259 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
260 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700261 return asyncClientStreamingCall(
262 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
263 }
264
ZHANG Dapenge1091252016-07-21 16:35:18 -0700265 /**
266 * <pre>
267 * A sequence of requests with each request served by the server immediately.
268 * As one request could lead to multiple responses, this interface
269 * demonstrates the idea of full bidirectionality.
270 * </pre>
271 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700272 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
273 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700274 return asyncBidiStreamingCall(
275 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
276 }
277
ZHANG Dapenge1091252016-07-21 16:35:18 -0700278 /**
279 * <pre>
280 * A sequence of requests followed by a sequence of responses.
281 * The server buffers all the client requests and then serves them in order. A
282 * stream of responses are returned to the client when the server starts with
283 * first request.
284 * </pre>
285 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700286 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
287 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700288 return asyncBidiStreamingCall(
289 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
290 }
291 }
292
ZHANG Dapenge1091252016-07-21 16:35:18 -0700293 /**
294 * <pre>
295 * Test service that supports all call types.
296 * </pre>
297 */
ZHANG Dapeng8f5adf82016-07-22 16:35:00 -0700298 public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700299 private TestServiceBlockingStub(io.grpc.Channel channel) {
300 super(channel);
301 }
302
303 private TestServiceBlockingStub(io.grpc.Channel channel,
304 io.grpc.CallOptions callOptions) {
305 super(channel, callOptions);
306 }
307
308 @java.lang.Override
309 protected TestServiceBlockingStub build(io.grpc.Channel channel,
310 io.grpc.CallOptions callOptions) {
311 return new TestServiceBlockingStub(channel, callOptions);
312 }
313
ZHANG Dapenge1091252016-07-21 16:35:18 -0700314 /**
315 * <pre>
316 * One request followed by one response.
317 * The server returns the client payload as-is.
318 * </pre>
319 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700320 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700321 return blockingUnaryCall(
322 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
323 }
324
ZHANG Dapenge1091252016-07-21 16:35:18 -0700325 /**
326 * <pre>
327 * One request followed by a sequence of responses (streamed download).
328 * The server returns the payload with client desired type and sizes.
329 * </pre>
330 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700331 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
332 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700333 return blockingServerStreamingCall(
334 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
335 }
336 }
337
ZHANG Dapenge1091252016-07-21 16:35:18 -0700338 /**
339 * <pre>
340 * Test service that supports all call types.
341 * </pre>
342 */
ZHANG Dapeng8f5adf82016-07-22 16:35:00 -0700343 public static final class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700344 private TestServiceFutureStub(io.grpc.Channel channel) {
345 super(channel);
346 }
347
348 private TestServiceFutureStub(io.grpc.Channel channel,
349 io.grpc.CallOptions callOptions) {
350 super(channel, callOptions);
351 }
352
353 @java.lang.Override
354 protected TestServiceFutureStub build(io.grpc.Channel channel,
355 io.grpc.CallOptions callOptions) {
356 return new TestServiceFutureStub(channel, callOptions);
357 }
358
ZHANG Dapenge1091252016-07-21 16:35:18 -0700359 /**
360 * <pre>
361 * One request followed by one response.
362 * The server returns the client payload as-is.
363 * </pre>
364 */
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700365 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
366 io.grpc.testing.integration.Test.SimpleRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700367 return futureUnaryCall(
368 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
369 }
370 }
371
372 private static final int METHODID_UNARY_CALL = 0;
373 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
374 private static final int METHODID_STREAMING_INPUT_CALL = 2;
375 private static final int METHODID_FULL_BIDI_CALL = 3;
376 private static final int METHODID_HALF_BIDI_CALL = 4;
377
378 private static class MethodHandlers<Req, Resp> implements
379 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
380 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
381 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
382 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
ZHANG Dapeng8f5adf82016-07-22 16:35:00 -0700383 private final TestServiceImplBase serviceImpl;
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700384 private final int methodId;
385
ZHANG Dapeng8f5adf82016-07-22 16:35:00 -0700386 public MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700387 this.serviceImpl = serviceImpl;
388 this.methodId = methodId;
389 }
390
391 @java.lang.Override
392 @java.lang.SuppressWarnings("unchecked")
393 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
394 switch (methodId) {
395 case METHODID_UNARY_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700396 serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request,
397 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700398 break;
399 case METHODID_STREAMING_OUTPUT_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700400 serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request,
401 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700402 break;
403 default:
404 throw new AssertionError();
405 }
406 }
407
408 @java.lang.Override
409 @java.lang.SuppressWarnings("unchecked")
410 public io.grpc.stub.StreamObserver<Req> invoke(
411 io.grpc.stub.StreamObserver<Resp> responseObserver) {
412 switch (methodId) {
413 case METHODID_STREAMING_INPUT_CALL:
414 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700415 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700416 case METHODID_FULL_BIDI_CALL:
417 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700418 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700419 case METHODID_HALF_BIDI_CALL:
420 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700421 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700422 default:
423 throw new AssertionError();
424 }
425 }
426 }
427
Eric Anderson66ab9562016-06-20 15:22:23 -0700428 public static io.grpc.ServiceDescriptor getServiceDescriptor() {
429 return new io.grpc.ServiceDescriptor(SERVICE_NAME,
430 METHOD_UNARY_CALL,
431 METHOD_STREAMING_OUTPUT_CALL,
432 METHOD_STREAMING_INPUT_CALL,
433 METHOD_FULL_BIDI_CALL,
434 METHOD_HALF_BIDI_CALL);
435 }
436
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700437}