xref: /aosp_15_r20/external/grpc-grpc-java/compiler/src/testLite/golden/TestService.java.txt (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1package io.grpc.testing.compiler;
2
3import static io.grpc.MethodDescriptor.generateFullMethodName;
4
5/**
6 * <pre>
7 * Test service that supports all call types.
8 * </pre>
9 */
10@javax.annotation.Generated(
11    value = "by gRPC proto compiler (version 1.56.1-SNAPSHOT)",
12    comments = "Source: grpc/testing/compiler/test.proto")
13@io.grpc.stub.annotations.GrpcGenerated
14public final class TestServiceGrpc {
15
16  private TestServiceGrpc() {}
17
18  public static final String SERVICE_NAME = "grpc.testing.compiler.TestService";
19
20  // Static method descriptors that strictly reflect the proto.
21  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
22      io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod;
23
24  @io.grpc.stub.annotations.RpcMethod(
25      fullMethodName = SERVICE_NAME + '/' + "UnaryCall",
26      requestType = io.grpc.testing.compiler.Test.SimpleRequest.class,
27      responseType = io.grpc.testing.compiler.Test.SimpleResponse.class,
28      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
29  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
30      io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod() {
31    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod;
32    if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
33      synchronized (TestServiceGrpc.class) {
34        if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
35          TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
36              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse>newBuilder()
37              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
38              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryCall"))
39              .setSampledToLocalTracing(true)
40              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
41                  io.grpc.testing.compiler.Test.SimpleRequest.getDefaultInstance()))
42              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
43                  io.grpc.testing.compiler.Test.SimpleResponse.getDefaultInstance()))
44              .build();
45        }
46      }
47    }
48    return getUnaryCallMethod;
49  }
50
51  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
52      io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
53
54  @io.grpc.stub.annotations.RpcMethod(
55      fullMethodName = SERVICE_NAME + '/' + "StreamingOutputCall",
56      requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
57      responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
58      methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
59  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
60      io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
61    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
62    if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
63      synchronized (TestServiceGrpc.class) {
64        if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
65          TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
66              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
67              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
68              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingOutputCall"))
69              .setSampledToLocalTracing(true)
70              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
71                  io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
72              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
73                  io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
74              .build();
75        }
76      }
77    }
78    return getStreamingOutputCallMethod;
79  }
80
81  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
82      io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
83
84  @io.grpc.stub.annotations.RpcMethod(
85      fullMethodName = SERVICE_NAME + '/' + "StreamingInputCall",
86      requestType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class,
87      responseType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class,
88      methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
89  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
90      io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
91    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
92    if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
93      synchronized (TestServiceGrpc.class) {
94        if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
95          TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
96              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>newBuilder()
97              .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
98              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingInputCall"))
99              .setSampledToLocalTracing(true)
100              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
101                  io.grpc.testing.compiler.Test.StreamingInputCallRequest.getDefaultInstance()))
102              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
103                  io.grpc.testing.compiler.Test.StreamingInputCallResponse.getDefaultInstance()))
104              .build();
105        }
106      }
107    }
108    return getStreamingInputCallMethod;
109  }
110
111  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
112      io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
113
114  @io.grpc.stub.annotations.RpcMethod(
115      fullMethodName = SERVICE_NAME + '/' + "FullBidiCall",
116      requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
117      responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
118      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
119  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
120      io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
121    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
122    if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
123      synchronized (TestServiceGrpc.class) {
124        if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
125          TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod =
126              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
127              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
128              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "FullBidiCall"))
129              .setSampledToLocalTracing(true)
130              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
131                  io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
132              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
133                  io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
134              .build();
135        }
136      }
137    }
138    return getFullBidiCallMethod;
139  }
140
141  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
142      io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
143
144  @io.grpc.stub.annotations.RpcMethod(
145      fullMethodName = SERVICE_NAME + '/' + "HalfBidiCall",
146      requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
147      responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
148      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
149  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
150      io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
151    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
152    if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
153      synchronized (TestServiceGrpc.class) {
154        if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
155          TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod =
156              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
157              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
158              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "HalfBidiCall"))
159              .setSampledToLocalTracing(true)
160              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
161                  io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
162              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
163                  io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
164              .build();
165        }
166      }
167    }
168    return getHalfBidiCallMethod;
169  }
170
171  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
172      io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod;
173
174  @io.grpc.stub.annotations.RpcMethod(
175      fullMethodName = SERVICE_NAME + '/' + "Import",
176      requestType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class,
177      responseType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class,
178      methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
179  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
180      io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod() {
181    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod;
182    if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
183      synchronized (TestServiceGrpc.class) {
184        if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
185          TestServiceGrpc.getImportMethod = getImportMethod =
186              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>newBuilder()
187              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
188              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Import"))
189              .setSampledToLocalTracing(true)
190              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
191                  io.grpc.testing.compiler.Test.StreamingInputCallRequest.getDefaultInstance()))
192              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
193                  io.grpc.testing.compiler.Test.StreamingInputCallResponse.getDefaultInstance()))
194              .build();
195        }
196      }
197    }
198    return getImportMethod;
199  }
200
201  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
202      io.grpc.testing.compiler.Test.SimpleResponse> getSafeCallMethod;
203
204  @io.grpc.stub.annotations.RpcMethod(
205      fullMethodName = SERVICE_NAME + '/' + "SafeCall",
206      requestType = io.grpc.testing.compiler.Test.SimpleRequest.class,
207      responseType = io.grpc.testing.compiler.Test.SimpleResponse.class,
208      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
209  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
210      io.grpc.testing.compiler.Test.SimpleResponse> getSafeCallMethod() {
211    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse> getSafeCallMethod;
212    if ((getSafeCallMethod = TestServiceGrpc.getSafeCallMethod) == null) {
213      synchronized (TestServiceGrpc.class) {
214        if ((getSafeCallMethod = TestServiceGrpc.getSafeCallMethod) == null) {
215          TestServiceGrpc.getSafeCallMethod = getSafeCallMethod =
216              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse>newBuilder()
217              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
218              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SafeCall"))
219              .setSafe(true)
220              .setSampledToLocalTracing(true)
221              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
222                  io.grpc.testing.compiler.Test.SimpleRequest.getDefaultInstance()))
223              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
224                  io.grpc.testing.compiler.Test.SimpleResponse.getDefaultInstance()))
225              .build();
226        }
227      }
228    }
229    return getSafeCallMethod;
230  }
231
232  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
233      io.grpc.testing.compiler.Test.SimpleResponse> getIdempotentCallMethod;
234
235  @io.grpc.stub.annotations.RpcMethod(
236      fullMethodName = SERVICE_NAME + '/' + "IdempotentCall",
237      requestType = io.grpc.testing.compiler.Test.SimpleRequest.class,
238      responseType = io.grpc.testing.compiler.Test.SimpleResponse.class,
239      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
240  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
241      io.grpc.testing.compiler.Test.SimpleResponse> getIdempotentCallMethod() {
242    io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse> getIdempotentCallMethod;
243    if ((getIdempotentCallMethod = TestServiceGrpc.getIdempotentCallMethod) == null) {
244      synchronized (TestServiceGrpc.class) {
245        if ((getIdempotentCallMethod = TestServiceGrpc.getIdempotentCallMethod) == null) {
246          TestServiceGrpc.getIdempotentCallMethod = getIdempotentCallMethod =
247              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse>newBuilder()
248              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
249              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "IdempotentCall"))
250              .setIdempotent(true)
251              .setSampledToLocalTracing(true)
252              .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
253                  io.grpc.testing.compiler.Test.SimpleRequest.getDefaultInstance()))
254              .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
255                  io.grpc.testing.compiler.Test.SimpleResponse.getDefaultInstance()))
256              .build();
257        }
258      }
259    }
260    return getIdempotentCallMethod;
261  }
262
263  /**
264   * Creates a new async stub that supports all call types for the service
265   */
266  public static TestServiceStub newStub(io.grpc.Channel channel) {
267    io.grpc.stub.AbstractStub.StubFactory<TestServiceStub> factory =
268      new io.grpc.stub.AbstractStub.StubFactory<TestServiceStub>() {
269        @java.lang.Override
270        public TestServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
271          return new TestServiceStub(channel, callOptions);
272        }
273      };
274    return TestServiceStub.newStub(factory, channel);
275  }
276
277  /**
278   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
279   */
280  public static TestServiceBlockingStub newBlockingStub(
281      io.grpc.Channel channel) {
282    io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingStub> factory =
283      new io.grpc.stub.AbstractStub.StubFactory<TestServiceBlockingStub>() {
284        @java.lang.Override
285        public TestServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
286          return new TestServiceBlockingStub(channel, callOptions);
287        }
288      };
289    return TestServiceBlockingStub.newStub(factory, channel);
290  }
291
292  /**
293   * Creates a new ListenableFuture-style stub that supports unary calls on the service
294   */
295  public static TestServiceFutureStub newFutureStub(
296      io.grpc.Channel channel) {
297    io.grpc.stub.AbstractStub.StubFactory<TestServiceFutureStub> factory =
298      new io.grpc.stub.AbstractStub.StubFactory<TestServiceFutureStub>() {
299        @java.lang.Override
300        public TestServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
301          return new TestServiceFutureStub(channel, callOptions);
302        }
303      };
304    return TestServiceFutureStub.newStub(factory, channel);
305  }
306
307  /**
308   * <pre>
309   * Test service that supports all call types.
310   * </pre>
311   */
312  public interface AsyncService {
313
314    /**
315     * <pre>
316     * One request followed by one response.
317     * The server returns the client payload as-is.
318     * </pre>
319     */
320    default void unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request,
321        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
322      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
323    }
324
325    /**
326     * <pre>
327     * One request followed by a sequence of responses (streamed download).
328     * The server returns the payload with client desired type and sizes.
329     * </pre>
330     */
331    default void streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request,
332        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
333      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
334    }
335
336    /**
337     * <pre>
338     * A sequence of requests followed by one response (streamed upload).
339     * The server returns the aggregated size of client payload as the result.
340     * </pre>
341     */
342    default io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> streamingInputCall(
343        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
344      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
345    }
346
347    /**
348     * <pre>
349     * A sequence of requests with each request served by the server immediately.
350     * As one request could lead to multiple responses, this interface
351     * demonstrates the idea of full bidirectionality.
352     * </pre>
353     */
354    default io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> fullBidiCall(
355        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
356      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
357    }
358
359    /**
360     * <pre>
361     * A sequence of requests followed by a sequence of responses.
362     * The server buffers all the client requests and then serves them in order. A
363     * stream of responses are returned to the client when the server starts with
364     * first request.
365     * </pre>
366     */
367    default io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> halfBidiCall(
368        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
369      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
370    }
371
372    /**
373     * <pre>
374     * An RPC method whose Java name collides with a keyword, and whose generated
375     * method should have a '_' appended.
376     * </pre>
377     */
378    default io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> import_(
379        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
380      return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getImportMethod(), responseObserver);
381    }
382
383    /**
384     * <pre>
385     * A unary call that is Safe.
386     * </pre>
387     */
388    default void safeCall(io.grpc.testing.compiler.Test.SimpleRequest request,
389        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
390      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSafeCallMethod(), responseObserver);
391    }
392
393    /**
394     * <pre>
395     * A unary call that is Idempotent.
396     * </pre>
397     */
398    default void idempotentCall(io.grpc.testing.compiler.Test.SimpleRequest request,
399        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
400      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getIdempotentCallMethod(), responseObserver);
401    }
402  }
403
404  /**
405   * Base class for the server implementation of the service TestService.
406   * <pre>
407   * Test service that supports all call types.
408   * </pre>
409   */
410  public static abstract class TestServiceImplBase
411      implements io.grpc.BindableService, AsyncService {
412
413    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
414      return TestServiceGrpc.bindService(this);
415    }
416  }
417
418  /**
419   * A stub to allow clients to do asynchronous rpc calls to service TestService.
420   * <pre>
421   * Test service that supports all call types.
422   * </pre>
423   */
424  public static final class TestServiceStub
425      extends io.grpc.stub.AbstractAsyncStub<TestServiceStub> {
426    private TestServiceStub(
427        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
428      super(channel, callOptions);
429    }
430
431    @java.lang.Override
432    protected TestServiceStub build(
433        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
434      return new TestServiceStub(channel, callOptions);
435    }
436
437    /**
438     * <pre>
439     * One request followed by one response.
440     * The server returns the client payload as-is.
441     * </pre>
442     */
443    public void unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request,
444        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
445      io.grpc.stub.ClientCalls.asyncUnaryCall(
446          getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
447    }
448
449    /**
450     * <pre>
451     * One request followed by a sequence of responses (streamed download).
452     * The server returns the payload with client desired type and sizes.
453     * </pre>
454     */
455    public void streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request,
456        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
457      io.grpc.stub.ClientCalls.asyncServerStreamingCall(
458          getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
459    }
460
461    /**
462     * <pre>
463     * A sequence of requests followed by one response (streamed upload).
464     * The server returns the aggregated size of client payload as the result.
465     * </pre>
466     */
467    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> streamingInputCall(
468        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
469      return io.grpc.stub.ClientCalls.asyncClientStreamingCall(
470          getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
471    }
472
473    /**
474     * <pre>
475     * A sequence of requests with each request served by the server immediately.
476     * As one request could lead to multiple responses, this interface
477     * demonstrates the idea of full bidirectionality.
478     * </pre>
479     */
480    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> fullBidiCall(
481        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
482      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
483          getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
484    }
485
486    /**
487     * <pre>
488     * A sequence of requests followed by a sequence of responses.
489     * The server buffers all the client requests and then serves them in order. A
490     * stream of responses are returned to the client when the server starts with
491     * first request.
492     * </pre>
493     */
494    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> halfBidiCall(
495        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
496      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
497          getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
498    }
499
500    /**
501     * <pre>
502     * An RPC method whose Java name collides with a keyword, and whose generated
503     * method should have a '_' appended.
504     * </pre>
505     */
506    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> import_(
507        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
508      return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
509          getChannel().newCall(getImportMethod(), getCallOptions()), responseObserver);
510    }
511
512    /**
513     * <pre>
514     * A unary call that is Safe.
515     * </pre>
516     */
517    public void safeCall(io.grpc.testing.compiler.Test.SimpleRequest request,
518        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
519      io.grpc.stub.ClientCalls.asyncUnaryCall(
520          getChannel().newCall(getSafeCallMethod(), getCallOptions()), request, responseObserver);
521    }
522
523    /**
524     * <pre>
525     * A unary call that is Idempotent.
526     * </pre>
527     */
528    public void idempotentCall(io.grpc.testing.compiler.Test.SimpleRequest request,
529        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
530      io.grpc.stub.ClientCalls.asyncUnaryCall(
531          getChannel().newCall(getIdempotentCallMethod(), getCallOptions()), request, responseObserver);
532    }
533  }
534
535  /**
536   * A stub to allow clients to do synchronous rpc calls to service TestService.
537   * <pre>
538   * Test service that supports all call types.
539   * </pre>
540   */
541  public static final class TestServiceBlockingStub
542      extends io.grpc.stub.AbstractBlockingStub<TestServiceBlockingStub> {
543    private TestServiceBlockingStub(
544        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
545      super(channel, callOptions);
546    }
547
548    @java.lang.Override
549    protected TestServiceBlockingStub build(
550        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
551      return new TestServiceBlockingStub(channel, callOptions);
552    }
553
554    /**
555     * <pre>
556     * One request followed by one response.
557     * The server returns the client payload as-is.
558     * </pre>
559     */
560    public io.grpc.testing.compiler.Test.SimpleResponse unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
561      return io.grpc.stub.ClientCalls.blockingUnaryCall(
562          getChannel(), getUnaryCallMethod(), getCallOptions(), request);
563    }
564
565    /**
566     * <pre>
567     * One request followed by a sequence of responses (streamed download).
568     * The server returns the payload with client desired type and sizes.
569     * </pre>
570     */
571    public java.util.Iterator<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> streamingOutputCall(
572        io.grpc.testing.compiler.Test.StreamingOutputCallRequest request) {
573      return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
574          getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
575    }
576
577    /**
578     * <pre>
579     * A unary call that is Safe.
580     * </pre>
581     */
582    public io.grpc.testing.compiler.Test.SimpleResponse safeCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
583      return io.grpc.stub.ClientCalls.blockingUnaryCall(
584          getChannel(), getSafeCallMethod(), getCallOptions(), request);
585    }
586
587    /**
588     * <pre>
589     * A unary call that is Idempotent.
590     * </pre>
591     */
592    public io.grpc.testing.compiler.Test.SimpleResponse idempotentCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
593      return io.grpc.stub.ClientCalls.blockingUnaryCall(
594          getChannel(), getIdempotentCallMethod(), getCallOptions(), request);
595    }
596  }
597
598  /**
599   * A stub to allow clients to do ListenableFuture-style rpc calls to service TestService.
600   * <pre>
601   * Test service that supports all call types.
602   * </pre>
603   */
604  public static final class TestServiceFutureStub
605      extends io.grpc.stub.AbstractFutureStub<TestServiceFutureStub> {
606    private TestServiceFutureStub(
607        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
608      super(channel, callOptions);
609    }
610
611    @java.lang.Override
612    protected TestServiceFutureStub build(
613        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
614      return new TestServiceFutureStub(channel, callOptions);
615    }
616
617    /**
618     * <pre>
619     * One request followed by one response.
620     * The server returns the client payload as-is.
621     * </pre>
622     */
623    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.Test.SimpleResponse> unaryCall(
624        io.grpc.testing.compiler.Test.SimpleRequest request) {
625      return io.grpc.stub.ClientCalls.futureUnaryCall(
626          getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
627    }
628
629    /**
630     * <pre>
631     * A unary call that is Safe.
632     * </pre>
633     */
634    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.Test.SimpleResponse> safeCall(
635        io.grpc.testing.compiler.Test.SimpleRequest request) {
636      return io.grpc.stub.ClientCalls.futureUnaryCall(
637          getChannel().newCall(getSafeCallMethod(), getCallOptions()), request);
638    }
639
640    /**
641     * <pre>
642     * A unary call that is Idempotent.
643     * </pre>
644     */
645    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.Test.SimpleResponse> idempotentCall(
646        io.grpc.testing.compiler.Test.SimpleRequest request) {
647      return io.grpc.stub.ClientCalls.futureUnaryCall(
648          getChannel().newCall(getIdempotentCallMethod(), getCallOptions()), request);
649    }
650  }
651
652  private static final int METHODID_UNARY_CALL = 0;
653  private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
654  private static final int METHODID_SAFE_CALL = 2;
655  private static final int METHODID_IDEMPOTENT_CALL = 3;
656  private static final int METHODID_STREAMING_INPUT_CALL = 4;
657  private static final int METHODID_FULL_BIDI_CALL = 5;
658  private static final int METHODID_HALF_BIDI_CALL = 6;
659  private static final int METHODID_IMPORT = 7;
660
661  private static final class MethodHandlers<Req, Resp> implements
662      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
663      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
664      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
665      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
666    private final AsyncService serviceImpl;
667    private final int methodId;
668
669    MethodHandlers(AsyncService serviceImpl, int methodId) {
670      this.serviceImpl = serviceImpl;
671      this.methodId = methodId;
672    }
673
674    @java.lang.Override
675    @java.lang.SuppressWarnings("unchecked")
676    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
677      switch (methodId) {
678        case METHODID_UNARY_CALL:
679          serviceImpl.unaryCall((io.grpc.testing.compiler.Test.SimpleRequest) request,
680              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse>) responseObserver);
681          break;
682        case METHODID_STREAMING_OUTPUT_CALL:
683          serviceImpl.streamingOutputCall((io.grpc.testing.compiler.Test.StreamingOutputCallRequest) request,
684              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
685          break;
686        case METHODID_SAFE_CALL:
687          serviceImpl.safeCall((io.grpc.testing.compiler.Test.SimpleRequest) request,
688              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse>) responseObserver);
689          break;
690        case METHODID_IDEMPOTENT_CALL:
691          serviceImpl.idempotentCall((io.grpc.testing.compiler.Test.SimpleRequest) request,
692              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse>) responseObserver);
693          break;
694        default:
695          throw new AssertionError();
696      }
697    }
698
699    @java.lang.Override
700    @java.lang.SuppressWarnings("unchecked")
701    public io.grpc.stub.StreamObserver<Req> invoke(
702        io.grpc.stub.StreamObserver<Resp> responseObserver) {
703      switch (methodId) {
704        case METHODID_STREAMING_INPUT_CALL:
705          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
706              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse>) responseObserver);
707        case METHODID_FULL_BIDI_CALL:
708          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
709              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
710        case METHODID_HALF_BIDI_CALL:
711          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
712              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
713        case METHODID_IMPORT:
714          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
715              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse>) responseObserver);
716        default:
717          throw new AssertionError();
718      }
719    }
720  }
721
722  public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
723    return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
724        .addMethod(
725          getUnaryCallMethod(),
726          io.grpc.stub.ServerCalls.asyncUnaryCall(
727            new MethodHandlers<
728              io.grpc.testing.compiler.Test.SimpleRequest,
729              io.grpc.testing.compiler.Test.SimpleResponse>(
730                service, METHODID_UNARY_CALL)))
731        .addMethod(
732          getStreamingOutputCallMethod(),
733          io.grpc.stub.ServerCalls.asyncServerStreamingCall(
734            new MethodHandlers<
735              io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
736              io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
737                service, METHODID_STREAMING_OUTPUT_CALL)))
738        .addMethod(
739          getStreamingInputCallMethod(),
740          io.grpc.stub.ServerCalls.asyncClientStreamingCall(
741            new MethodHandlers<
742              io.grpc.testing.compiler.Test.StreamingInputCallRequest,
743              io.grpc.testing.compiler.Test.StreamingInputCallResponse>(
744                service, METHODID_STREAMING_INPUT_CALL)))
745        .addMethod(
746          getFullBidiCallMethod(),
747          io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
748            new MethodHandlers<
749              io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
750              io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
751                service, METHODID_FULL_BIDI_CALL)))
752        .addMethod(
753          getHalfBidiCallMethod(),
754          io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
755            new MethodHandlers<
756              io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
757              io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
758                service, METHODID_HALF_BIDI_CALL)))
759        .addMethod(
760          getImportMethod(),
761          io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
762            new MethodHandlers<
763              io.grpc.testing.compiler.Test.StreamingInputCallRequest,
764              io.grpc.testing.compiler.Test.StreamingInputCallResponse>(
765                service, METHODID_IMPORT)))
766        .addMethod(
767          getSafeCallMethod(),
768          io.grpc.stub.ServerCalls.asyncUnaryCall(
769            new MethodHandlers<
770              io.grpc.testing.compiler.Test.SimpleRequest,
771              io.grpc.testing.compiler.Test.SimpleResponse>(
772                service, METHODID_SAFE_CALL)))
773        .addMethod(
774          getIdempotentCallMethod(),
775          io.grpc.stub.ServerCalls.asyncUnaryCall(
776            new MethodHandlers<
777              io.grpc.testing.compiler.Test.SimpleRequest,
778              io.grpc.testing.compiler.Test.SimpleResponse>(
779                service, METHODID_IDEMPOTENT_CALL)))
780        .build();
781  }
782
783  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
784
785  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
786    io.grpc.ServiceDescriptor result = serviceDescriptor;
787    if (result == null) {
788      synchronized (TestServiceGrpc.class) {
789        result = serviceDescriptor;
790        if (result == null) {
791          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
792              .addMethod(getUnaryCallMethod())
793              .addMethod(getStreamingOutputCallMethod())
794              .addMethod(getStreamingInputCallMethod())
795              .addMethod(getFullBidiCallMethod())
796              .addMethod(getHalfBidiCallMethod())
797              .addMethod(getImportMethod())
798              .addMethod(getSafeCallMethod())
799              .addMethod(getIdempotentCallMethod())
800              .build();
801        }
802      }
803    }
804    return result;
805  }
806}
807