blob: 27104de7552756fac6d12b93b5598b4aad767456 [file] [log] [blame]
Xudong Maf7f57b72015-09-24 11:16:07 -07001package io.grpc.testing.integration.nano;
Xiao Hangdcff3152015-02-20 15:03:06 -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;
Xiao Hangdcff3152015-02-20 15:03:06 -080017
18import java.io.IOException;
19
nmittler7e8b5042016-04-15 12:52:00 -070020/**
21 * <pre>
22 * Test service that supports all call types.
23 * </pre>
24 */
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080025@javax.annotation.Generated(
Carl Mastrangelo3c5b5a52016-04-29 13:37:20 -070026 value = "by gRPC proto compiler (version 0.15.0-SNAPSHOT)",
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080027 comments = "Source: test.proto")
Xiao Hangdcff3152015-02-20 15:03:06 -080028public class TestServiceGrpc {
29
Eric Andersonbe0d7e92015-09-10 09:47:17 -070030 private TestServiceGrpc() {}
31
David P. Baker66b984c2015-08-21 13:00:26 -040032 public static final String SERVICE_NAME = "grpc.testing.TestService";
33
Kun Zhang73acc732015-06-26 16:32:05 -070034 // Static method descriptors that strictly reflect the proto.
Eric Anderson1ee336d2015-10-02 20:09:10 -070035 private static final int ARG_IN_METHOD_UNARY_CALL = 0;
36 private static final int ARG_OUT_METHOD_UNARY_CALL = 1;
Eric Anderson7c722e42016-06-07 15:00:29 -070037 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Kun Zhangbd23a8d2015-08-28 18:47:06 -070038 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
39 io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070040 io.grpc.MethodDescriptor.create(
41 io.grpc.MethodDescriptor.MethodType.UNARY,
Kun Zhang042b2782015-08-17 15:43:40 -070042 generateFullMethodName(
43 "grpc.testing.TestService", "UnaryCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070044 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070045 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070046 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070047 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL))
48 );
49 private static final int ARG_IN_METHOD_STREAMING_OUTPUT_CALL = 2;
50 private static final int ARG_OUT_METHOD_STREAMING_OUTPUT_CALL = 3;
Eric Anderson7c722e42016-06-07 15:00:29 -070051 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Kun Zhangbd23a8d2015-08-28 18:47:06 -070052 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
53 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070054 io.grpc.MethodDescriptor.create(
55 io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070056 generateFullMethodName(
57 "grpc.testing.TestService", "StreamingOutputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070058 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070059 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070060 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070061 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL))
62 );
63 private static final int ARG_IN_METHOD_STREAMING_INPUT_CALL = 4;
64 private static final int ARG_OUT_METHOD_STREAMING_INPUT_CALL = 5;
Eric Anderson7c722e42016-06-07 15:00:29 -070065 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Kun Zhangbd23a8d2015-08-28 18:47:06 -070066 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
67 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070068 io.grpc.MethodDescriptor.create(
69 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070070 generateFullMethodName(
71 "grpc.testing.TestService", "StreamingInputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070072 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070073 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070074 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070075 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL))
76 );
77 private static final int ARG_IN_METHOD_FULL_BIDI_CALL = 6;
78 private static final int ARG_OUT_METHOD_FULL_BIDI_CALL = 7;
Eric Anderson7c722e42016-06-07 15:00:29 -070079 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Kun Zhangbd23a8d2015-08-28 18:47:06 -070080 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
81 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070082 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070083 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070084 generateFullMethodName(
85 "grpc.testing.TestService", "FullBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070086 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070087 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070088 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070089 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL))
90 );
91 private static final int ARG_IN_METHOD_HALF_BIDI_CALL = 8;
92 private static final int ARG_OUT_METHOD_HALF_BIDI_CALL = 9;
Eric Anderson7c722e42016-06-07 15:00:29 -070093 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
Kun Zhangbd23a8d2015-08-28 18:47:06 -070094 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
95 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070096 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070097 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070098 generateFullMethodName(
99 "grpc.testing.TestService", "HalfBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700100 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -0700101 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700102 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -0700103 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL))
104 );
105
106 private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
107 implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
108 private final int id;
109
110 NanoFactory(int id) {
111 this.id = id;
112 }
113
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200114 @java.lang.Override
Eric Anderson1ee336d2015-10-02 20:09:10 -0700115 public T newInstance() {
116 Object o;
117 switch (id) {
118 case ARG_IN_METHOD_UNARY_CALL:
119 o = new io.grpc.testing.integration.nano.Test.SimpleRequest();
120 break;
121 case ARG_OUT_METHOD_UNARY_CALL:
122 o = new io.grpc.testing.integration.nano.Test.SimpleResponse();
123 break;
124 case ARG_IN_METHOD_STREAMING_OUTPUT_CALL:
125 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
126 break;
127 case ARG_OUT_METHOD_STREAMING_OUTPUT_CALL:
128 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
129 break;
130 case ARG_IN_METHOD_STREAMING_INPUT_CALL:
131 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallRequest();
132 break;
133 case ARG_OUT_METHOD_STREAMING_INPUT_CALL:
134 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallResponse();
135 break;
136 case ARG_IN_METHOD_FULL_BIDI_CALL:
137 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
138 break;
139 case ARG_OUT_METHOD_FULL_BIDI_CALL:
140 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
141 break;
142 case ARG_IN_METHOD_HALF_BIDI_CALL:
143 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
144 break;
145 case ARG_OUT_METHOD_HALF_BIDI_CALL:
146 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
147 break;
148 default:
149 throw new AssertionError();
150 }
151 @java.lang.SuppressWarnings("unchecked")
152 T t = (T) o;
153 return t;
154 }
155 }
Xiao Hangdcff3152015-02-20 15:03:06 -0800156
nmittler7e8b5042016-04-15 12:52:00 -0700157 /**
158 * Creates a new async stub that supports all call types for the service
159 */
Xiao Hangdcff3152015-02-20 15:03:06 -0800160 public static TestServiceStub newStub(io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700161 return new TestServiceStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800162 }
163
nmittler7e8b5042016-04-15 12:52:00 -0700164 /**
165 * Creates a new blocking-style stub that supports unary and streaming output calls on the service
166 */
Xiao Hangdcff3152015-02-20 15:03:06 -0800167 public static TestServiceBlockingStub newBlockingStub(
168 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700169 return new TestServiceBlockingStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800170 }
171
nmittler7e8b5042016-04-15 12:52:00 -0700172 /**
173 * Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
174 */
Xiao Hangdcff3152015-02-20 15:03:06 -0800175 public static TestServiceFutureStub newFutureStub(
176 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700177 return new TestServiceFutureStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800178 }
179
nmittler7e8b5042016-04-15 12:52:00 -0700180 /**
181 * <pre>
182 * Test service that supports all call types.
183 * </pre>
184 */
Xiao Hangdcff3152015-02-20 15:03:06 -0800185 public static interface TestService {
186
nmittler7e8b5042016-04-15 12:52:00 -0700187 /**
188 * <pre>
189 * One request followed by one response.
190 * The server returns the client payload as-is.
191 * </pre>
192 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700193 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
194 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800195
nmittler7e8b5042016-04-15 12:52:00 -0700196 /**
197 * <pre>
198 * One request followed by a sequence of responses (streamed download).
199 * The server returns the payload with client desired type and sizes.
200 * </pre>
201 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700202 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
203 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800204
nmittler7e8b5042016-04-15 12:52:00 -0700205 /**
206 * <pre>
207 * A sequence of requests followed by one response (streamed upload).
208 * The server returns the aggregated size of client payload as the result.
209 * </pre>
210 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700211 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
212 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800213
nmittler7e8b5042016-04-15 12:52:00 -0700214 /**
215 * <pre>
216 * A sequence of requests with each request served by the server immediately.
217 * As one request could lead to multiple responses, this interface
218 * demonstrates the idea of full bidirectionality.
219 * </pre>
220 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700221 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
222 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800223
nmittler7e8b5042016-04-15 12:52:00 -0700224 /**
225 * <pre>
226 * A sequence of requests followed by a sequence of responses.
227 * The server buffers all the client requests and then serves them in order. A
228 * stream of responses are returned to the client when the server starts with
229 * first request.
230 * </pre>
231 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700232 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
233 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800234 }
235
Eric Anderson7c722e42016-06-07 15:00:29 -0700236 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200237 public static abstract class AbstractTestService implements TestService, io.grpc.BindableService {
238
239 @java.lang.Override
240 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
241 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
242 asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
243 }
244
245 @java.lang.Override
246 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
247 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
248 asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
249 }
250
251 @java.lang.Override
252 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
253 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
254 return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
255 }
256
257 @java.lang.Override
258 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
259 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
260 return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
261 }
262
263 @java.lang.Override
264 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
265 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
266 return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
267 }
268
269 @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
270 return TestServiceGrpc.bindService(this);
271 }
272 }
273
nmittler7e8b5042016-04-15 12:52:00 -0700274 /**
275 * <pre>
276 * Test service that supports all call types.
277 * </pre>
278 */
Xiao Hangdcff3152015-02-20 15:03:06 -0800279 public static interface TestServiceBlockingClient {
280
nmittler7e8b5042016-04-15 12:52:00 -0700281 /**
282 * <pre>
283 * One request followed by one response.
284 * The server returns the client payload as-is.
285 * </pre>
286 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700287 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800288
nmittler7e8b5042016-04-15 12:52:00 -0700289 /**
290 * <pre>
291 * One request followed by a sequence of responses (streamed download).
292 * The server returns the payload with client desired type and sizes.
293 * </pre>
294 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700295 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
296 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800297 }
298
nmittler7e8b5042016-04-15 12:52:00 -0700299 /**
300 * <pre>
301 * Test service that supports all call types.
302 * </pre>
303 */
Xiao Hangdcff3152015-02-20 15:03:06 -0800304 public static interface TestServiceFutureClient {
305
nmittler7e8b5042016-04-15 12:52:00 -0700306 /**
307 * <pre>
308 * One request followed by one response.
309 * The server returns the client payload as-is.
310 * </pre>
311 */
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700312 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
313 io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800314 }
315
Kun Zhangeb929672015-07-17 17:02:58 -0700316 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800317 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700318 private TestServiceStub(io.grpc.Channel channel) {
319 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800320 }
321
Kun Zhangd3c5b002015-06-25 20:24:01 -0700322 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700323 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700324 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700325 }
326
Xiao Hangdcff3152015-02-20 15:03:06 -0800327 @java.lang.Override
328 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700329 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700330 return new TestServiceStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800331 }
332
333 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700334 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
335 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800336 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700337 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800338 }
339
340 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700341 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
342 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800343 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700344 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800345 }
346
347 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700348 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
349 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800350 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700351 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800352 }
353
354 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700355 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
356 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700357 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700358 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800359 }
360
361 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700362 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
363 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700364 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700365 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800366 }
367 }
368
Kun Zhangeb929672015-07-17 17:02:58 -0700369 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800370 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700371 private TestServiceBlockingStub(io.grpc.Channel channel) {
372 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800373 }
374
Kun Zhangd3c5b002015-06-25 20:24:01 -0700375 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700376 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700377 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700378 }
379
Xiao Hangdcff3152015-02-20 15:03:06 -0800380 @java.lang.Override
381 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700382 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700383 return new TestServiceBlockingStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800384 }
385
386 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700387 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800388 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700389 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800390 }
391
392 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700393 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
394 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800395 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700396 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800397 }
398 }
399
Kun Zhangeb929672015-07-17 17:02:58 -0700400 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800401 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700402 private TestServiceFutureStub(io.grpc.Channel channel) {
403 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800404 }
405
Kun Zhangd3c5b002015-06-25 20:24:01 -0700406 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700407 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700408 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700409 }
410
Xiao Hangdcff3152015-02-20 15:03:06 -0800411 @java.lang.Override
412 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700413 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700414 return new TestServiceFutureStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800415 }
416
417 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700418 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
419 io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700420 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700421 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800422 }
423 }
424
Eric Andersond52429d2015-11-13 16:50:08 -0800425 private static final int METHODID_UNARY_CALL = 0;
426 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
427 private static final int METHODID_STREAMING_INPUT_CALL = 2;
428 private static final int METHODID_FULL_BIDI_CALL = 3;
429 private static final int METHODID_HALF_BIDI_CALL = 4;
430
431 private static class MethodHandlers<Req, Resp> implements
432 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
433 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
434 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
435 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
436 private final TestService serviceImpl;
437 private final int methodId;
438
439 public MethodHandlers(TestService serviceImpl, int methodId) {
440 this.serviceImpl = serviceImpl;
441 this.methodId = methodId;
442 }
443
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800444 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800445 @java.lang.SuppressWarnings("unchecked")
446 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
447 switch (methodId) {
448 case METHODID_UNARY_CALL:
449 serviceImpl.unaryCall((io.grpc.testing.integration.nano.Test.SimpleRequest) request,
450 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse>) responseObserver);
451 break;
452 case METHODID_STREAMING_OUTPUT_CALL:
453 serviceImpl.streamingOutputCall((io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest) request,
454 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
455 break;
456 default:
457 throw new AssertionError();
458 }
459 }
460
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800461 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800462 @java.lang.SuppressWarnings("unchecked")
463 public io.grpc.stub.StreamObserver<Req> invoke(
464 io.grpc.stub.StreamObserver<Resp> responseObserver) {
465 switch (methodId) {
466 case METHODID_STREAMING_INPUT_CALL:
467 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
468 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
469 case METHODID_FULL_BIDI_CALL:
470 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
471 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
472 case METHODID_HALF_BIDI_CALL:
473 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
474 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
475 default:
476 throw new AssertionError();
477 }
478 }
479 }
480
Xiao Hangdcff3152015-02-20 15:03:06 -0800481 public static io.grpc.ServerServiceDefinition bindService(
482 final TestService serviceImpl) {
David P. Baker66b984c2015-08-21 13:00:26 -0400483 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
Eric Andersond52429d2015-11-13 16:50:08 -0800484 .addMethod(
485 METHOD_UNARY_CALL,
486 asyncUnaryCall(
487 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700488 io.grpc.testing.integration.nano.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800489 io.grpc.testing.integration.nano.Test.SimpleResponse>(
490 serviceImpl, METHODID_UNARY_CALL)))
491 .addMethod(
492 METHOD_STREAMING_OUTPUT_CALL,
493 asyncServerStreamingCall(
494 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700495 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800496 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
497 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
498 .addMethod(
499 METHOD_STREAMING_INPUT_CALL,
500 asyncClientStreamingCall(
501 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700502 io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800503 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
504 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
505 .addMethod(
506 METHOD_FULL_BIDI_CALL,
507 asyncBidiStreamingCall(
508 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700509 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800510 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
511 serviceImpl, METHODID_FULL_BIDI_CALL)))
512 .addMethod(
513 METHOD_HALF_BIDI_CALL,
514 asyncBidiStreamingCall(
515 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700516 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800517 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
518 serviceImpl, METHODID_HALF_BIDI_CALL)))
519 .build();
Xiao Hangdcff3152015-02-20 15:03:06 -0800520 }
521}