blob: 4d8d1bac106f4efeeb077044fb088020ce558967 [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;
Xiao Hangdcff3152015-02-20 15:03:06 -080015
16import java.io.IOException;
17
18@javax.annotation.Generated("by gRPC proto compiler")
19public class TestServiceGrpc {
20
Eric Andersonbe0d7e92015-09-10 09:47:17 -070021 private TestServiceGrpc() {}
22
David P. Baker66b984c2015-08-21 13:00:26 -040023 public static final String SERVICE_NAME = "grpc.testing.TestService";
24
Kun Zhang73acc732015-06-26 16:32:05 -070025 // Static method descriptors that strictly reflect the proto.
Eric Anderson1ee336d2015-10-02 20:09:10 -070026 private static final int ARG_IN_METHOD_UNARY_CALL = 0;
27 private static final int ARG_OUT_METHOD_UNARY_CALL = 1;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070028 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070029 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
30 io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070031 io.grpc.MethodDescriptor.create(
32 io.grpc.MethodDescriptor.MethodType.UNARY,
Kun Zhang042b2782015-08-17 15:43:40 -070033 generateFullMethodName(
34 "grpc.testing.TestService", "UnaryCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070035 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070036 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070037 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070038 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL))
39 );
40 private static final int ARG_IN_METHOD_STREAMING_OUTPUT_CALL = 2;
41 private static final int ARG_OUT_METHOD_STREAMING_OUTPUT_CALL = 3;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070042 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070043 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
44 io.grpc.testing.integration.nano.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"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070049 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070050 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070051 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070052 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL))
53 );
54 private static final int ARG_IN_METHOD_STREAMING_INPUT_CALL = 4;
55 private static final int ARG_OUT_METHOD_STREAMING_INPUT_CALL = 5;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070056 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070057 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
58 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070059 io.grpc.MethodDescriptor.create(
60 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070061 generateFullMethodName(
62 "grpc.testing.TestService", "StreamingInputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070063 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070064 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070065 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070066 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL))
67 );
68 private static final int ARG_IN_METHOD_FULL_BIDI_CALL = 6;
69 private static final int ARG_OUT_METHOD_FULL_BIDI_CALL = 7;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070070 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070071 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
72 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070073 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070074 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070075 generateFullMethodName(
76 "grpc.testing.TestService", "FullBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070077 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070078 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070079 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070080 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL))
81 );
82 private static final int ARG_IN_METHOD_HALF_BIDI_CALL = 8;
83 private static final int ARG_OUT_METHOD_HALF_BIDI_CALL = 9;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070084 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070085 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
86 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070087 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070088 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070089 generateFullMethodName(
90 "grpc.testing.TestService", "HalfBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070091 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070092 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070093 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070094 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL))
95 );
96
97 private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
98 implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
99 private final int id;
100
101 NanoFactory(int id) {
102 this.id = id;
103 }
104
105 @Override
106 public T newInstance() {
107 Object o;
108 switch (id) {
109 case ARG_IN_METHOD_UNARY_CALL:
110 o = new io.grpc.testing.integration.nano.Test.SimpleRequest();
111 break;
112 case ARG_OUT_METHOD_UNARY_CALL:
113 o = new io.grpc.testing.integration.nano.Test.SimpleResponse();
114 break;
115 case ARG_IN_METHOD_STREAMING_OUTPUT_CALL:
116 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
117 break;
118 case ARG_OUT_METHOD_STREAMING_OUTPUT_CALL:
119 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
120 break;
121 case ARG_IN_METHOD_STREAMING_INPUT_CALL:
122 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallRequest();
123 break;
124 case ARG_OUT_METHOD_STREAMING_INPUT_CALL:
125 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallResponse();
126 break;
127 case ARG_IN_METHOD_FULL_BIDI_CALL:
128 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
129 break;
130 case ARG_OUT_METHOD_FULL_BIDI_CALL:
131 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
132 break;
133 case ARG_IN_METHOD_HALF_BIDI_CALL:
134 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
135 break;
136 case ARG_OUT_METHOD_HALF_BIDI_CALL:
137 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
138 break;
139 default:
140 throw new AssertionError();
141 }
142 @java.lang.SuppressWarnings("unchecked")
143 T t = (T) o;
144 return t;
145 }
146 }
Xiao Hangdcff3152015-02-20 15:03:06 -0800147
148 public static TestServiceStub newStub(io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700149 return new TestServiceStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800150 }
151
152 public static TestServiceBlockingStub newBlockingStub(
153 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700154 return new TestServiceBlockingStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800155 }
156
157 public static TestServiceFutureStub newFutureStub(
158 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700159 return new TestServiceFutureStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800160 }
161
162 public static interface TestService {
163
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700164 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
165 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800166
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700167 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
168 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800169
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700170 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
171 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800172
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700173 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
174 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800175
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700176 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
177 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800178 }
179
180 public static interface TestServiceBlockingClient {
181
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700182 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800183
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700184 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
185 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800186 }
187
188 public static interface TestServiceFutureClient {
189
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700190 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
191 io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800192 }
193
Kun Zhangeb929672015-07-17 17:02:58 -0700194 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800195 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700196 private TestServiceStub(io.grpc.Channel channel) {
197 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800198 }
199
Kun Zhangd3c5b002015-06-25 20:24:01 -0700200 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700201 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700202 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700203 }
204
Xiao Hangdcff3152015-02-20 15:03:06 -0800205 @java.lang.Override
206 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700207 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700208 return new TestServiceStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800209 }
210
211 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700212 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
213 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800214 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700215 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800216 }
217
218 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700219 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
220 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800221 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700222 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800223 }
224
225 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700226 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
227 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800228 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700229 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800230 }
231
232 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700233 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
234 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700235 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700236 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800237 }
238
239 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700240 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
241 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700242 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700243 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800244 }
245 }
246
Kun Zhangeb929672015-07-17 17:02:58 -0700247 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800248 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700249 private TestServiceBlockingStub(io.grpc.Channel channel) {
250 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800251 }
252
Kun Zhangd3c5b002015-06-25 20:24:01 -0700253 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700254 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700255 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700256 }
257
Xiao Hangdcff3152015-02-20 15:03:06 -0800258 @java.lang.Override
259 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700260 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700261 return new TestServiceBlockingStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800262 }
263
264 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700265 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800266 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700267 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800268 }
269
270 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700271 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
272 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800273 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700274 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800275 }
276 }
277
Kun Zhangeb929672015-07-17 17:02:58 -0700278 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800279 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700280 private TestServiceFutureStub(io.grpc.Channel channel) {
281 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800282 }
283
Kun Zhangd3c5b002015-06-25 20:24:01 -0700284 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700285 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700286 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700287 }
288
Xiao Hangdcff3152015-02-20 15:03:06 -0800289 @java.lang.Override
290 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700291 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700292 return new TestServiceFutureStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800293 }
294
295 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700296 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
297 io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700298 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700299 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800300 }
301 }
302
Eric Andersond52429d2015-11-13 16:50:08 -0800303 private static final int METHODID_UNARY_CALL = 0;
304 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
305 private static final int METHODID_STREAMING_INPUT_CALL = 2;
306 private static final int METHODID_FULL_BIDI_CALL = 3;
307 private static final int METHODID_HALF_BIDI_CALL = 4;
308
309 private static class MethodHandlers<Req, Resp> implements
310 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
311 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
312 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
313 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
314 private final TestService serviceImpl;
315 private final int methodId;
316
317 public MethodHandlers(TestService serviceImpl, int methodId) {
318 this.serviceImpl = serviceImpl;
319 this.methodId = methodId;
320 }
321
322 @java.lang.SuppressWarnings("unchecked")
323 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
324 switch (methodId) {
325 case METHODID_UNARY_CALL:
326 serviceImpl.unaryCall((io.grpc.testing.integration.nano.Test.SimpleRequest) request,
327 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse>) responseObserver);
328 break;
329 case METHODID_STREAMING_OUTPUT_CALL:
330 serviceImpl.streamingOutputCall((io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest) request,
331 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
332 break;
333 default:
334 throw new AssertionError();
335 }
336 }
337
338 @java.lang.SuppressWarnings("unchecked")
339 public io.grpc.stub.StreamObserver<Req> invoke(
340 io.grpc.stub.StreamObserver<Resp> responseObserver) {
341 switch (methodId) {
342 case METHODID_STREAMING_INPUT_CALL:
343 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
344 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
345 case METHODID_FULL_BIDI_CALL:
346 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
347 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
348 case METHODID_HALF_BIDI_CALL:
349 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
350 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
351 default:
352 throw new AssertionError();
353 }
354 }
355 }
356
Xiao Hangdcff3152015-02-20 15:03:06 -0800357 public static io.grpc.ServerServiceDefinition bindService(
358 final TestService serviceImpl) {
David P. Baker66b984c2015-08-21 13:00:26 -0400359 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
Eric Andersond52429d2015-11-13 16:50:08 -0800360 .addMethod(
361 METHOD_UNARY_CALL,
362 asyncUnaryCall(
363 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700364 io.grpc.testing.integration.nano.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800365 io.grpc.testing.integration.nano.Test.SimpleResponse>(
366 serviceImpl, METHODID_UNARY_CALL)))
367 .addMethod(
368 METHOD_STREAMING_OUTPUT_CALL,
369 asyncServerStreamingCall(
370 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700371 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800372 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
373 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
374 .addMethod(
375 METHOD_STREAMING_INPUT_CALL,
376 asyncClientStreamingCall(
377 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700378 io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800379 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
380 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
381 .addMethod(
382 METHOD_FULL_BIDI_CALL,
383 asyncBidiStreamingCall(
384 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700385 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800386 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
387 serviceImpl, METHODID_FULL_BIDI_CALL)))
388 .addMethod(
389 METHOD_HALF_BIDI_CALL,
390 asyncBidiStreamingCall(
391 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700392 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800393 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
394 serviceImpl, METHODID_HALF_BIDI_CALL)))
395 .build();
Xiao Hangdcff3152015-02-20 15:03:06 -0800396 }
397}