blob: da72d6fa4d30ca37e870283e7e995571199ac7ef [file] [log] [blame]
Eric Andersonb22bcdf2016-03-29 14:13:28 -07001package io.grpc.testing.integration;
Eric Anderson99a6d8d2016-03-22 11:31:36 -07002
3import static io.grpc.stub.ClientCalls.asyncUnaryCall;
4import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
5import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
7import static io.grpc.stub.ClientCalls.blockingUnaryCall;
8import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9import static io.grpc.stub.ClientCalls.futureUnaryCall;
10import static io.grpc.MethodDescriptor.generateFullMethodName;
11import static io.grpc.stub.ServerCalls.asyncUnaryCall;
12import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
13import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
14import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
15
16@javax.annotation.Generated(
17 value = "by gRPC proto compiler",
Eric Andersonb22bcdf2016-03-29 14:13:28 -070018 comments = "Source: test.proto")
Eric Anderson99a6d8d2016-03-22 11:31:36 -070019public class TestServiceGrpc {
20
21 private TestServiceGrpc() {}
22
Eric Andersonb22bcdf2016-03-29 14:13:28 -070023 public static final String SERVICE_NAME = "grpc.testing.TestService";
Eric Anderson99a6d8d2016-03-22 11:31:36 -070024
25 // Static method descriptors that strictly reflect the proto.
26 @io.grpc.ExperimentalApi
Eric Andersonb22bcdf2016-03-29 14:13:28 -070027 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
28 io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070029 io.grpc.MethodDescriptor.create(
30 io.grpc.MethodDescriptor.MethodType.UNARY,
31 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070032 "grpc.testing.TestService", "UnaryCall"),
33 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()),
34 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance()));
Eric Anderson99a6d8d2016-03-22 11:31:36 -070035 @io.grpc.ExperimentalApi
Eric Andersonb22bcdf2016-03-29 14:13:28 -070036 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
37 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070038 io.grpc.MethodDescriptor.create(
39 io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
40 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070041 "grpc.testing.TestService", "StreamingOutputCall"),
42 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
43 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
Eric Anderson99a6d8d2016-03-22 11:31:36 -070044 @io.grpc.ExperimentalApi
Eric Andersonb22bcdf2016-03-29 14:13:28 -070045 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
46 io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070047 io.grpc.MethodDescriptor.create(
48 io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING,
49 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070050 "grpc.testing.TestService", "StreamingInputCall"),
51 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()),
52 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()));
Eric Anderson99a6d8d2016-03-22 11:31:36 -070053 @io.grpc.ExperimentalApi
Eric Andersonb22bcdf2016-03-29 14:13:28 -070054 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
55 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070056 io.grpc.MethodDescriptor.create(
57 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
58 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070059 "grpc.testing.TestService", "FullBidiCall"),
60 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
61 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
Eric Anderson99a6d8d2016-03-22 11:31:36 -070062 @io.grpc.ExperimentalApi
Eric Andersonb22bcdf2016-03-29 14:13:28 -070063 public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
64 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL =
Eric Anderson99a6d8d2016-03-22 11:31:36 -070065 io.grpc.MethodDescriptor.create(
66 io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING,
67 generateFullMethodName(
Eric Andersonb22bcdf2016-03-29 14:13:28 -070068 "grpc.testing.TestService", "HalfBidiCall"),
69 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()),
70 io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance()));
Eric Anderson99a6d8d2016-03-22 11:31:36 -070071
72 public static TestServiceStub newStub(io.grpc.Channel channel) {
73 return new TestServiceStub(channel);
74 }
75
76 public static TestServiceBlockingStub newBlockingStub(
77 io.grpc.Channel channel) {
78 return new TestServiceBlockingStub(channel);
79 }
80
81 public static TestServiceFutureStub newFutureStub(
82 io.grpc.Channel channel) {
83 return new TestServiceFutureStub(channel);
84 }
85
86 public static interface TestService {
87
Eric Andersonb22bcdf2016-03-29 14:13:28 -070088 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
89 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -070090
Eric Andersonb22bcdf2016-03-29 14:13:28 -070091 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
92 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -070093
Eric Andersonb22bcdf2016-03-29 14:13:28 -070094 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
95 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -070096
Eric Andersonb22bcdf2016-03-29 14:13:28 -070097 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
98 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -070099
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700100 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
101 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700102 }
103
104 public static interface TestServiceBlockingClient {
105
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700106 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700107
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700108 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
109 io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700110 }
111
112 public static interface TestServiceFutureClient {
113
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700114 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
115 io.grpc.testing.integration.Test.SimpleRequest request);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700116 }
117
118 public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
119 implements TestService {
120 private TestServiceStub(io.grpc.Channel channel) {
121 super(channel);
122 }
123
124 private TestServiceStub(io.grpc.Channel channel,
125 io.grpc.CallOptions callOptions) {
126 super(channel, callOptions);
127 }
128
129 @java.lang.Override
130 protected TestServiceStub build(io.grpc.Channel channel,
131 io.grpc.CallOptions callOptions) {
132 return new TestServiceStub(channel, callOptions);
133 }
134
135 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700136 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
137 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700138 asyncUnaryCall(
139 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver);
140 }
141
142 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700143 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
144 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700145 asyncServerStreamingCall(
146 getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver);
147 }
148
149 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700150 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
151 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700152 return asyncClientStreamingCall(
153 getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver);
154 }
155
156 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700157 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
158 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700159 return asyncBidiStreamingCall(
160 getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver);
161 }
162
163 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700164 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
165 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700166 return asyncBidiStreamingCall(
167 getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver);
168 }
169 }
170
171 public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
172 implements TestServiceBlockingClient {
173 private TestServiceBlockingStub(io.grpc.Channel channel) {
174 super(channel);
175 }
176
177 private TestServiceBlockingStub(io.grpc.Channel channel,
178 io.grpc.CallOptions callOptions) {
179 super(channel, callOptions);
180 }
181
182 @java.lang.Override
183 protected TestServiceBlockingStub build(io.grpc.Channel channel,
184 io.grpc.CallOptions callOptions) {
185 return new TestServiceBlockingStub(channel, callOptions);
186 }
187
188 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700189 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700190 return blockingUnaryCall(
191 getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
192 }
193
194 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700195 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
196 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700197 return blockingServerStreamingCall(
198 getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request);
199 }
200 }
201
202 public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
203 implements TestServiceFutureClient {
204 private TestServiceFutureStub(io.grpc.Channel channel) {
205 super(channel);
206 }
207
208 private TestServiceFutureStub(io.grpc.Channel channel,
209 io.grpc.CallOptions callOptions) {
210 super(channel, callOptions);
211 }
212
213 @java.lang.Override
214 protected TestServiceFutureStub build(io.grpc.Channel channel,
215 io.grpc.CallOptions callOptions) {
216 return new TestServiceFutureStub(channel, callOptions);
217 }
218
219 @java.lang.Override
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700220 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
221 io.grpc.testing.integration.Test.SimpleRequest request) {
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700222 return futureUnaryCall(
223 getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
224 }
225 }
226
Lukasz Strzalkowskif8b71e72016-04-06 02:07:22 +0200227 public static abstract class AbstractTestService implements TestService, io.grpc.stub.BindableService {
228 @Override public io.grpc.ServerServiceDefinition bindService() {
229 return TestServiceGrpc.bindService(this);
230 }
231 }
232
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700233 private static final int METHODID_UNARY_CALL = 0;
234 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
235 private static final int METHODID_STREAMING_INPUT_CALL = 2;
236 private static final int METHODID_FULL_BIDI_CALL = 3;
237 private static final int METHODID_HALF_BIDI_CALL = 4;
238
239 private static class MethodHandlers<Req, Resp> implements
240 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
241 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
242 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
243 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
244 private final TestService serviceImpl;
245 private final int methodId;
246
247 public MethodHandlers(TestService serviceImpl, int methodId) {
248 this.serviceImpl = serviceImpl;
249 this.methodId = methodId;
250 }
251
252 @java.lang.Override
253 @java.lang.SuppressWarnings("unchecked")
254 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
255 switch (methodId) {
256 case METHODID_UNARY_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700257 serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request,
258 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700259 break;
260 case METHODID_STREAMING_OUTPUT_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700261 serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request,
262 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700263 break;
264 default:
265 throw new AssertionError();
266 }
267 }
268
269 @java.lang.Override
270 @java.lang.SuppressWarnings("unchecked")
271 public io.grpc.stub.StreamObserver<Req> invoke(
272 io.grpc.stub.StreamObserver<Resp> responseObserver) {
273 switch (methodId) {
274 case METHODID_STREAMING_INPUT_CALL:
275 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700276 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700277 case METHODID_FULL_BIDI_CALL:
278 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700279 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700280 case METHODID_HALF_BIDI_CALL:
281 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700282 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700283 default:
284 throw new AssertionError();
285 }
286 }
287 }
288
289 public static io.grpc.ServerServiceDefinition bindService(
290 final TestService serviceImpl) {
291 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
292 .addMethod(
293 METHOD_UNARY_CALL,
294 asyncUnaryCall(
295 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700296 io.grpc.testing.integration.Test.SimpleRequest,
297 io.grpc.testing.integration.Test.SimpleResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700298 serviceImpl, METHODID_UNARY_CALL)))
299 .addMethod(
300 METHOD_STREAMING_OUTPUT_CALL,
301 asyncServerStreamingCall(
302 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700303 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
304 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700305 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
306 .addMethod(
307 METHOD_STREAMING_INPUT_CALL,
308 asyncClientStreamingCall(
309 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700310 io.grpc.testing.integration.Test.StreamingInputCallRequest,
311 io.grpc.testing.integration.Test.StreamingInputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700312 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
313 .addMethod(
314 METHOD_FULL_BIDI_CALL,
315 asyncBidiStreamingCall(
316 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700317 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
318 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700319 serviceImpl, METHODID_FULL_BIDI_CALL)))
320 .addMethod(
321 METHOD_HALF_BIDI_CALL,
322 asyncBidiStreamingCall(
323 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700324 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
325 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700326 serviceImpl, METHODID_HALF_BIDI_CALL)))
327 .build();
328 }
329}