blob: 7637f077b5fea681526329451f2998847e27777f [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 Dapenge1091252016-07-21 16:35:18 -0700107 public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService {
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 */
ZHANG Dapenge1091252016-07-21 16:35:18 -0700115 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700116 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
ZHANG Dapenge1091252016-07-21 16:35:18 -0700117 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
118 asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
119 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700120
nmittler7e8b5042016-04-15 12:52:00 -0700121 /**
122 * <pre>
123 * One request followed by a sequence of responses (streamed download).
124 * The server returns the payload with client desired type and sizes.
125 * </pre>
126 */
ZHANG Dapenge1091252016-07-21 16:35:18 -0700127 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700128 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
ZHANG Dapenge1091252016-07-21 16:35:18 -0700129 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
130 asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
131 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700132
nmittler7e8b5042016-04-15 12:52:00 -0700133 /**
134 * <pre>
135 * A sequence of requests followed by one response (streamed upload).
136 * The server returns the aggregated size of client payload as the result.
137 * </pre>
138 */
ZHANG Dapenge1091252016-07-21 16:35:18 -0700139 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700140 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
ZHANG Dapenge1091252016-07-21 16:35:18 -0700141 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
142 return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
143 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700144
nmittler7e8b5042016-04-15 12:52:00 -0700145 /**
146 * <pre>
147 * A sequence of requests with each request served by the server immediately.
148 * As one request could lead to multiple responses, this interface
149 * demonstrates the idea of full bidirectionality.
150 * </pre>
151 */
ZHANG Dapenge1091252016-07-21 16:35:18 -0700152 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700153 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
ZHANG Dapenge1091252016-07-21 16:35:18 -0700154 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
155 return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
156 }
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700157
nmittler7e8b5042016-04-15 12:52:00 -0700158 /**
159 * <pre>
160 * A sequence of requests followed by a sequence of responses.
161 * The server buffers all the client requests and then serves them in order. A
162 * stream of responses are returned to the client when the server starts with
163 * first request.
164 * </pre>
165 */
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200166 @java.lang.Override
167 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
168 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
169 return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
170 }
171
172 @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
ZHANG Dapenge1091252016-07-21 16:35:18 -0700173 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
174 .addMethod(
175 METHOD_UNARY_CALL,
176 asyncUnaryCall(
177 new MethodHandlers<
178 io.grpc.testing.integration.Test.SimpleRequest,
179 io.grpc.testing.integration.Test.SimpleResponse>(
180 this, METHODID_UNARY_CALL)))
181 .addMethod(
182 METHOD_STREAMING_OUTPUT_CALL,
183 asyncServerStreamingCall(
184 new MethodHandlers<
185 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
186 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
187 this, METHODID_STREAMING_OUTPUT_CALL)))
188 .addMethod(
189 METHOD_STREAMING_INPUT_CALL,
190 asyncClientStreamingCall(
191 new MethodHandlers<
192 io.grpc.testing.integration.Test.StreamingInputCallRequest,
193 io.grpc.testing.integration.Test.StreamingInputCallResponse>(
194 this, METHODID_STREAMING_INPUT_CALL)))
195 .addMethod(
196 METHOD_FULL_BIDI_CALL,
197 asyncBidiStreamingCall(
198 new MethodHandlers<
199 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
200 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
201 this, METHODID_FULL_BIDI_CALL)))
202 .addMethod(
203 METHOD_HALF_BIDI_CALL,
204 asyncBidiStreamingCall(
205 new MethodHandlers<
206 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
207 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
208 this, METHODID_HALF_BIDI_CALL)))
209 .build();
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200210 }
211 }
212
nmittler7e8b5042016-04-15 12:52:00 -0700213 /**
214 * <pre>
215 * Test service that supports all call types.
216 * </pre>
217 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700218 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
219 implements TestService {
220 private TestServiceStub(io.grpc.Channel channel) {
221 super(channel);
222 }
223
224 private TestServiceStub(io.grpc.Channel channel,
225 io.grpc.CallOptions callOptions) {
226 super(channel, callOptions);
227 }
228
229 @java.lang.Override
230 protected TestServiceStub build(io.grpc.Channel channel,
231 io.grpc.CallOptions callOptions) {
232 return new TestServiceStub(channel, callOptions);
233 }
234
ZHANG Dapenge1091252016-07-21 16:35:18 -0700235 /**
236 * <pre>
237 * One request followed by one response.
238 * The server returns the client payload as-is.
239 * </pre>
240 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700241 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700242 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
243 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700244 asyncUnaryCall(
245 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
246 }
247
ZHANG Dapenge1091252016-07-21 16:35:18 -0700248 /**
249 * <pre>
250 * One request followed by a sequence of responses (streamed download).
251 * The server returns the payload with client desired type and sizes.
252 * </pre>
253 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700254 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700255 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
256 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700257 asyncServerStreamingCall(
258 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
259 }
260
ZHANG Dapenge1091252016-07-21 16:35:18 -0700261 /**
262 * <pre>
263 * A sequence of requests followed by one response (streamed upload).
264 * The server returns the aggregated size of client payload as the result.
265 * </pre>
266 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700267 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700268 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
269 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700270 return asyncClientStreamingCall(
271 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
272 }
273
ZHANG Dapenge1091252016-07-21 16:35:18 -0700274 /**
275 * <pre>
276 * A sequence of requests with each request served by the server immediately.
277 * As one request could lead to multiple responses, this interface
278 * demonstrates the idea of full bidirectionality.
279 * </pre>
280 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700281 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700282 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
283 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700284 return asyncBidiStreamingCall(
285 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
286 }
287
ZHANG Dapenge1091252016-07-21 16:35:18 -0700288 /**
289 * <pre>
290 * A sequence of requests followed by a sequence of responses.
291 * The server buffers all the client requests and then serves them in order. A
292 * stream of responses are returned to the client when the server starts with
293 * first request.
294 * </pre>
295 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700296 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700297 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
298 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700299 return asyncBidiStreamingCall(
300 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
301 }
302 }
303
ZHANG Dapenge1091252016-07-21 16:35:18 -0700304 /**
305 * <pre>
306 * Test service that supports all call types.
307 * </pre>
308 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700309 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
310 implements TestServiceBlockingClient {
311 private TestServiceBlockingStub(io.grpc.Channel channel) {
312 super(channel);
313 }
314
315 private TestServiceBlockingStub(io.grpc.Channel channel,
316 io.grpc.CallOptions callOptions) {
317 super(channel, callOptions);
318 }
319
320 @java.lang.Override
321 protected TestServiceBlockingStub build(io.grpc.Channel channel,
322 io.grpc.CallOptions callOptions) {
323 return new TestServiceBlockingStub(channel, callOptions);
324 }
325
ZHANG Dapenge1091252016-07-21 16:35:18 -0700326 /**
327 * <pre>
328 * One request followed by one response.
329 * The server returns the client payload as-is.
330 * </pre>
331 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700332 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700333 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700334 return blockingUnaryCall(
335 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
336 }
337
ZHANG Dapenge1091252016-07-21 16:35:18 -0700338 /**
339 * <pre>
340 * One request followed by a sequence of responses (streamed download).
341 * The server returns the payload with client desired type and sizes.
342 * </pre>
343 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700344 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700345 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
346 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700347 return blockingServerStreamingCall(
348 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
349 }
350 }
351
ZHANG Dapenge1091252016-07-21 16:35:18 -0700352 /**
353 * <pre>
354 * Test service that supports all call types.
355 * </pre>
356 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700357 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
358 implements TestServiceFutureClient {
359 private TestServiceFutureStub(io.grpc.Channel channel) {
360 super(channel);
361 }
362
363 private TestServiceFutureStub(io.grpc.Channel channel,
364 io.grpc.CallOptions callOptions) {
365 super(channel, callOptions);
366 }
367
368 @java.lang.Override
369 protected TestServiceFutureStub build(io.grpc.Channel channel,
370 io.grpc.CallOptions callOptions) {
371 return new TestServiceFutureStub(channel, callOptions);
372 }
373
ZHANG Dapenge1091252016-07-21 16:35:18 -0700374 /**
375 * <pre>
376 * One request followed by one response.
377 * The server returns the client payload as-is.
378 * </pre>
379 */
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700380 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700381 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
382 io.grpc.testing.integration.Test.SimpleRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700383 return futureUnaryCall(
384 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
385 }
386 }
387
ZHANG Dapenge1091252016-07-21 16:35:18 -0700388 /**
389 * This will be removed in the next release.
390 * If your code has been using gRPC-java v0.15.0 or higher already,
391 * the following changes to your code are suggested:
392 * <ul>
393 * <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
394 * <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
395 * <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
396 * <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
397 * <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
398 * with {@code serverBuilder.addService(serviceImpl)};</li>
399 * <li> if you are mocking stubs using mockito, please do not mock them.
400 * See the documentation on testing with gRPC-java;</li>
401 * <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
402 * <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
403 * </ul>
404 */
405 @java.lang.Deprecated public static interface TestService {
406
407 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
408 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
409
410 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
411 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
412
413 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
414 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
415
416 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
417 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
418
419 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
420 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
421 }
422
423 /**
424 * This will be removed in the next release.
425 * If your code has been using gRPC-java v0.15.0 or higher already,
426 * the following changes to your code are suggested:
427 * <ul>
428 * <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
429 * <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
430 * <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
431 * <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
432 * <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
433 * with {@code serverBuilder.addService(serviceImpl)};</li>
434 * <li> if you are mocking stubs using mockito, please do not mock them.
435 * See the documentation on testing with gRPC-java;</li>
436 * <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
437 * <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
438 * </ul>
439 */
440 @java.lang.Deprecated public static interface TestServiceBlockingClient {
441
442 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
443
444 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
445 io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
446 }
447
448 /**
449 * This will be removed in the next release.
450 * If your code has been using gRPC-java v0.15.0 or higher already,
451 * the following changes to your code are suggested:
452 * <ul>
453 * <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
454 * <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
455 * <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
456 * <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
457 * <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
458 * with {@code serverBuilder.addService(serviceImpl)};</li>
459 * <li> if you are mocking stubs using mockito, please do not mock them.
460 * See the documentation on testing with gRPC-java;</li>
461 * <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
462 * <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
463 * </ul>
464 */
465 @java.lang.Deprecated public static interface TestServiceFutureClient {
466
467 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
468 io.grpc.testing.integration.Test.SimpleRequest request);
469 }
470
471 /**
472 * This will be removed in the next release.
473 * If your code has been using gRPC-java v0.15.0 or higher already,
474 * the following changes to your code are suggested:
475 * <ul>
476 * <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
477 * <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
478 * <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
479 * <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
480 * <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
481 * with {@code serverBuilder.addService(serviceImpl)};</li>
482 * <li> if you are mocking stubs using mockito, please do not mock them.
483 * See the documentation on testing with gRPC-java;</li>
484 * <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
485 * <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
486 * </ul>
487 */
ZHANG Dapengf149e4c2016-06-29 21:17:03 -0700488 @java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
489
ZHANG Dapenge1091252016-07-21 16:35:18 -0700490 /**
491 * This will be removed in the next release.
492 * If your code has been using gRPC-java v0.15.0 or higher already,
493 * the following changes to your code are suggested:
494 * <ul>
495 * <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
496 * <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
497 * <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
498 * <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
499 * <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
500 * with {@code serverBuilder.addService(serviceImpl)};</li>
501 * <li> if you are mocking stubs using mockito, please do not mock them.
502 * See the documentation on testing with gRPC-java;</li>
503 * <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
504 * <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
505 * </ul>
506 */
507 @java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(final TestService serviceImpl) {
508 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
509 .addMethod(
510 METHOD_UNARY_CALL,
511 asyncUnaryCall(
512 new MethodHandlers<
513 io.grpc.testing.integration.Test.SimpleRequest,
514 io.grpc.testing.integration.Test.SimpleResponse>(
515 serviceImpl, METHODID_UNARY_CALL)))
516 .addMethod(
517 METHOD_STREAMING_OUTPUT_CALL,
518 asyncServerStreamingCall(
519 new MethodHandlers<
520 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
521 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
522 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
523 .addMethod(
524 METHOD_STREAMING_INPUT_CALL,
525 asyncClientStreamingCall(
526 new MethodHandlers<
527 io.grpc.testing.integration.Test.StreamingInputCallRequest,
528 io.grpc.testing.integration.Test.StreamingInputCallResponse>(
529 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
530 .addMethod(
531 METHOD_FULL_BIDI_CALL,
532 asyncBidiStreamingCall(
533 new MethodHandlers<
534 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
535 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
536 serviceImpl, METHODID_FULL_BIDI_CALL)))
537 .addMethod(
538 METHOD_HALF_BIDI_CALL,
539 asyncBidiStreamingCall(
540 new MethodHandlers<
541 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
542 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
543 serviceImpl, METHODID_HALF_BIDI_CALL)))
544 .build();
545 }
546
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700547 private static final int METHODID_UNARY_CALL = 0;
548 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
549 private static final int METHODID_STREAMING_INPUT_CALL = 2;
550 private static final int METHODID_FULL_BIDI_CALL = 3;
551 private static final int METHODID_HALF_BIDI_CALL = 4;
552
553 private static class MethodHandlers<Req, Resp> implements
554 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
555 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
556 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
557 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
558 private final TestService serviceImpl;
559 private final int methodId;
560
561 public MethodHandlers(TestService serviceImpl, int methodId) {
562 this.serviceImpl = serviceImpl;
563 this.methodId = methodId;
564 }
565
566 @java.lang.Override
567 @java.lang.SuppressWarnings("unchecked")
568 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
569 switch (methodId) {
570 case METHODID_UNARY_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700571 serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request,
572 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700573 break;
574 case METHODID_STREAMING_OUTPUT_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700575 serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request,
576 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700577 break;
578 default:
579 throw new AssertionError();
580 }
581 }
582
583 @java.lang.Override
584 @java.lang.SuppressWarnings("unchecked")
585 public io.grpc.stub.StreamObserver<Req> invoke(
586 io.grpc.stub.StreamObserver<Resp> responseObserver) {
587 switch (methodId) {
588 case METHODID_STREAMING_INPUT_CALL:
589 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700590 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700591 case METHODID_FULL_BIDI_CALL:
592 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700593 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700594 case METHODID_HALF_BIDI_CALL:
595 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700596 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700597 default:
598 throw new AssertionError();
599 }
600 }
601 }
602
Eric Anderson66ab9562016-06-20 15:22:23 -0700603 public static io.grpc.ServiceDescriptor getServiceDescriptor() {
604 return new io.grpc.ServiceDescriptor(SERVICE_NAME,
605 METHOD_UNARY_CALL,
606 METHOD_STREAMING_OUTPUT_CALL,
607 METHOD_STREAMING_INPUT_CALL,
608 METHOD_FULL_BIDI_CALL,
609 METHOD_HALF_BIDI_CALL);
610 }
611
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700612}