blob: 7e121133a13b53c24e2b8511003ca13a1b9d0d5e [file] [log] [blame]
Xiao Hangdcff3152015-02-20 15:03:06 -08001package io.grpc.testing.integration;
2
3import static io.grpc.stub.Calls.createMethodDescriptor;
4import static io.grpc.stub.Calls.asyncUnaryCall;
5import static io.grpc.stub.Calls.asyncServerStreamingCall;
6import static io.grpc.stub.Calls.asyncClientStreamingCall;
7import static io.grpc.stub.Calls.duplexStreamingCall;
8import static io.grpc.stub.Calls.blockingUnaryCall;
9import static io.grpc.stub.Calls.blockingServerStreamingCall;
10import static io.grpc.stub.Calls.unaryFutureCall;
11import static io.grpc.stub.ServerCalls.createMethodDefinition;
12import static io.grpc.stub.ServerCalls.asyncUnaryRequestCall;
13import static io.grpc.stub.ServerCalls.asyncStreamingRequestCall;
14
15import java.io.IOException;
16
17@javax.annotation.Generated("by gRPC proto compiler")
18public class TestServiceGrpc {
19
20 private static final io.grpc.stub.Method<io.grpc.testing.integration.Test.SimpleRequest,
21 io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL =
22 io.grpc.stub.Method.create(
23 io.grpc.MethodType.UNARY, "UnaryCall",
24 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.SimpleRequest>marshaller(
25 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.SimpleRequest>() {
26 @Override
27 public io.grpc.testing.integration.Test.SimpleRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
28 return io.grpc.testing.integration.Test.SimpleRequest.parseFrom(input);
29 }
30 }),
31 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.SimpleResponse>marshaller(
32 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.SimpleResponse>() {
33 @Override
34 public io.grpc.testing.integration.Test.SimpleResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
35 return io.grpc.testing.integration.Test.SimpleResponse.parseFrom(input);
36 }
37 }));
38 private static final io.grpc.stub.Method<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
39 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
40 io.grpc.stub.Method.create(
41 io.grpc.MethodType.SERVER_STREAMING, "StreamingOutputCall",
42 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallRequest>marshaller(
43 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallRequest>() {
44 @Override
45 public io.grpc.testing.integration.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
46 return io.grpc.testing.integration.Test.StreamingOutputCallRequest.parseFrom(input);
47 }
48 }),
49 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallResponse>marshaller(
50 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
51 @Override
52 public io.grpc.testing.integration.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
53 return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
54 }
55 }));
56 private static final io.grpc.stub.Method<io.grpc.testing.integration.Test.StreamingInputCallRequest,
57 io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
58 io.grpc.stub.Method.create(
59 io.grpc.MethodType.CLIENT_STREAMING, "StreamingInputCall",
60 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingInputCallRequest>marshaller(
61 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingInputCallRequest>() {
62 @Override
63 public io.grpc.testing.integration.Test.StreamingInputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
64 return io.grpc.testing.integration.Test.StreamingInputCallRequest.parseFrom(input);
65 }
66 }),
67 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingInputCallResponse>marshaller(
68 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
69 @Override
70 public io.grpc.testing.integration.Test.StreamingInputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
71 return io.grpc.testing.integration.Test.StreamingInputCallResponse.parseFrom(input);
72 }
73 }));
74 private static final io.grpc.stub.Method<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
75 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_DUPLEX_CALL =
76 io.grpc.stub.Method.create(
77 io.grpc.MethodType.DUPLEX_STREAMING, "FullDuplexCall",
78 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallRequest>marshaller(
79 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallRequest>() {
80 @Override
81 public io.grpc.testing.integration.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
82 return io.grpc.testing.integration.Test.StreamingOutputCallRequest.parseFrom(input);
83 }
84 }),
85 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallResponse>marshaller(
86 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
87 @Override
88 public io.grpc.testing.integration.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
89 return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
90 }
91 }));
92 private static final io.grpc.stub.Method<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
93 io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_DUPLEX_CALL =
94 io.grpc.stub.Method.create(
95 io.grpc.MethodType.DUPLEX_STREAMING, "HalfDuplexCall",
96 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallRequest>marshaller(
97 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallRequest>() {
98 @Override
99 public io.grpc.testing.integration.Test.StreamingOutputCallRequest parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
100 return io.grpc.testing.integration.Test.StreamingOutputCallRequest.parseFrom(input);
101 }
102 }),
103 io.grpc.nano.NanoUtils.<io.grpc.testing.integration.Test.StreamingOutputCallResponse>marshaller(
104 new io.grpc.nano.Parser<io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
105 @Override
106 public io.grpc.testing.integration.Test.StreamingOutputCallResponse parse(com.google.protobuf.nano.CodedInputByteBufferNano input) throws IOException {
107 return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
108 }
109 }));
110
111 public static TestServiceStub newStub(io.grpc.Channel channel) {
112 return new TestServiceStub(channel, CONFIG);
113 }
114
115 public static TestServiceBlockingStub newBlockingStub(
116 io.grpc.Channel channel) {
117 return new TestServiceBlockingStub(channel, CONFIG);
118 }
119
120 public static TestServiceFutureStub newFutureStub(
121 io.grpc.Channel channel) {
122 return new TestServiceFutureStub(channel, CONFIG);
123 }
124
125 public static final TestServiceServiceDescriptor CONFIG =
126 new TestServiceServiceDescriptor();
127
128 @javax.annotation.concurrent.Immutable
129 public static class TestServiceServiceDescriptor extends
130 io.grpc.stub.AbstractServiceDescriptor<TestServiceServiceDescriptor> {
131 public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
132 io.grpc.testing.integration.Test.SimpleResponse> unaryCall;
133 public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
134 io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall;
135 public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
136 io.grpc.testing.integration.Test.StreamingInputCallResponse> streamingInputCall;
137 public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
138 io.grpc.testing.integration.Test.StreamingOutputCallResponse> fullDuplexCall;
139 public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
140 io.grpc.testing.integration.Test.StreamingOutputCallResponse> halfDuplexCall;
141
142 private TestServiceServiceDescriptor() {
143 unaryCall = createMethodDescriptor(
144 "grpc.testing.TestService", METHOD_UNARY_CALL);
145 streamingOutputCall = createMethodDescriptor(
146 "grpc.testing.TestService", METHOD_STREAMING_OUTPUT_CALL);
147 streamingInputCall = createMethodDescriptor(
148 "grpc.testing.TestService", METHOD_STREAMING_INPUT_CALL);
149 fullDuplexCall = createMethodDescriptor(
150 "grpc.testing.TestService", METHOD_FULL_DUPLEX_CALL);
151 halfDuplexCall = createMethodDescriptor(
152 "grpc.testing.TestService", METHOD_HALF_DUPLEX_CALL);
153 }
154
Eric Anderson76d09552015-03-12 15:25:11 -0700155 @SuppressWarnings("unchecked")
Xiao Hangdcff3152015-02-20 15:03:06 -0800156 private TestServiceServiceDescriptor(
157 java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
158 unaryCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
159 io.grpc.testing.integration.Test.SimpleResponse>) methodMap.get(
160 CONFIG.unaryCall.getName());
161 streamingOutputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
162 io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
163 CONFIG.streamingOutputCall.getName());
164 streamingInputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
165 io.grpc.testing.integration.Test.StreamingInputCallResponse>) methodMap.get(
166 CONFIG.streamingInputCall.getName());
167 fullDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
168 io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
169 CONFIG.fullDuplexCall.getName());
170 halfDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
171 io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
172 CONFIG.halfDuplexCall.getName());
173 }
174
175 @java.lang.Override
176 protected TestServiceServiceDescriptor build(
177 java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
178 return new TestServiceServiceDescriptor(methodMap);
179 }
180
181 @java.lang.Override
182 public com.google.common.collect.ImmutableList<io.grpc.MethodDescriptor<?, ?>> methods() {
183 return com.google.common.collect.ImmutableList.<io.grpc.MethodDescriptor<?, ?>>of(
184 unaryCall,
185 streamingOutputCall,
186 streamingInputCall,
187 fullDuplexCall,
188 halfDuplexCall);
189 }
190 }
191
192 public static interface TestService {
193
194 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
195 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
196
197 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
198 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
199
200 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
201 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
202
203 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullDuplexCall(
204 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
205
206 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfDuplexCall(
207 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
208 }
209
210 public static interface TestServiceBlockingClient {
211
212 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
213
214 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
215 io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
216 }
217
218 public static interface TestServiceFutureClient {
219
220 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
221 io.grpc.testing.integration.Test.SimpleRequest request);
222 }
223
224 public static class TestServiceStub extends
225 io.grpc.stub.AbstractStub<TestServiceStub, TestServiceServiceDescriptor>
226 implements TestService {
227 private TestServiceStub(io.grpc.Channel channel,
228 TestServiceServiceDescriptor config) {
229 super(channel, config);
230 }
231
232 @java.lang.Override
233 protected TestServiceStub build(io.grpc.Channel channel,
234 TestServiceServiceDescriptor config) {
235 return new TestServiceStub(channel, config);
236 }
237
238 @java.lang.Override
239 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
240 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
241 asyncUnaryCall(
242 channel.newCall(config.unaryCall), request, responseObserver);
243 }
244
245 @java.lang.Override
246 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
247 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
248 asyncServerStreamingCall(
249 channel.newCall(config.streamingOutputCall), request, responseObserver);
250 }
251
252 @java.lang.Override
253 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
254 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
255 return asyncClientStreamingCall(
256 channel.newCall(config.streamingInputCall), responseObserver);
257 }
258
259 @java.lang.Override
260 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullDuplexCall(
261 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
262 return duplexStreamingCall(
263 channel.newCall(config.fullDuplexCall), responseObserver);
264 }
265
266 @java.lang.Override
267 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfDuplexCall(
268 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
269 return duplexStreamingCall(
270 channel.newCall(config.halfDuplexCall), responseObserver);
271 }
272 }
273
274 public static class TestServiceBlockingStub extends
275 io.grpc.stub.AbstractStub<TestServiceBlockingStub, TestServiceServiceDescriptor>
276 implements TestServiceBlockingClient {
277 private TestServiceBlockingStub(io.grpc.Channel channel,
278 TestServiceServiceDescriptor config) {
279 super(channel, config);
280 }
281
282 @java.lang.Override
283 protected TestServiceBlockingStub build(io.grpc.Channel channel,
284 TestServiceServiceDescriptor config) {
285 return new TestServiceBlockingStub(channel, config);
286 }
287
288 @java.lang.Override
289 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
290 return blockingUnaryCall(
291 channel.newCall(config.unaryCall), request);
292 }
293
294 @java.lang.Override
295 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
296 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
297 return blockingServerStreamingCall(
298 channel.newCall(config.streamingOutputCall), request);
299 }
300 }
301
302 public static class TestServiceFutureStub extends
303 io.grpc.stub.AbstractStub<TestServiceFutureStub, TestServiceServiceDescriptor>
304 implements TestServiceFutureClient {
305 private TestServiceFutureStub(io.grpc.Channel channel,
306 TestServiceServiceDescriptor config) {
307 super(channel, config);
308 }
309
310 @java.lang.Override
311 protected TestServiceFutureStub build(io.grpc.Channel channel,
312 TestServiceServiceDescriptor config) {
313 return new TestServiceFutureStub(channel, config);
314 }
315
316 @java.lang.Override
317 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
318 io.grpc.testing.integration.Test.SimpleRequest request) {
319 return unaryFutureCall(
320 channel.newCall(config.unaryCall), request);
321 }
322 }
323
324 public static io.grpc.ServerServiceDefinition bindService(
325 final TestService serviceImpl) {
326 return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
327 .addMethod(createMethodDefinition(
328 METHOD_UNARY_CALL,
329 asyncUnaryRequestCall(
330 new io.grpc.stub.ServerCalls.UnaryRequestMethod<
331 io.grpc.testing.integration.Test.SimpleRequest,
332 io.grpc.testing.integration.Test.SimpleResponse>() {
333 @java.lang.Override
334 public void invoke(
335 io.grpc.testing.integration.Test.SimpleRequest request,
336 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
337 serviceImpl.unaryCall(request, responseObserver);
338 }
339 })))
340 .addMethod(createMethodDefinition(
341 METHOD_STREAMING_OUTPUT_CALL,
342 asyncUnaryRequestCall(
343 new io.grpc.stub.ServerCalls.UnaryRequestMethod<
344 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
345 io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
346 @java.lang.Override
347 public void invoke(
348 io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
349 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
350 serviceImpl.streamingOutputCall(request, responseObserver);
351 }
352 })))
353 .addMethod(createMethodDefinition(
354 METHOD_STREAMING_INPUT_CALL,
355 asyncStreamingRequestCall(
356 new io.grpc.stub.ServerCalls.StreamingRequestMethod<
357 io.grpc.testing.integration.Test.StreamingInputCallRequest,
358 io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
359 @java.lang.Override
360 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> invoke(
361 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
362 return serviceImpl.streamingInputCall(responseObserver);
363 }
364 })))
365 .addMethod(createMethodDefinition(
366 METHOD_FULL_DUPLEX_CALL,
367 asyncStreamingRequestCall(
368 new io.grpc.stub.ServerCalls.StreamingRequestMethod<
369 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
370 io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
371 @java.lang.Override
372 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
373 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
374 return serviceImpl.fullDuplexCall(responseObserver);
375 }
376 })))
377 .addMethod(createMethodDefinition(
378 METHOD_HALF_DUPLEX_CALL,
379 asyncStreamingRequestCall(
380 new io.grpc.stub.ServerCalls.StreamingRequestMethod<
381 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
382 io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
383 @java.lang.Override
384 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
385 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
386 return serviceImpl.halfDuplexCall(responseObserver);
387 }
388 }))).build();
389 }
390}