blob: 88dc9cd8624b5555db62892ac99ea36f3446a5fb [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
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080020@javax.annotation.Generated(
21 value = "by gRPC proto compiler",
22 comments = "Source: test.proto")
Xiao Hangdcff3152015-02-20 15:03:06 -080023public class TestServiceGrpc {
24
Eric Andersonbe0d7e92015-09-10 09:47:17 -070025 private TestServiceGrpc() {}
26
David P. Baker66b984c2015-08-21 13:00:26 -040027 public static final String SERVICE_NAME = "grpc.testing.TestService";
28
Kun Zhang73acc732015-06-26 16:32:05 -070029 // Static method descriptors that strictly reflect the proto.
Eric Anderson1ee336d2015-10-02 20:09:10 -070030 private static final int ARG_IN_METHOD_UNARY_CALL = 0;
31 private static final int ARG_OUT_METHOD_UNARY_CALL = 1;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070032 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070033 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
34 io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070035 io.grpc.MethodDescriptor.create(
36 io.grpc.MethodDescriptor.MethodType.UNARY,
Kun Zhang042b2782015-08-17 15:43:40 -070037 generateFullMethodName(
38 "grpc.testing.TestService", "UnaryCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070039 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070040 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070041 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070042 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL))
43 );
44 private static final int ARG_IN_METHOD_STREAMING_OUTPUT_CALL = 2;
45 private static final int ARG_OUT_METHOD_STREAMING_OUTPUT_CALL = 3;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070046 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070047 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
48 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070049 io.grpc.MethodDescriptor.create(
50 io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070051 generateFullMethodName(
52 "grpc.testing.TestService", "StreamingOutputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070053 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070054 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070055 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070056 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL))
57 );
58 private static final int ARG_IN_METHOD_STREAMING_INPUT_CALL = 4;
59 private static final int ARG_OUT_METHOD_STREAMING_INPUT_CALL = 5;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070060 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070061 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
62 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070063 io.grpc.MethodDescriptor.create(
64 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070065 generateFullMethodName(
66 "grpc.testing.TestService", "StreamingInputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070067 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070068 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070069 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070070 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL))
71 );
72 private static final int ARG_IN_METHOD_FULL_BIDI_CALL = 6;
73 private static final int ARG_OUT_METHOD_FULL_BIDI_CALL = 7;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070074 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070075 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
76 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070077 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070078 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070079 generateFullMethodName(
80 "grpc.testing.TestService", "FullBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070081 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070082 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070083 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070084 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL))
85 );
86 private static final int ARG_IN_METHOD_HALF_BIDI_CALL = 8;
87 private static final int ARG_OUT_METHOD_HALF_BIDI_CALL = 9;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070088 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070089 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
90 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070091 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070092 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070093 generateFullMethodName(
94 "grpc.testing.TestService", "HalfBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070095 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070096 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070097 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070098 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL))
99 );
100
101 private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
102 implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
103 private final int id;
104
105 NanoFactory(int id) {
106 this.id = id;
107 }
108
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200109 @java.lang.Override
Eric Anderson1ee336d2015-10-02 20:09:10 -0700110 public T newInstance() {
111 Object o;
112 switch (id) {
113 case ARG_IN_METHOD_UNARY_CALL:
114 o = new io.grpc.testing.integration.nano.Test.SimpleRequest();
115 break;
116 case ARG_OUT_METHOD_UNARY_CALL:
117 o = new io.grpc.testing.integration.nano.Test.SimpleResponse();
118 break;
119 case ARG_IN_METHOD_STREAMING_OUTPUT_CALL:
120 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
121 break;
122 case ARG_OUT_METHOD_STREAMING_OUTPUT_CALL:
123 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
124 break;
125 case ARG_IN_METHOD_STREAMING_INPUT_CALL:
126 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallRequest();
127 break;
128 case ARG_OUT_METHOD_STREAMING_INPUT_CALL:
129 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallResponse();
130 break;
131 case ARG_IN_METHOD_FULL_BIDI_CALL:
132 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
133 break;
134 case ARG_OUT_METHOD_FULL_BIDI_CALL:
135 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
136 break;
137 case ARG_IN_METHOD_HALF_BIDI_CALL:
138 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
139 break;
140 case ARG_OUT_METHOD_HALF_BIDI_CALL:
141 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
142 break;
143 default:
144 throw new AssertionError();
145 }
146 @java.lang.SuppressWarnings("unchecked")
147 T t = (T) o;
148 return t;
149 }
150 }
Xiao Hangdcff3152015-02-20 15:03:06 -0800151
152 public static TestServiceStub newStub(io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700153 return new TestServiceStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800154 }
155
156 public static TestServiceBlockingStub newBlockingStub(
157 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700158 return new TestServiceBlockingStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800159 }
160
161 public static TestServiceFutureStub newFutureStub(
162 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700163 return new TestServiceFutureStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800164 }
165
166 public static interface TestService {
167
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700168 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
169 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800170
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700171 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
172 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800173
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700174 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
175 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800176
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700177 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
178 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800179
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700180 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
181 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800182 }
183
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200184 public static abstract class AbstractTestService implements TestService, io.grpc.BindableService {
185
186 @java.lang.Override
187 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
188 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
189 asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
190 }
191
192 @java.lang.Override
193 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
194 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
195 asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
196 }
197
198 @java.lang.Override
199 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
200 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
201 return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
202 }
203
204 @java.lang.Override
205 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
206 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
207 return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
208 }
209
210 @java.lang.Override
211 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
212 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
213 return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
214 }
215
216 @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
217 return TestServiceGrpc.bindService(this);
218 }
219 }
220
Xiao Hangdcff3152015-02-20 15:03:06 -0800221 public static interface TestServiceBlockingClient {
222
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700223 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800224
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700225 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
226 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800227 }
228
229 public static interface TestServiceFutureClient {
230
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700231 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
232 io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800233 }
234
Kun Zhangeb929672015-07-17 17:02:58 -0700235 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800236 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700237 private TestServiceStub(io.grpc.Channel channel) {
238 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800239 }
240
Kun Zhangd3c5b002015-06-25 20:24:01 -0700241 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700242 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700243 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700244 }
245
Xiao Hangdcff3152015-02-20 15:03:06 -0800246 @java.lang.Override
247 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700248 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700249 return new TestServiceStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800250 }
251
252 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700253 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
254 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800255 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700256 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800257 }
258
259 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700260 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
261 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800262 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700263 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800264 }
265
266 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700267 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
268 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800269 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700270 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800271 }
272
273 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700274 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
275 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700276 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700277 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800278 }
279
280 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700281 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
282 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700283 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700284 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800285 }
286 }
287
Kun Zhangeb929672015-07-17 17:02:58 -0700288 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800289 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700290 private TestServiceBlockingStub(io.grpc.Channel channel) {
291 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800292 }
293
Kun Zhangd3c5b002015-06-25 20:24:01 -0700294 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700295 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700296 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700297 }
298
Xiao Hangdcff3152015-02-20 15:03:06 -0800299 @java.lang.Override
300 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700301 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700302 return new TestServiceBlockingStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800303 }
304
305 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700306 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800307 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700308 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800309 }
310
311 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700312 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
313 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800314 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700315 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800316 }
317 }
318
Kun Zhangeb929672015-07-17 17:02:58 -0700319 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800320 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700321 private TestServiceFutureStub(io.grpc.Channel channel) {
322 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800323 }
324
Kun Zhangd3c5b002015-06-25 20:24:01 -0700325 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700326 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700327 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700328 }
329
Xiao Hangdcff3152015-02-20 15:03:06 -0800330 @java.lang.Override
331 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700332 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700333 return new TestServiceFutureStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800334 }
335
336 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700337 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
338 io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700339 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700340 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800341 }
342 }
343
Eric Andersond52429d2015-11-13 16:50:08 -0800344 private static final int METHODID_UNARY_CALL = 0;
345 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
346 private static final int METHODID_STREAMING_INPUT_CALL = 2;
347 private static final int METHODID_FULL_BIDI_CALL = 3;
348 private static final int METHODID_HALF_BIDI_CALL = 4;
349
350 private static class MethodHandlers<Req, Resp> implements
351 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
352 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
353 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
354 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
355 private final TestService serviceImpl;
356 private final int methodId;
357
358 public MethodHandlers(TestService serviceImpl, int methodId) {
359 this.serviceImpl = serviceImpl;
360 this.methodId = methodId;
361 }
362
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800363 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800364 @java.lang.SuppressWarnings("unchecked")
365 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
366 switch (methodId) {
367 case METHODID_UNARY_CALL:
368 serviceImpl.unaryCall((io.grpc.testing.integration.nano.Test.SimpleRequest) request,
369 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse>) responseObserver);
370 break;
371 case METHODID_STREAMING_OUTPUT_CALL:
372 serviceImpl.streamingOutputCall((io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest) request,
373 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
374 break;
375 default:
376 throw new AssertionError();
377 }
378 }
379
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800380 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800381 @java.lang.SuppressWarnings("unchecked")
382 public io.grpc.stub.StreamObserver<Req> invoke(
383 io.grpc.stub.StreamObserver<Resp> responseObserver) {
384 switch (methodId) {
385 case METHODID_STREAMING_INPUT_CALL:
386 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
387 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
388 case METHODID_FULL_BIDI_CALL:
389 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
390 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
391 case METHODID_HALF_BIDI_CALL:
392 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
393 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
394 default:
395 throw new AssertionError();
396 }
397 }
398 }
399
Xiao Hangdcff3152015-02-20 15:03:06 -0800400 public static io.grpc.ServerServiceDefinition bindService(
401 final TestService serviceImpl) {
David P. Baker66b984c2015-08-21 13:00:26 -0400402 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
Eric Andersond52429d2015-11-13 16:50:08 -0800403 .addMethod(
404 METHOD_UNARY_CALL,
405 asyncUnaryCall(
406 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700407 io.grpc.testing.integration.nano.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800408 io.grpc.testing.integration.nano.Test.SimpleResponse>(
409 serviceImpl, METHODID_UNARY_CALL)))
410 .addMethod(
411 METHOD_STREAMING_OUTPUT_CALL,
412 asyncServerStreamingCall(
413 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700414 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800415 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
416 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
417 .addMethod(
418 METHOD_STREAMING_INPUT_CALL,
419 asyncClientStreamingCall(
420 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700421 io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800422 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
423 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
424 .addMethod(
425 METHOD_FULL_BIDI_CALL,
426 asyncBidiStreamingCall(
427 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700428 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800429 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
430 serviceImpl, METHODID_FULL_BIDI_CALL)))
431 .addMethod(
432 METHOD_HALF_BIDI_CALL,
433 asyncBidiStreamingCall(
434 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700435 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800436 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
437 serviceImpl, METHODID_HALF_BIDI_CALL)))
438 .build();
Xiao Hangdcff3152015-02-20 15:03:06 -0800439 }
440}