blob: 57747151e6b7c14e1d4696649991663a86948cd0 [file] [log] [blame]
nmittlerf8314582015-01-27 10:25:39 -08001package io.grpc.testing.integration;
zhangkun835e607852015-01-22 12:31:56 -08002
Kun Zhang2ee4d022015-06-04 16:39:25 -07003import static io.grpc.stub.ClientCalls.asyncUnaryCall;
4import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
5import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -07006import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
Kun Zhang2ee4d022015-06-04 16:39:25 -07007import static io.grpc.stub.ClientCalls.blockingUnaryCall;
8import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
Kun Zhang686dcff2015-07-16 12:34:37 -07009import static io.grpc.stub.ClientCalls.futureUnaryCall;
Kun Zhang042b2782015-08-17 15:43:40 -070010import static io.grpc.MethodDescriptor.generateFullMethodName;
Kun Zhang867c76d2015-07-13 17:15:34 -070011import static io.grpc.stub.ServerCalls.asyncUnaryCall;
12import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
13import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070014import 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;
zhangkun835e607852015-01-22 12:31:56 -080017
nmittler7e8b5042016-04-15 12:52:00 -070018/**
19 * <pre>
20 * Test service that supports all call types.
21 * </pre>
22 */
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080023@javax.annotation.Generated(
Eric Andersone9643bb2016-07-11 16:57:58 -070024 value = "by gRPC proto compiler (version 1.1.0-SNAPSHOT)",
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080025 comments = "Source: test.proto")
zhangkun835e607852015-01-22 12:31:56 -080026public class TestServiceGrpc {
27
Eric Andersonbe0d7e92015-09-10 09:47:17 -070028 private TestServiceGrpc() {}
29
David P. Baker66b984c2015-08-21 13:00:26 -040030 public static final String SERVICE_NAME = "grpc.testing.TestService";
31
Kun Zhang73acc732015-06-26 16:32:05 -070032 // 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")
Kun Zhang73acc732015-06-26 16:32:05 -070034 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
nmittlerf8314582015-01-27 10:25:39 -080035 io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070036 io.grpc.MethodDescriptor.create(
37 io.grpc.MethodDescriptor.MethodType.UNARY,
Kun Zhang042b2782015-08-17 15:43:40 -070038 generateFullMethodName(
39 "grpc.testing.TestService", "UnaryCall"),
Eric Anderson47a7ccf2015-09-03 16:56:36 -070040 io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()),
41 io.grpc.protobuf.ProtoUtils.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")
Kun Zhang73acc732015-06-26 16:32:05 -070043 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
nmittlerf8314582015-01-27 10:25:39 -080044 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070045 io.grpc.MethodDescriptor.create(
46 io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070047 generateFullMethodName(
48 "grpc.testing.TestService", "StreamingOutputCall"),
Eric Anderson47a7ccf2015-09-03 16:56:36 -070049 io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
50 io.grpc.protobuf.ProtoUtils.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")
Kun Zhang73acc732015-06-26 16:32:05 -070052 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
nmittlerf8314582015-01-27 10:25:39 -080053 io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070054 io.grpc.MethodDescriptor.create(
55 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070056 generateFullMethodName(
57 "grpc.testing.TestService", "StreamingInputCall"),
Eric Anderson47a7ccf2015-09-03 16:56:36 -070058 io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()),
59 io.grpc.protobuf.ProtoUtils.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")
Kun Zhang73acc732015-06-26 16:32:05 -070061 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070062 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070063 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070064 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070065 generateFullMethodName(
66 "grpc.testing.TestService", "FullBidiCall"),
Eric Anderson47a7ccf2015-09-03 16:56:36 -070067 io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
68 io.grpc.protobuf.ProtoUtils.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")
Kun Zhang73acc732015-06-26 16:32:05 -070070 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070071 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070072 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070073 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070074 generateFullMethodName(
75 "grpc.testing.TestService", "HalfBidiCall"),
Eric Anderson47a7ccf2015-09-03 16:56:36 -070076 io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
77 io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
zhangkun835e607852015-01-22 12:31:56 -080078
nmittler7e8b5042016-04-15 12:52:00 -070079 /**
80 * Creates a new async stub that supports all call types for the service
81 */
nmittlerf8314582015-01-27 10:25:39 -080082 public static TestServiceStub newStub(io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -070083 return new TestServiceStub(channel);
zhangkun835e607852015-01-22 12:31:56 -080084 }
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 */
zhangkun835e607852015-01-22 12:31:56 -080089 public static TestServiceBlockingStub newBlockingStub(
nmittlerf8314582015-01-27 10:25:39 -080090 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -070091 return new TestServiceBlockingStub(channel);
zhangkun835e607852015-01-22 12:31:56 -080092 }
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 */
zhangkun835e607852015-01-22 12:31:56 -080097 public static TestServiceFutureStub newFutureStub(
nmittlerf8314582015-01-27 10:25:39 -080098 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -070099 return new TestServiceFutureStub(channel);
zhangkun835e607852015-01-22 12:31:56 -0800100 }
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 {
zhangkun835e607852015-01-22 12:31:56 -0800108
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
nmittlerf8314582015-01-27 10:25:39 -0800116 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 }
zhangkun835e607852015-01-22 12:31:56 -0800120
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
nmittlerf8314582015-01-27 10:25:39 -0800128 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 }
zhangkun835e607852015-01-22 12:31:56 -0800132
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
nmittlerf8314582015-01-27 10:25:39 -0800140 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 }
zhangkun835e607852015-01-22 12:31:56 -0800144
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
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -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 }
zhangkun835e607852015-01-22 12:31:56 -0800157
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 */
Kun Zhangeb929672015-07-17 17:02:58 -0700218 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
zhangkun835e607852015-01-22 12:31:56 -0800219 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700220 private TestServiceStub(io.grpc.Channel channel) {
221 super(channel);
zhangkun835e607852015-01-22 12:31:56 -0800222 }
223
Kun Zhangd3c5b002015-06-25 20:24:01 -0700224 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700225 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700226 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700227 }
228
zhangkun835e607852015-01-22 12:31:56 -0800229 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800230 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700231 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700232 return new TestServiceStub(channel, callOptions);
zhangkun835e607852015-01-22 12:31:56 -0800233 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800241 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800242 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
243 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
zhangkun835e607852015-01-22 12:31:56 -0800244 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700245 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800246 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800254 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800255 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
256 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
zhangkun835e607852015-01-22 12:31:56 -0800257 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700258 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800259 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800267 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800268 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
269 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
zhangkun835e607852015-01-22 12:31:56 -0800270 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700271 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800272 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800281 @java.lang.Override
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700282 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
nmittlerf8314582015-01-27 10:25:39 -0800283 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700284 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700285 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800286 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800296 @java.lang.Override
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700297 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
nmittlerf8314582015-01-27 10:25:39 -0800298 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700299 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700300 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800301 }
302 }
303
ZHANG Dapenge1091252016-07-21 16:35:18 -0700304 /**
305 * <pre>
306 * Test service that supports all call types.
307 * </pre>
308 */
Kun Zhangeb929672015-07-17 17:02:58 -0700309 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
zhangkun835e607852015-01-22 12:31:56 -0800310 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700311 private TestServiceBlockingStub(io.grpc.Channel channel) {
312 super(channel);
zhangkun835e607852015-01-22 12:31:56 -0800313 }
314
Kun Zhangd3c5b002015-06-25 20:24:01 -0700315 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700316 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700317 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700318 }
319
zhangkun835e607852015-01-22 12:31:56 -0800320 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800321 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700322 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700323 return new TestServiceBlockingStub(channel, callOptions);
zhangkun835e607852015-01-22 12:31:56 -0800324 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800332 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800333 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
zhangkun835e607852015-01-22 12:31:56 -0800334 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700335 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
zhangkun835e607852015-01-22 12:31:56 -0800336 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800344 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800345 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
346 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
zhangkun835e607852015-01-22 12:31:56 -0800347 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700348 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
zhangkun835e607852015-01-22 12:31:56 -0800349 }
350 }
351
ZHANG Dapenge1091252016-07-21 16:35:18 -0700352 /**
353 * <pre>
354 * Test service that supports all call types.
355 * </pre>
356 */
Kun Zhangeb929672015-07-17 17:02:58 -0700357 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
zhangkun835e607852015-01-22 12:31:56 -0800358 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700359 private TestServiceFutureStub(io.grpc.Channel channel) {
360 super(channel);
zhangkun835e607852015-01-22 12:31:56 -0800361 }
362
Kun Zhangd3c5b002015-06-25 20:24:01 -0700363 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700364 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700365 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700366 }
367
zhangkun835e607852015-01-22 12:31:56 -0800368 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800369 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700370 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700371 return new TestServiceFutureStub(channel, callOptions);
zhangkun835e607852015-01-22 12:31:56 -0800372 }
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 */
zhangkun835e607852015-01-22 12:31:56 -0800380 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800381 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
382 io.grpc.testing.integration.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700383 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700384 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
zhangkun835e607852015-01-22 12:31:56 -0800385 }
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 Andersond52429d2015-11-13 16:50:08 -0800547 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
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800566 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800567 @java.lang.SuppressWarnings("unchecked")
568 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
569 switch (methodId) {
570 case METHODID_UNARY_CALL:
571 serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request,
572 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver);
573 break;
574 case METHODID_STREAMING_OUTPUT_CALL:
575 serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request,
576 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
577 break;
578 default:
579 throw new AssertionError();
580 }
581 }
582
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800583 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800584 @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(
590 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
591 case METHODID_FULL_BIDI_CALL:
592 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
593 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
594 case METHODID_HALF_BIDI_CALL:
595 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
596 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
597 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
zhangkun835e607852015-01-22 12:31:56 -0800612}