blob: 1f2c91c3613550617aa6108a4b602be74b53ae39 [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(
Lukasz Strzalkowski363e0f62016-04-11 19:34:15 +020021 value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080022 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
Eric Anderson9bc5d932016-04-19 09:36:24 -0700184 @io.grpc.ExperimentalApi
Lukasz Strzalkowski2fbf1422016-04-08 02:28:32 +0200185 public static abstract class AbstractTestService implements TestService, io.grpc.BindableService {
186
187 @java.lang.Override
188 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
189 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
190 asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
191 }
192
193 @java.lang.Override
194 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
195 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
196 asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
197 }
198
199 @java.lang.Override
200 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
201 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
202 return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
203 }
204
205 @java.lang.Override
206 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
207 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
208 return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
209 }
210
211 @java.lang.Override
212 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
213 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
214 return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
215 }
216
217 @java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
218 return TestServiceGrpc.bindService(this);
219 }
220 }
221
Xiao Hangdcff3152015-02-20 15:03:06 -0800222 public static interface TestServiceBlockingClient {
223
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700224 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800225
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700226 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
227 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800228 }
229
230 public static interface TestServiceFutureClient {
231
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700232 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
233 io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800234 }
235
Kun Zhangeb929672015-07-17 17:02:58 -0700236 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800237 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700238 private TestServiceStub(io.grpc.Channel channel) {
239 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800240 }
241
Kun Zhangd3c5b002015-06-25 20:24:01 -0700242 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700243 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700244 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700245 }
246
Xiao Hangdcff3152015-02-20 15:03:06 -0800247 @java.lang.Override
248 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700249 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700250 return new TestServiceStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800251 }
252
253 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700254 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
255 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800256 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700257 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800258 }
259
260 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700261 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
262 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800263 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700264 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800265 }
266
267 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700268 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
269 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800270 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700271 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800272 }
273
274 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700275 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
276 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700277 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700278 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800279 }
280
281 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700282 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
283 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700284 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700285 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800286 }
287 }
288
Kun Zhangeb929672015-07-17 17:02:58 -0700289 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800290 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700291 private TestServiceBlockingStub(io.grpc.Channel channel) {
292 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800293 }
294
Kun Zhangd3c5b002015-06-25 20:24:01 -0700295 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700296 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700297 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700298 }
299
Xiao Hangdcff3152015-02-20 15:03:06 -0800300 @java.lang.Override
301 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700302 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700303 return new TestServiceBlockingStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800304 }
305
306 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700307 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800308 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700309 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800310 }
311
312 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700313 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
314 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800315 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700316 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800317 }
318 }
319
Kun Zhangeb929672015-07-17 17:02:58 -0700320 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800321 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700322 private TestServiceFutureStub(io.grpc.Channel channel) {
323 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800324 }
325
Kun Zhangd3c5b002015-06-25 20:24:01 -0700326 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700327 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700328 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700329 }
330
Xiao Hangdcff3152015-02-20 15:03:06 -0800331 @java.lang.Override
332 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700333 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700334 return new TestServiceFutureStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800335 }
336
337 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700338 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
339 io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700340 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700341 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800342 }
343 }
344
Eric Andersond52429d2015-11-13 16:50:08 -0800345 private static final int METHODID_UNARY_CALL = 0;
346 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
347 private static final int METHODID_STREAMING_INPUT_CALL = 2;
348 private static final int METHODID_FULL_BIDI_CALL = 3;
349 private static final int METHODID_HALF_BIDI_CALL = 4;
350
351 private static class MethodHandlers<Req, Resp> implements
352 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
353 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
354 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
355 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
356 private final TestService serviceImpl;
357 private final int methodId;
358
359 public MethodHandlers(TestService serviceImpl, int methodId) {
360 this.serviceImpl = serviceImpl;
361 this.methodId = methodId;
362 }
363
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800364 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800365 @java.lang.SuppressWarnings("unchecked")
366 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
367 switch (methodId) {
368 case METHODID_UNARY_CALL:
369 serviceImpl.unaryCall((io.grpc.testing.integration.nano.Test.SimpleRequest) request,
370 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse>) responseObserver);
371 break;
372 case METHODID_STREAMING_OUTPUT_CALL:
373 serviceImpl.streamingOutputCall((io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest) request,
374 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
375 break;
376 default:
377 throw new AssertionError();
378 }
379 }
380
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800381 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800382 @java.lang.SuppressWarnings("unchecked")
383 public io.grpc.stub.StreamObserver<Req> invoke(
384 io.grpc.stub.StreamObserver<Resp> responseObserver) {
385 switch (methodId) {
386 case METHODID_STREAMING_INPUT_CALL:
387 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
388 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
389 case METHODID_FULL_BIDI_CALL:
390 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
391 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
392 case METHODID_HALF_BIDI_CALL:
393 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
394 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
395 default:
396 throw new AssertionError();
397 }
398 }
399 }
400
Xiao Hangdcff3152015-02-20 15:03:06 -0800401 public static io.grpc.ServerServiceDefinition bindService(
402 final TestService serviceImpl) {
David P. Baker66b984c2015-08-21 13:00:26 -0400403 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
Eric Andersond52429d2015-11-13 16:50:08 -0800404 .addMethod(
405 METHOD_UNARY_CALL,
406 asyncUnaryCall(
407 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700408 io.grpc.testing.integration.nano.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800409 io.grpc.testing.integration.nano.Test.SimpleResponse>(
410 serviceImpl, METHODID_UNARY_CALL)))
411 .addMethod(
412 METHOD_STREAMING_OUTPUT_CALL,
413 asyncServerStreamingCall(
414 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700415 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800416 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
417 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
418 .addMethod(
419 METHOD_STREAMING_INPUT_CALL,
420 asyncClientStreamingCall(
421 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700422 io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800423 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
424 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
425 .addMethod(
426 METHOD_FULL_BIDI_CALL,
427 asyncBidiStreamingCall(
428 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700429 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800430 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
431 serviceImpl, METHODID_FULL_BIDI_CALL)))
432 .addMethod(
433 METHOD_HALF_BIDI_CALL,
434 asyncBidiStreamingCall(
435 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700436 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800437 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
438 serviceImpl, METHODID_HALF_BIDI_CALL)))
439 .build();
Xiao Hangdcff3152015-02-20 15:03:06 -0800440 }
441}