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