blob: 0be68b1026fbc74d562713f4f5d1d63c4209ef5e [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
Łukasz Strzałkowski90fbf9b2016-04-08 20:14:26 +0200305 public static abstract class AbstractTestService implements TestService, io.grpc.BindableService {
Lukasz Strzalkowskif8b71e72016-04-06 02:07:22 +0200306 @Override public io.grpc.ServerServiceDefinition bindService() {
307 return TestServiceGrpc.bindService(this);
308 }
309 }
310
Eric Andersond52429d2015-11-13 16:50:08 -0800311 private static final int METHODID_UNARY_CALL = 0;
312 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
313 private static final int METHODID_STREAMING_INPUT_CALL = 2;
314 private static final int METHODID_FULL_BIDI_CALL = 3;
315 private static final int METHODID_HALF_BIDI_CALL = 4;
316
317 private static class MethodHandlers<Req, Resp> implements
318 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
319 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
320 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
321 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
322 private final TestService serviceImpl;
323 private final int methodId;
324
325 public MethodHandlers(TestService serviceImpl, int methodId) {
326 this.serviceImpl = serviceImpl;
327 this.methodId = methodId;
328 }
329
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800330 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800331 @java.lang.SuppressWarnings("unchecked")
332 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
333 switch (methodId) {
334 case METHODID_UNARY_CALL:
335 serviceImpl.unaryCall((io.grpc.testing.integration.nano.Test.SimpleRequest) request,
336 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.SimpleResponse>) responseObserver);
337 break;
338 case METHODID_STREAMING_OUTPUT_CALL:
339 serviceImpl.streamingOutputCall((io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest) request,
340 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
341 break;
342 default:
343 throw new AssertionError();
344 }
345 }
346
Carl Mastrangeloffe0dce2016-03-04 14:15:02 -0800347 @java.lang.Override
Eric Andersond52429d2015-11-13 16:50:08 -0800348 @java.lang.SuppressWarnings("unchecked")
349 public io.grpc.stub.StreamObserver<Req> invoke(
350 io.grpc.stub.StreamObserver<Resp> responseObserver) {
351 switch (methodId) {
352 case METHODID_STREAMING_INPUT_CALL:
353 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
354 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
355 case METHODID_FULL_BIDI_CALL:
356 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
357 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
358 case METHODID_HALF_BIDI_CALL:
359 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
360 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
361 default:
362 throw new AssertionError();
363 }
364 }
365 }
366
Xiao Hangdcff3152015-02-20 15:03:06 -0800367 public static io.grpc.ServerServiceDefinition bindService(
368 final TestService serviceImpl) {
David P. Baker66b984c2015-08-21 13:00:26 -0400369 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
Eric Andersond52429d2015-11-13 16:50:08 -0800370 .addMethod(
371 METHOD_UNARY_CALL,
372 asyncUnaryCall(
373 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700374 io.grpc.testing.integration.nano.Test.SimpleRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800375 io.grpc.testing.integration.nano.Test.SimpleResponse>(
376 serviceImpl, METHODID_UNARY_CALL)))
377 .addMethod(
378 METHOD_STREAMING_OUTPUT_CALL,
379 asyncServerStreamingCall(
380 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700381 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800382 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
383 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
384 .addMethod(
385 METHOD_STREAMING_INPUT_CALL,
386 asyncClientStreamingCall(
387 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700388 io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800389 io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
390 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
391 .addMethod(
392 METHOD_FULL_BIDI_CALL,
393 asyncBidiStreamingCall(
394 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700395 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800396 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
397 serviceImpl, METHODID_FULL_BIDI_CALL)))
398 .addMethod(
399 METHOD_HALF_BIDI_CALL,
400 asyncBidiStreamingCall(
401 new MethodHandlers<
Eric Andersona6621da2015-09-10 17:37:21 -0700402 io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
Eric Andersond52429d2015-11-13 16:50:08 -0800403 io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
404 serviceImpl, METHODID_HALF_BIDI_CALL)))
405 .build();
Xiao Hangdcff3152015-02-20 15:03:06 -0800406 }
407}