blob: 18f40fdd58032b3451e29580a7ff014fd90bf83d [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
155 private TestServiceServiceDescriptor(
156 java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
157 unaryCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
158 io.grpc.testing.integration.Test.SimpleResponse>) methodMap.get(
159 CONFIG.unaryCall.getName());
160 streamingOutputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
161 io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
162 CONFIG.streamingOutputCall.getName());
163 streamingInputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
164 io.grpc.testing.integration.Test.StreamingInputCallResponse>) methodMap.get(
165 CONFIG.streamingInputCall.getName());
166 fullDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
167 io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
168 CONFIG.fullDuplexCall.getName());
169 halfDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
170 io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
171 CONFIG.halfDuplexCall.getName());
172 }
173
174 @java.lang.Override
175 protected TestServiceServiceDescriptor build(
176 java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
177 return new TestServiceServiceDescriptor(methodMap);
178 }
179
180 @java.lang.Override
181 public com.google.common.collect.ImmutableList<io.grpc.MethodDescriptor<?, ?>> methods() {
182 return com.google.common.collect.ImmutableList.<io.grpc.MethodDescriptor<?, ?>>of(
183 unaryCall,
184 streamingOutputCall,
185 streamingInputCall,
186 fullDuplexCall,
187 halfDuplexCall);
188 }
189 }
190
191 public static interface TestService {
192
193 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
194 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
195
196 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
197 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
198
199 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
200 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
201
202 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullDuplexCall(
203 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
204
205 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfDuplexCall(
206 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
207 }
208
209 public static interface TestServiceBlockingClient {
210
211 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
212
213 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
214 io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
215 }
216
217 public static interface TestServiceFutureClient {
218
219 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
220 io.grpc.testing.integration.Test.SimpleRequest request);
221 }
222
223 public static class TestServiceStub extends
224 io.grpc.stub.AbstractStub<TestServiceStub, TestServiceServiceDescriptor>
225 implements TestService {
226 private TestServiceStub(io.grpc.Channel channel,
227 TestServiceServiceDescriptor config) {
228 super(channel, config);
229 }
230
231 @java.lang.Override
232 protected TestServiceStub build(io.grpc.Channel channel,
233 TestServiceServiceDescriptor config) {
234 return new TestServiceStub(channel, config);
235 }
236
237 @java.lang.Override
238 public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
239 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
240 asyncUnaryCall(
241 channel.newCall(config.unaryCall), request, responseObserver);
242 }
243
244 @java.lang.Override
245 public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
246 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
247 asyncServerStreamingCall(
248 channel.newCall(config.streamingOutputCall), request, responseObserver);
249 }
250
251 @java.lang.Override
252 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
253 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
254 return asyncClientStreamingCall(
255 channel.newCall(config.streamingInputCall), responseObserver);
256 }
257
258 @java.lang.Override
259 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullDuplexCall(
260 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
261 return duplexStreamingCall(
262 channel.newCall(config.fullDuplexCall), responseObserver);
263 }
264
265 @java.lang.Override
266 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfDuplexCall(
267 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
268 return duplexStreamingCall(
269 channel.newCall(config.halfDuplexCall), responseObserver);
270 }
271 }
272
273 public static class TestServiceBlockingStub extends
274 io.grpc.stub.AbstractStub<TestServiceBlockingStub, TestServiceServiceDescriptor>
275 implements TestServiceBlockingClient {
276 private TestServiceBlockingStub(io.grpc.Channel channel,
277 TestServiceServiceDescriptor config) {
278 super(channel, config);
279 }
280
281 @java.lang.Override
282 protected TestServiceBlockingStub build(io.grpc.Channel channel,
283 TestServiceServiceDescriptor config) {
284 return new TestServiceBlockingStub(channel, config);
285 }
286
287 @java.lang.Override
288 public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
289 return blockingUnaryCall(
290 channel.newCall(config.unaryCall), request);
291 }
292
293 @java.lang.Override
294 public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
295 io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
296 return blockingServerStreamingCall(
297 channel.newCall(config.streamingOutputCall), request);
298 }
299 }
300
301 public static class TestServiceFutureStub extends
302 io.grpc.stub.AbstractStub<TestServiceFutureStub, TestServiceServiceDescriptor>
303 implements TestServiceFutureClient {
304 private TestServiceFutureStub(io.grpc.Channel channel,
305 TestServiceServiceDescriptor config) {
306 super(channel, config);
307 }
308
309 @java.lang.Override
310 protected TestServiceFutureStub build(io.grpc.Channel channel,
311 TestServiceServiceDescriptor config) {
312 return new TestServiceFutureStub(channel, config);
313 }
314
315 @java.lang.Override
316 public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
317 io.grpc.testing.integration.Test.SimpleRequest request) {
318 return unaryFutureCall(
319 channel.newCall(config.unaryCall), request);
320 }
321 }
322
323 public static io.grpc.ServerServiceDefinition bindService(
324 final TestService serviceImpl) {
325 return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
326 .addMethod(createMethodDefinition(
327 METHOD_UNARY_CALL,
328 asyncUnaryRequestCall(
329 new io.grpc.stub.ServerCalls.UnaryRequestMethod<
330 io.grpc.testing.integration.Test.SimpleRequest,
331 io.grpc.testing.integration.Test.SimpleResponse>() {
332 @java.lang.Override
333 public void invoke(
334 io.grpc.testing.integration.Test.SimpleRequest request,
335 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
336 serviceImpl.unaryCall(request, responseObserver);
337 }
338 })))
339 .addMethod(createMethodDefinition(
340 METHOD_STREAMING_OUTPUT_CALL,
341 asyncUnaryRequestCall(
342 new io.grpc.stub.ServerCalls.UnaryRequestMethod<
343 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
344 io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
345 @java.lang.Override
346 public void invoke(
347 io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
348 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
349 serviceImpl.streamingOutputCall(request, responseObserver);
350 }
351 })))
352 .addMethod(createMethodDefinition(
353 METHOD_STREAMING_INPUT_CALL,
354 asyncStreamingRequestCall(
355 new io.grpc.stub.ServerCalls.StreamingRequestMethod<
356 io.grpc.testing.integration.Test.StreamingInputCallRequest,
357 io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
358 @java.lang.Override
359 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> invoke(
360 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
361 return serviceImpl.streamingInputCall(responseObserver);
362 }
363 })))
364 .addMethod(createMethodDefinition(
365 METHOD_FULL_DUPLEX_CALL,
366 asyncStreamingRequestCall(
367 new io.grpc.stub.ServerCalls.StreamingRequestMethod<
368 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
369 io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
370 @java.lang.Override
371 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
372 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
373 return serviceImpl.fullDuplexCall(responseObserver);
374 }
375 })))
376 .addMethod(createMethodDefinition(
377 METHOD_HALF_DUPLEX_CALL,
378 asyncStreamingRequestCall(
379 new io.grpc.stub.ServerCalls.StreamingRequestMethod<
380 io.grpc.testing.integration.Test.StreamingOutputCallRequest,
381 io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
382 @java.lang.Override
383 public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
384 io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
385 return serviceImpl.halfDuplexCall(responseObserver);
386 }
387 }))).build();
388 }
389}