blob: 9be7964671ea16cb724e1a7b264c1672943ac64b [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 Dapengf149e4c2016-06-29 21:17:03 -0700107 @java.lang.Deprecated public static interface 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 */
nmittlerf8314582015-01-27 10:25:39 -0800115 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
116 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800117
nmittler7e8b5042016-04-15 12:52:00 -0700118 /**
119 * <pre>
120 * One request followed by a sequence of responses (streamed download).
121 * The server returns the payload with client desired type and sizes.
122 * </pre>
123 */
nmittlerf8314582015-01-27 10:25:39 -0800124 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
125 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800126
nmittler7e8b5042016-04-15 12:52:00 -0700127 /**
128 * <pre>
129 * A sequence of requests followed by one response (streamed upload).
130 * The server returns the aggregated size of client payload as the result.
131 * </pre>
132 */
nmittlerf8314582015-01-27 10:25:39 -0800133 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
134 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800135
nmittler7e8b5042016-04-15 12:52:00 -0700136 /**
137 * <pre>
138 * A sequence of requests with each request served by the server immediately.
139 * As one request could lead to multiple responses, this interface
140 * demonstrates the idea of full bidirectionality.
141 * </pre>
142 */
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700143 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
nmittlerf8314582015-01-27 10:25:39 -0800144 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800145
nmittler7e8b5042016-04-15 12:52:00 -0700146 /**
147 * <pre>
148 * A sequence of requests followed by a sequence of responses.
149 * The server buffers all the client requests and then serves them in order. A
150 * stream of responses are returned to the client when the server starts with
151 * first request.
152 * </pre>
153 */
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700154 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
nmittlerf8314582015-01-27 10:25:39 -0800155 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800156 }
157
Eric Anderson7c722e42016-06-07 15:00:29 -0700158 @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469")
ZHANG Dapengf149e4c2016-06-29 21:17:03 -0700159 public static abstract class TestServiceImplBase implements TestService, io.grpc.BindableService {
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200160
161 @java.lang.Override
162 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
163 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
164 asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
165 }
166
167 @java.lang.Override
168 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
169 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
170 asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
171 }
172
173 @java.lang.Override
174 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
175 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
176 return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
177 }
178
179 @java.lang.Override
180 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
181 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
182 return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
183 }
184
185 @java.lang.Override
186 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
187 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
188 return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
189 }
190
191 @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
192 return TestServiceGrpc.bindService(this);
193 }
194 }
195
nmittler7e8b5042016-04-15 12:52:00 -0700196 /**
197 * <pre>
198 * Test service that supports all call types.
199 * </pre>
200 */
ZHANG Dapengf149e4c2016-06-29 21:17:03 -0700201 @java.lang.Deprecated public static interface TestServiceBlockingClient {
zhangkun835e607852015-01-22 12:31:56 -0800202
nmittler7e8b5042016-04-15 12:52:00 -0700203 /**
204 * <pre>
205 * One request followed by one response.
206 * The server returns the client payload as-is.
207 * </pre>
208 */
nmittlerf8314582015-01-27 10:25:39 -0800209 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
zhangkun835e607852015-01-22 12:31:56 -0800210
nmittler7e8b5042016-04-15 12:52:00 -0700211 /**
212 * <pre>
213 * One request followed by a sequence of responses (streamed download).
214 * The server returns the payload with client desired type and sizes.
215 * </pre>
216 */
nmittlerf8314582015-01-27 10:25:39 -0800217 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
218 io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
zhangkun835e607852015-01-22 12:31:56 -0800219 }
220
nmittler7e8b5042016-04-15 12:52:00 -0700221 /**
222 * <pre>
223 * Test service that supports all call types.
224 * </pre>
225 */
ZHANG Dapengf149e4c2016-06-29 21:17:03 -0700226 @java.lang.Deprecated public static interface TestServiceFutureClient {
zhangkun835e607852015-01-22 12:31:56 -0800227
nmittler7e8b5042016-04-15 12:52:00 -0700228 /**
229 * <pre>
230 * One request followed by one response.
231 * The server returns the client payload as-is.
232 * </pre>
233 */
nmittlerf8314582015-01-27 10:25:39 -0800234 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
235 io.grpc.testing.integration.Test.SimpleRequest request);
zhangkun835e607852015-01-22 12:31:56 -0800236 }
237
Kun Zhangeb929672015-07-17 17:02:58 -0700238 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
zhangkun835e607852015-01-22 12:31:56 -0800239 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700240 private TestServiceStub(io.grpc.Channel channel) {
241 super(channel);
zhangkun835e607852015-01-22 12:31:56 -0800242 }
243
Kun Zhangd3c5b002015-06-25 20:24:01 -0700244 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700245 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700246 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700247 }
248
zhangkun835e607852015-01-22 12:31:56 -0800249 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800250 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700251 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700252 return new TestServiceStub(channel, callOptions);
zhangkun835e607852015-01-22 12:31:56 -0800253 }
254
255 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800256 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
257 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
zhangkun835e607852015-01-22 12:31:56 -0800258 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700259 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800260 }
261
262 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800263 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
264 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
zhangkun835e607852015-01-22 12:31:56 -0800265 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700266 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800267 }
268
269 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800270 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
271 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
zhangkun835e607852015-01-22 12:31:56 -0800272 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700273 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800274 }
275
276 @java.lang.Override
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700277 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
nmittlerf8314582015-01-27 10:25:39 -0800278 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700279 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700280 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800281 }
282
283 @java.lang.Override
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700284 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
nmittlerf8314582015-01-27 10:25:39 -0800285 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700286 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700287 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
zhangkun835e607852015-01-22 12:31:56 -0800288 }
289 }
290
Kun Zhangeb929672015-07-17 17:02:58 -0700291 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
zhangkun835e607852015-01-22 12:31:56 -0800292 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700293 private TestServiceBlockingStub(io.grpc.Channel channel) {
294 super(channel);
zhangkun835e607852015-01-22 12:31:56 -0800295 }
296
Kun Zhangd3c5b002015-06-25 20:24:01 -0700297 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700298 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700299 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700300 }
301
zhangkun835e607852015-01-22 12:31:56 -0800302 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800303 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700304 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700305 return new TestServiceBlockingStub(channel, callOptions);
zhangkun835e607852015-01-22 12:31:56 -0800306 }
307
308 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800309 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
zhangkun835e607852015-01-22 12:31:56 -0800310 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700311 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
zhangkun835e607852015-01-22 12:31:56 -0800312 }
313
314 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800315 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
316 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
zhangkun835e607852015-01-22 12:31:56 -0800317 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700318 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
zhangkun835e607852015-01-22 12:31:56 -0800319 }
320 }
321
Kun Zhangeb929672015-07-17 17:02:58 -0700322 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
zhangkun835e607852015-01-22 12:31:56 -0800323 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700324 private TestServiceFutureStub(io.grpc.Channel channel) {
325 super(channel);
zhangkun835e607852015-01-22 12:31:56 -0800326 }
327
Kun Zhangd3c5b002015-06-25 20:24:01 -0700328 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700329 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700330 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700331 }
332
zhangkun835e607852015-01-22 12:31:56 -0800333 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800334 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700335 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700336 return new TestServiceFutureStub(channel, callOptions);
zhangkun835e607852015-01-22 12:31:56 -0800337 }
338
339 @java.lang.Override
nmittlerf8314582015-01-27 10:25:39 -0800340 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
341 io.grpc.testing.integration.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700342 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700343 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
zhangkun835e607852015-01-22 12:31:56 -0800344 }
345 }
346
ZHANG Dapengf149e4c2016-06-29 21:17:03 -0700347 @java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
348
Eric Andersond52429d2015-11-13 16:50:08 -0800349 private static final int METHODID_UNARY_CALL = 0;
350 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
351 private static final int METHODID_STREAMING_INPUT_CALL = 2;
352 private static final int METHODID_FULL_BIDI_CALL = 3;
353 private static final int METHODID_HALF_BIDI_CALL = 4;
354
355 private static class MethodHandlers<Req, Resp> implements
356 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
357 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
358 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
359 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
360 private final TestService serviceImpl;
361 private final int methodId;
362
363 public MethodHandlers(TestService serviceImpl, int methodId) {
364 this.serviceImpl = serviceImpl;
365 this.methodId = methodId;
366 }
367
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800368 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800369 @java.lang.SuppressWarnings("unchecked")
370 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
371 switch (methodId) {
372 case METHODID_UNARY_CALL:
373 serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request,
374 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver);
375 break;
376 case METHODID_STREAMING_OUTPUT_CALL:
377 serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request,
378 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
379 break;
380 default:
381 throw new AssertionError();
382 }
383 }
384
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800385 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800386 @java.lang.SuppressWarnings("unchecked")
387 public io.grpc.stub.StreamObserver<Req> invoke(
388 io.grpc.stub.StreamObserver<Resp> responseObserver) {
389 switch (methodId) {
390 case METHODID_STREAMING_INPUT_CALL:
391 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
392 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
393 case METHODID_FULL_BIDI_CALL:
394 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
395 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
396 case METHODID_HALF_BIDI_CALL:
397 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
398 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
399 default:
400 throw new AssertionError();
401 }
402 }
403 }
404
Eric Anderson66ab9562016-06-20 15:22:23 -0700405 public static io.grpc.ServiceDescriptor getServiceDescriptor() {
406 return new io.grpc.ServiceDescriptor(SERVICE_NAME,
407 METHOD_UNARY_CALL,
408 METHOD_STREAMING_OUTPUT_CALL,
409 METHOD_STREAMING_INPUT_CALL,
410 METHOD_FULL_BIDI_CALL,
411 METHOD_HALF_BIDI_CALL);
412 }
413
ZHANG Dapengf149e4c2016-06-29 21:17:03 -0700414 @java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(
zhangkun835e607852015-01-22 12:31:56 -0800415 final TestService serviceImpl) {
Eric Anderson66ab9562016-06-20 15:22:23 -0700416 return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
Eric Andersond52429d2015-11-13 16:50:08 -0800417 .addMethod(
418 METHOD_UNARY_CALL,
419 asyncUnaryCall(
420 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700421 io.grpc.testing.integration.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800422 io.grpc.testing.integration.Test.SimpleResponse>(
423 serviceImpl, METHODID_UNARY_CALL)))
424 .addMethod(
425 METHOD_STREAMING_OUTPUT_CALL,
426 asyncServerStreamingCall(
427 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700428 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800429 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
430 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
431 .addMethod(
432 METHOD_STREAMING_INPUT_CALL,
433 asyncClientStreamingCall(
434 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700435 io.grpc.testing.integration.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800436 io.grpc.testing.integration.Test.StreamingInputCallResponse>(
437 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
438 .addMethod(
439 METHOD_FULL_BIDI_CALL,
440 asyncBidiStreamingCall(
441 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700442 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800443 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
444 serviceImpl, METHODID_FULL_BIDI_CALL)))
445 .addMethod(
446 METHOD_HALF_BIDI_CALL,
447 asyncBidiStreamingCall(
448 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700449 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800450 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
451 serviceImpl, METHODID_HALF_BIDI_CALL)))
452 .build();
zhangkun835e607852015-01-22 12:31:56 -0800453 }
454}