blob: b310d927e00dcfdc94882b20260f47f4ba68f403 [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
Carl Mastrangelo72f1e882016-02-29 18:05:33 -080018@javax.annotation.Generated(
19 value = "by gRPC proto compiler",
20 comments = "Source: test.proto")
Xiao Hangdcff3152015-02-20 15:03:06 -080021public class TestServiceGrpc {
22
Eric Andersonbe0d7e92015-09-10 09:47:17 -070023 private TestServiceGrpc() {}
24
David P. Baker66b984c2015-08-21 13:00:26 -040025 public static final String SERVICE_NAME = "grpc.testing.TestService";
26
Kun Zhang73acc732015-06-26 16:32:05 -070027 // Static method descriptors that strictly reflect the proto.
Eric Anderson1ee336d2015-10-02 20:09:10 -070028 private static final int ARG_IN_METHOD_UNARY_CALL = 0;
29 private static final int ARG_OUT_METHOD_UNARY_CALL = 1;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070030 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070031 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
32 io.grpc.testing.integration.nano.Test.SimpleResponse> METHOD_UNARY_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070033 io.grpc.MethodDescriptor.create(
34 io.grpc.MethodDescriptor.MethodType.UNARY,
Kun Zhang042b2782015-08-17 15:43:40 -070035 generateFullMethodName(
36 "grpc.testing.TestService", "UnaryCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070037 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070038 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070039 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.SimpleResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070040 new NanoFactory<io.grpc.testing.integration.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL))
41 );
42 private static final int ARG_IN_METHOD_STREAMING_OUTPUT_CALL = 2;
43 private static final int ARG_OUT_METHOD_STREAMING_OUTPUT_CALL = 3;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070044 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070045 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
46 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070047 io.grpc.MethodDescriptor.create(
48 io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070049 generateFullMethodName(
50 "grpc.testing.TestService", "StreamingOutputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070051 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070052 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070053 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070054 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL))
55 );
56 private static final int ARG_IN_METHOD_STREAMING_INPUT_CALL = 4;
57 private static final int ARG_OUT_METHOD_STREAMING_INPUT_CALL = 5;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070058 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070059 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
60 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070061 io.grpc.MethodDescriptor.create(
62 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070063 generateFullMethodName(
64 "grpc.testing.TestService", "StreamingInputCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070065 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070066 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070067 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070068 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL))
69 );
70 private static final int ARG_IN_METHOD_FULL_BIDI_CALL = 6;
71 private static final int ARG_OUT_METHOD_FULL_BIDI_CALL = 7;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070072 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070073 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
74 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070075 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070076 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070077 generateFullMethodName(
78 "grpc.testing.TestService", "FullBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070079 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070080 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070081 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070082 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL))
83 );
84 private static final int ARG_IN_METHOD_HALF_BIDI_CALL = 8;
85 private static final int ARG_OUT_METHOD_HALF_BIDI_CALL = 9;
Kun Zhang5bb0ea92015-08-31 09:56:44 -070086 @io.grpc.ExperimentalApi
Kun Zhangbd23a8d2015-08-28 18:47:06 -070087 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
88 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Kun Zhang73acc732015-06-26 16:32:05 -070089 io.grpc.MethodDescriptor.create(
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -070090 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
Kun Zhang042b2782015-08-17 15:43:40 -070091 generateFullMethodName(
92 "grpc.testing.TestService", "HalfBidiCall"),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070093 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070094 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)),
Kun Zhangbd23a8d2015-08-28 18:47:06 -070095 io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>marshaller(
Eric Anderson1ee336d2015-10-02 20:09:10 -070096 new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL))
97 );
98
99 private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
100 implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
101 private final int id;
102
103 NanoFactory(int id) {
104 this.id = id;
105 }
106
107 @Override
108 public T newInstance() {
109 Object o;
110 switch (id) {
111 case ARG_IN_METHOD_UNARY_CALL:
112 o = new io.grpc.testing.integration.nano.Test.SimpleRequest();
113 break;
114 case ARG_OUT_METHOD_UNARY_CALL:
115 o = new io.grpc.testing.integration.nano.Test.SimpleResponse();
116 break;
117 case ARG_IN_METHOD_STREAMING_OUTPUT_CALL:
118 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
119 break;
120 case ARG_OUT_METHOD_STREAMING_OUTPUT_CALL:
121 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
122 break;
123 case ARG_IN_METHOD_STREAMING_INPUT_CALL:
124 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallRequest();
125 break;
126 case ARG_OUT_METHOD_STREAMING_INPUT_CALL:
127 o = new io.grpc.testing.integration.nano.Test.StreamingInputCallResponse();
128 break;
129 case ARG_IN_METHOD_FULL_BIDI_CALL:
130 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
131 break;
132 case ARG_OUT_METHOD_FULL_BIDI_CALL:
133 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
134 break;
135 case ARG_IN_METHOD_HALF_BIDI_CALL:
136 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest();
137 break;
138 case ARG_OUT_METHOD_HALF_BIDI_CALL:
139 o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
140 break;
141 default:
142 throw new AssertionError();
143 }
144 @java.lang.SuppressWarnings("unchecked")
145 T t = (T) o;
146 return t;
147 }
148 }
Xiao Hangdcff3152015-02-20 15:03:06 -0800149
150 public static TestServiceStub newStub(io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700151 return new TestServiceStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800152 }
153
154 public static TestServiceBlockingStub newBlockingStub(
155 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700156 return new TestServiceBlockingStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800157 }
158
159 public static TestServiceFutureStub newFutureStub(
160 io.grpc.Channel channel) {
Kun Zhangeb929672015-07-17 17:02:58 -0700161 return new TestServiceFutureStub(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800162 }
163
164 public static interface TestService {
165
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700166 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
167 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800168
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700169 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
170 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800171
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700172 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
173 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800174
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700175 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
176 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800177
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700178 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
179 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800180 }
181
182 public static interface TestServiceBlockingClient {
183
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700184 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800185
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700186 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
187 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800188 }
189
190 public static interface TestServiceFutureClient {
191
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700192 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
193 io.grpc.testing.integration.nano.Test.SimpleRequest request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800194 }
195
Kun Zhangeb929672015-07-17 17:02:58 -0700196 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800197 implements TestService {
Kun Zhangeb929672015-07-17 17:02:58 -0700198 private TestServiceStub(io.grpc.Channel channel) {
199 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800200 }
201
Kun Zhangd3c5b002015-06-25 20:24:01 -0700202 private TestServiceStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700203 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700204 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700205 }
206
Xiao Hangdcff3152015-02-20 15:03:06 -0800207 @java.lang.Override
208 protected TestServiceStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700209 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700210 return new TestServiceStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800211 }
212
213 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700214 public void unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request,
215 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800216 asyncUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700217 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800218 }
219
220 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700221 public void streamingOutputCall(io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request,
222 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800223 asyncServerStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700224 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800225 }
226
227 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700228 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> streamingInputCall(
229 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800230 return asyncClientStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700231 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800232 }
233
234 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700235 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> fullBidiCall(
236 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700237 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700238 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800239 }
240
241 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700242 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest> halfBidiCall(
243 io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> responseObserver) {
Carl Mastrangelo67fc45d2015-08-05 13:56:50 -0700244 return asyncBidiStreamingCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700245 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
Xiao Hangdcff3152015-02-20 15:03:06 -0800246 }
247 }
248
Kun Zhangeb929672015-07-17 17:02:58 -0700249 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800250 implements TestServiceBlockingClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700251 private TestServiceBlockingStub(io.grpc.Channel channel) {
252 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800253 }
254
Kun Zhangd3c5b002015-06-25 20:24:01 -0700255 private TestServiceBlockingStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700256 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700257 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700258 }
259
Xiao Hangdcff3152015-02-20 15:03:06 -0800260 @java.lang.Override
261 protected TestServiceBlockingStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700262 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700263 return new TestServiceBlockingStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800264 }
265
266 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700267 public io.grpc.testing.integration.nano.Test.SimpleResponse unaryCall(io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800268 return blockingUnaryCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700269 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800270 }
271
272 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700273 public java.util.Iterator<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
274 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest request) {
Xiao Hangdcff3152015-02-20 15:03:06 -0800275 return blockingServerStreamingCall(
Eric Anderson4168f672015-08-04 16:37:00 -0700276 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800277 }
278 }
279
Kun Zhangeb929672015-07-17 17:02:58 -0700280 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
Xiao Hangdcff3152015-02-20 15:03:06 -0800281 implements TestServiceFutureClient {
Kun Zhangeb929672015-07-17 17:02:58 -0700282 private TestServiceFutureStub(io.grpc.Channel channel) {
283 super(channel);
Xiao Hangdcff3152015-02-20 15:03:06 -0800284 }
285
Kun Zhangd3c5b002015-06-25 20:24:01 -0700286 private TestServiceFutureStub(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700287 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700288 super(channel, callOptions);
Kun Zhangd3c5b002015-06-25 20:24:01 -0700289 }
290
Xiao Hangdcff3152015-02-20 15:03:06 -0800291 @java.lang.Override
292 protected TestServiceFutureStub build(io.grpc.Channel channel,
Kun Zhangd3c5b002015-06-25 20:24:01 -0700293 io.grpc.CallOptions callOptions) {
Kun Zhangeb929672015-07-17 17:02:58 -0700294 return new TestServiceFutureStub(channel, callOptions);
Xiao Hangdcff3152015-02-20 15:03:06 -0800295 }
296
297 @java.lang.Override
Kun Zhangbd23a8d2015-08-28 18:47:06 -0700298 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.nano.Test.SimpleResponse> unaryCall(
299 io.grpc.testing.integration.nano.Test.SimpleRequest request) {
Kun Zhang686dcff2015-07-16 12:34:37 -0700300 return futureUnaryCall(
Eric Anderson23e63182015-09-10 08:36:08 -0700301 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
Xiao Hangdcff3152015-02-20 15:03:06 -0800302 }
303 }
304
Eric Andersond52429d2015-11-13 16:50:08 -0800305 private static final int METHODID_UNARY_CALL = 0;
306 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
307 private static final int METHODID_STREAMING_INPUT_CALL = 2;
308 private static final int METHODID_FULL_BIDI_CALL = 3;
309 private static final int METHODID_HALF_BIDI_CALL = 4;
310
311 private static class MethodHandlers<Req, Resp> implements
312 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
313 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
314 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
315 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
316 private final TestService serviceImpl;
317 private final int methodId;
318
319 public MethodHandlers(TestService serviceImpl, int methodId) {
320 this.serviceImpl = serviceImpl;
321 this.methodId = methodId;
322 }
323
324 @java.lang.SuppressWarnings("unchecked")
325 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
326 switch (methodId) {
327 case METHODID_UNARY_CALL:
328 serviceImpl.unaryCall((io.grpc.testing.integration.nano.Test.SimpleRequest) request,
329 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse>) responseObserver);
330 break;
331 case METHODID_STREAMING_OUTPUT_CALL:
332 serviceImpl.streamingOutputCall((io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest) request,
333 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
334 break;
335 default:
336 throw new AssertionError();
337 }
338 }
339
340 @java.lang.SuppressWarnings("unchecked")
341 public io.grpc.stub.StreamObserver<Req> invoke(
342 io.grpc.stub.StreamObserver<Resp> responseObserver) {
343 switch (methodId) {
344 case METHODID_STREAMING_INPUT_CALL:
345 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
346 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
347 case METHODID_FULL_BIDI_CALL:
348 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
349 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
350 case METHODID_HALF_BIDI_CALL:
351 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
352 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
353 default:
354 throw new AssertionError();
355 }
356 }
357 }
358
Xiao Hangdcff3152015-02-20 15:03:06 -0800359 public static io.grpc.ServerServiceDefinition bindService(
360 final TestService serviceImpl) {
David P. Baker66b984c2015-08-21 13:00:26 -0400361 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
Eric Andersond52429d2015-11-13 16:50:08 -0800362 .addMethod(
363 METHOD_UNARY_CALL,
364 asyncUnaryCall(
365 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700366 io.grpc.testing.integration.nano.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800367 io.grpc.testing.integration.nano.Test.SimpleResponse>(
368 serviceImpl, METHODID_UNARY_CALL)))
369 .addMethod(
370 METHOD_STREAMING_OUTPUT_CALL,
371 asyncServerStreamingCall(
372 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700373 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800374 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
375 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
376 .addMethod(
377 METHOD_STREAMING_INPUT_CALL,
378 asyncClientStreamingCall(
379 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700380 io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800381 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
382 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
383 .addMethod(
384 METHOD_FULL_BIDI_CALL,
385 asyncBidiStreamingCall(
386 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700387 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800388 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
389 serviceImpl, METHODID_FULL_BIDI_CALL)))
390 .addMethod(
391 METHOD_HALF_BIDI_CALL,
392 asyncBidiStreamingCall(
393 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700394 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800395 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
396 serviceImpl, METHODID_HALF_BIDI_CALL)))
397 .build();
Xiao Hangdcff3152015-02-20 15:03:06 -0800398 }
399}