blob: c46ee56fd1c38463bac3ebf618afe6215fab2744 [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
227 private static final int METHODID_UNARY_CALL = 0;
228 private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
229 private static final int METHODID_STREAMING_INPUT_CALL = 2;
230 private static final int METHODID_FULL_BIDI_CALL = 3;
231 private static final int METHODID_HALF_BIDI_CALL = 4;
232
233 private static class MethodHandlers<Req, Resp> implements
234 io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
235 io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
236 io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
237 io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
238 private final TestService serviceImpl;
239 private final int methodId;
240
241 public MethodHandlers(TestService serviceImpl, int methodId) {
242 this.serviceImpl = serviceImpl;
243 this.methodId = methodId;
244 }
245
246 @java.lang.Override
247 @java.lang.SuppressWarnings("unchecked")
248 public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
249 switch (methodId) {
250 case METHODID_UNARY_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700251 serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request,
252 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700253 break;
254 case METHODID_STREAMING_OUTPUT_CALL:
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700255 serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request,
256 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700257 break;
258 default:
259 throw new AssertionError();
260 }
261 }
262
263 @java.lang.Override
264 @java.lang.SuppressWarnings("unchecked")
265 public io.grpc.stub.StreamObserver<Req> invoke(
266 io.grpc.stub.StreamObserver<Resp> responseObserver) {
267 switch (methodId) {
268 case METHODID_STREAMING_INPUT_CALL:
269 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700270 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700271 case METHODID_FULL_BIDI_CALL:
272 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700273 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700274 case METHODID_HALF_BIDI_CALL:
275 return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700276 (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700277 default:
278 throw new AssertionError();
279 }
280 }
281 }
282
283 public static io.grpc.ServerServiceDefinition bindService(
284 final TestService serviceImpl) {
285 return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
286 .addMethod(
287 METHOD_UNARY_CALL,
288 asyncUnaryCall(
289 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700290 io.grpc.testing.integration.Test.SimpleRequest,
291 io.grpc.testing.integration.Test.SimpleResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700292 serviceImpl, METHODID_UNARY_CALL)))
293 .addMethod(
294 METHOD_STREAMING_OUTPUT_CALL,
295 asyncServerStreamingCall(
296 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700297 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
298 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700299 serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
300 .addMethod(
301 METHOD_STREAMING_INPUT_CALL,
302 asyncClientStreamingCall(
303 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700304 io.grpc.testing.integration.Test.StreamingInputCallRequest,
305 io.grpc.testing.integration.Test.StreamingInputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700306 serviceImpl, METHODID_STREAMING_INPUT_CALL)))
307 .addMethod(
308 METHOD_FULL_BIDI_CALL,
309 asyncBidiStreamingCall(
310 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700311 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
312 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700313 serviceImpl, METHODID_FULL_BIDI_CALL)))
314 .addMethod(
315 METHOD_HALF_BIDI_CALL,
316 asyncBidiStreamingCall(
317 new MethodHandlers<
Eric Andersonb22bcdf2016-03-29 14:13:28 -0700318 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
319 io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
Eric Anderson99a6d8d2016-03-22 11:31:36 -0700320 serviceImpl, METHODID_HALF_BIDI_CALL)))
321 .build();
322 }
323}