Home | History | Annotate | Download | only in golden
      1 package io.grpc.testing.compiler;
      2 
      3 import static io.grpc.MethodDescriptor.generateFullMethodName;
      4 import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
      5 import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
      6 import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
      7 import static io.grpc.stub.ClientCalls.asyncUnaryCall;
      8 import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
      9 import static io.grpc.stub.ClientCalls.blockingUnaryCall;
     10 import static io.grpc.stub.ClientCalls.futureUnaryCall;
     11 import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
     12 import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
     13 import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
     14 import static io.grpc.stub.ServerCalls.asyncUnaryCall;
     15 import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
     16 import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
     17 
     18 /**
     19  * <pre>
     20  * Test service that supports all call types.
     21  * </pre>
     22  */
     23 @javax.annotation.Generated(
     24     value = "by gRPC proto compiler (version 1.16.0-SNAPSHOT)",
     25     comments = "Source: grpc/testing/compiler/test.proto")
     26 public final class TestServiceGrpc {
     27 
     28   private TestServiceGrpc() {}
     29 
     30   public static final String SERVICE_NAME = "grpc.testing.compiler.TestService";
     31 
     32   // Static method descriptors that strictly reflect the proto.
     33   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
     34       io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod;
     35 
     36   @io.grpc.stub.annotations.RpcMethod(
     37       fullMethodName = SERVICE_NAME + '/' + "UnaryCall",
     38       requestType = io.grpc.testing.compiler.Test.SimpleRequest.class,
     39       responseType = io.grpc.testing.compiler.Test.SimpleResponse.class,
     40       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
     41   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
     42       io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod() {
     43     io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse> getUnaryCallMethod;
     44     if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
     45       synchronized (TestServiceGrpc.class) {
     46         if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
     47           TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod = 
     48               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.SimpleRequest, io.grpc.testing.compiler.Test.SimpleResponse>newBuilder()
     49               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
     50               .setFullMethodName(generateFullMethodName(
     51                   "grpc.testing.compiler.TestService", "UnaryCall"))
     52               .setSampledToLocalTracing(true)
     53               .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
     54                   io.grpc.testing.compiler.Test.SimpleRequest.getDefaultInstance()))
     55               .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
     56                   io.grpc.testing.compiler.Test.SimpleResponse.getDefaultInstance()))
     57                   .build();
     58           }
     59         }
     60      }
     61      return getUnaryCallMethod;
     62   }
     63 
     64   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
     65       io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
     66 
     67   @io.grpc.stub.annotations.RpcMethod(
     68       fullMethodName = SERVICE_NAME + '/' + "StreamingOutputCall",
     69       requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
     70       responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
     71       methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
     72   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
     73       io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
     74     io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
     75     if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
     76       synchronized (TestServiceGrpc.class) {
     77         if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
     78           TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod = 
     79               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
     80               .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
     81               .setFullMethodName(generateFullMethodName(
     82                   "grpc.testing.compiler.TestService", "StreamingOutputCall"))
     83               .setSampledToLocalTracing(true)
     84               .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
     85                   io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
     86               .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
     87                   io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
     88                   .build();
     89           }
     90         }
     91      }
     92      return getStreamingOutputCallMethod;
     93   }
     94 
     95   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
     96       io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
     97 
     98   @io.grpc.stub.annotations.RpcMethod(
     99       fullMethodName = SERVICE_NAME + '/' + "StreamingInputCall",
    100       requestType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class,
    101       responseType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class,
    102       methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
    103   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
    104       io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
    105     io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
    106     if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
    107       synchronized (TestServiceGrpc.class) {
    108         if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
    109           TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod = 
    110               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>newBuilder()
    111               .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
    112               .setFullMethodName(generateFullMethodName(
    113                   "grpc.testing.compiler.TestService", "StreamingInputCall"))
    114               .setSampledToLocalTracing(true)
    115               .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    116                   io.grpc.testing.compiler.Test.StreamingInputCallRequest.getDefaultInstance()))
    117               .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    118                   io.grpc.testing.compiler.Test.StreamingInputCallResponse.getDefaultInstance()))
    119                   .build();
    120           }
    121         }
    122      }
    123      return getStreamingInputCallMethod;
    124   }
    125 
    126   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    127       io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
    128 
    129   @io.grpc.stub.annotations.RpcMethod(
    130       fullMethodName = SERVICE_NAME + '/' + "FullBidiCall",
    131       requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
    132       responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
    133       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
    134   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    135       io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
    136     io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
    137     if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
    138       synchronized (TestServiceGrpc.class) {
    139         if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
    140           TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod = 
    141               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
    142               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
    143               .setFullMethodName(generateFullMethodName(
    144                   "grpc.testing.compiler.TestService", "FullBidiCall"))
    145               .setSampledToLocalTracing(true)
    146               .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    147                   io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
    148               .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    149                   io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
    150                   .build();
    151           }
    152         }
    153      }
    154      return getFullBidiCallMethod;
    155   }
    156 
    157   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    158       io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
    159 
    160   @io.grpc.stub.annotations.RpcMethod(
    161       fullMethodName = SERVICE_NAME + '/' + "HalfBidiCall",
    162       requestType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class,
    163       responseType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class,
    164       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
    165   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    166       io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
    167     io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
    168     if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
    169       synchronized (TestServiceGrpc.class) {
    170         if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
    171           TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod = 
    172               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.Test.StreamingOutputCallResponse>newBuilder()
    173               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
    174               .setFullMethodName(generateFullMethodName(
    175                   "grpc.testing.compiler.TestService", "HalfBidiCall"))
    176               .setSampledToLocalTracing(true)
    177               .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    178                   io.grpc.testing.compiler.Test.StreamingOutputCallRequest.getDefaultInstance()))
    179               .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    180                   io.grpc.testing.compiler.Test.StreamingOutputCallResponse.getDefaultInstance()))
    181                   .build();
    182           }
    183         }
    184      }
    185      return getHalfBidiCallMethod;
    186   }
    187 
    188   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
    189       io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod;
    190 
    191   @io.grpc.stub.annotations.RpcMethod(
    192       fullMethodName = SERVICE_NAME + '/' + "Import",
    193       requestType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class,
    194       responseType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class,
    195       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
    196   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest,
    197       io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod() {
    198     io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse> getImportMethod;
    199     if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
    200       synchronized (TestServiceGrpc.class) {
    201         if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
    202           TestServiceGrpc.getImportMethod = getImportMethod = 
    203               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.Test.StreamingInputCallRequest, io.grpc.testing.compiler.Test.StreamingInputCallResponse>newBuilder()
    204               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
    205               .setFullMethodName(generateFullMethodName(
    206                   "grpc.testing.compiler.TestService", "Import"))
    207               .setSampledToLocalTracing(true)
    208               .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    209                   io.grpc.testing.compiler.Test.StreamingInputCallRequest.getDefaultInstance()))
    210               .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
    211                   io.grpc.testing.compiler.Test.StreamingInputCallResponse.getDefaultInstance()))
    212                   .build();
    213           }
    214         }
    215      }
    216      return getImportMethod;
    217   }
    218 
    219   /**
    220    * Creates a new async stub that supports all call types for the service
    221    */
    222   public static TestServiceStub newStub(io.grpc.Channel channel) {
    223     return new TestServiceStub(channel);
    224   }
    225 
    226   /**
    227    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
    228    */
    229   public static TestServiceBlockingStub newBlockingStub(
    230       io.grpc.Channel channel) {
    231     return new TestServiceBlockingStub(channel);
    232   }
    233 
    234   /**
    235    * Creates a new ListenableFuture-style stub that supports unary calls on the service
    236    */
    237   public static TestServiceFutureStub newFutureStub(
    238       io.grpc.Channel channel) {
    239     return new TestServiceFutureStub(channel);
    240   }
    241 
    242   /**
    243    * <pre>
    244    * Test service that supports all call types.
    245    * </pre>
    246    */
    247   public static abstract class TestServiceImplBase implements io.grpc.BindableService {
    248 
    249     /**
    250      * <pre>
    251      * One request followed by one response.
    252      * The server returns the client payload as-is.
    253      * </pre>
    254      */
    255     public void unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request,
    256         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
    257       asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
    258     }
    259 
    260     /**
    261      * <pre>
    262      * One request followed by a sequence of responses (streamed download).
    263      * The server returns the payload with client desired type and sizes.
    264      * </pre>
    265      */
    266     public void streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request,
    267         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
    268       asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
    269     }
    270 
    271     /**
    272      * <pre>
    273      * A sequence of requests followed by one response (streamed upload).
    274      * The server returns the aggregated size of client payload as the result.
    275      * </pre>
    276      */
    277     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> streamingInputCall(
    278         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
    279       return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
    280     }
    281 
    282     /**
    283      * <pre>
    284      * A sequence of requests with each request served by the server immediately.
    285      * As one request could lead to multiple responses, this interface
    286      * demonstrates the idea of full bidirectionality.
    287      * </pre>
    288      */
    289     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> fullBidiCall(
    290         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
    291       return asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
    292     }
    293 
    294     /**
    295      * <pre>
    296      * A sequence of requests followed by a sequence of responses.
    297      * The server buffers all the client requests and then serves them in order. A
    298      * stream of responses are returned to the client when the server starts with
    299      * first request.
    300      * </pre>
    301      */
    302     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> halfBidiCall(
    303         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
    304       return asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
    305     }
    306 
    307     /**
    308      * <pre>
    309      * An RPC method whose Java name collides with a keyword, and whose generated
    310      * method should have a '_' appended.
    311      * </pre>
    312      */
    313     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> import_(
    314         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
    315       return asyncUnimplementedStreamingCall(getImportMethod(), responseObserver);
    316     }
    317 
    318     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
    319       return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
    320           .addMethod(
    321             getUnaryCallMethod(),
    322             asyncUnaryCall(
    323               new MethodHandlers<
    324                 io.grpc.testing.compiler.Test.SimpleRequest,
    325                 io.grpc.testing.compiler.Test.SimpleResponse>(
    326                   this, METHODID_UNARY_CALL)))
    327           .addMethod(
    328             getStreamingOutputCallMethod(),
    329             asyncServerStreamingCall(
    330               new MethodHandlers<
    331                 io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    332                 io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
    333                   this, METHODID_STREAMING_OUTPUT_CALL)))
    334           .addMethod(
    335             getStreamingInputCallMethod(),
    336             asyncClientStreamingCall(
    337               new MethodHandlers<
    338                 io.grpc.testing.compiler.Test.StreamingInputCallRequest,
    339                 io.grpc.testing.compiler.Test.StreamingInputCallResponse>(
    340                   this, METHODID_STREAMING_INPUT_CALL)))
    341           .addMethod(
    342             getFullBidiCallMethod(),
    343             asyncBidiStreamingCall(
    344               new MethodHandlers<
    345                 io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    346                 io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
    347                   this, METHODID_FULL_BIDI_CALL)))
    348           .addMethod(
    349             getHalfBidiCallMethod(),
    350             asyncBidiStreamingCall(
    351               new MethodHandlers<
    352                 io.grpc.testing.compiler.Test.StreamingOutputCallRequest,
    353                 io.grpc.testing.compiler.Test.StreamingOutputCallResponse>(
    354                   this, METHODID_HALF_BIDI_CALL)))
    355           .addMethod(
    356             getImportMethod(),
    357             asyncBidiStreamingCall(
    358               new MethodHandlers<
    359                 io.grpc.testing.compiler.Test.StreamingInputCallRequest,
    360                 io.grpc.testing.compiler.Test.StreamingInputCallResponse>(
    361                   this, METHODID_IMPORT)))
    362           .build();
    363     }
    364   }
    365 
    366   /**
    367    * <pre>
    368    * Test service that supports all call types.
    369    * </pre>
    370    */
    371   public static final class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> {
    372     private TestServiceStub(io.grpc.Channel channel) {
    373       super(channel);
    374     }
    375 
    376     private TestServiceStub(io.grpc.Channel channel,
    377         io.grpc.CallOptions callOptions) {
    378       super(channel, callOptions);
    379     }
    380 
    381     @java.lang.Override
    382     protected TestServiceStub build(io.grpc.Channel channel,
    383         io.grpc.CallOptions callOptions) {
    384       return new TestServiceStub(channel, callOptions);
    385     }
    386 
    387     /**
    388      * <pre>
    389      * One request followed by one response.
    390      * The server returns the client payload as-is.
    391      * </pre>
    392      */
    393     public void unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request,
    394         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse> responseObserver) {
    395       asyncUnaryCall(
    396           getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
    397     }
    398 
    399     /**
    400      * <pre>
    401      * One request followed by a sequence of responses (streamed download).
    402      * The server returns the payload with client desired type and sizes.
    403      * </pre>
    404      */
    405     public void streamingOutputCall(io.grpc.testing.compiler.Test.StreamingOutputCallRequest request,
    406         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
    407       asyncServerStreamingCall(
    408           getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
    409     }
    410 
    411     /**
    412      * <pre>
    413      * A sequence of requests followed by one response (streamed upload).
    414      * The server returns the aggregated size of client payload as the result.
    415      * </pre>
    416      */
    417     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> streamingInputCall(
    418         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
    419       return asyncClientStreamingCall(
    420           getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
    421     }
    422 
    423     /**
    424      * <pre>
    425      * A sequence of requests with each request served by the server immediately.
    426      * As one request could lead to multiple responses, this interface
    427      * demonstrates the idea of full bidirectionality.
    428      * </pre>
    429      */
    430     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> fullBidiCall(
    431         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
    432       return asyncBidiStreamingCall(
    433           getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
    434     }
    435 
    436     /**
    437      * <pre>
    438      * A sequence of requests followed by a sequence of responses.
    439      * The server buffers all the client requests and then serves them in order. A
    440      * stream of responses are returned to the client when the server starts with
    441      * first request.
    442      * </pre>
    443      */
    444     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallRequest> halfBidiCall(
    445         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> responseObserver) {
    446       return asyncBidiStreamingCall(
    447           getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
    448     }
    449 
    450     /**
    451      * <pre>
    452      * An RPC method whose Java name collides with a keyword, and whose generated
    453      * method should have a '_' appended.
    454      * </pre>
    455      */
    456     public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallRequest> import_(
    457         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse> responseObserver) {
    458       return asyncBidiStreamingCall(
    459           getChannel().newCall(getImportMethod(), getCallOptions()), responseObserver);
    460     }
    461   }
    462 
    463   /**
    464    * <pre>
    465    * Test service that supports all call types.
    466    * </pre>
    467    */
    468   public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> {
    469     private TestServiceBlockingStub(io.grpc.Channel channel) {
    470       super(channel);
    471     }
    472 
    473     private TestServiceBlockingStub(io.grpc.Channel channel,
    474         io.grpc.CallOptions callOptions) {
    475       super(channel, callOptions);
    476     }
    477 
    478     @java.lang.Override
    479     protected TestServiceBlockingStub build(io.grpc.Channel channel,
    480         io.grpc.CallOptions callOptions) {
    481       return new TestServiceBlockingStub(channel, callOptions);
    482     }
    483 
    484     /**
    485      * <pre>
    486      * One request followed by one response.
    487      * The server returns the client payload as-is.
    488      * </pre>
    489      */
    490     public io.grpc.testing.compiler.Test.SimpleResponse unaryCall(io.grpc.testing.compiler.Test.SimpleRequest request) {
    491       return blockingUnaryCall(
    492           getChannel(), getUnaryCallMethod(), getCallOptions(), request);
    493     }
    494 
    495     /**
    496      * <pre>
    497      * One request followed by a sequence of responses (streamed download).
    498      * The server returns the payload with client desired type and sizes.
    499      * </pre>
    500      */
    501     public java.util.Iterator<io.grpc.testing.compiler.Test.StreamingOutputCallResponse> streamingOutputCall(
    502         io.grpc.testing.compiler.Test.StreamingOutputCallRequest request) {
    503       return blockingServerStreamingCall(
    504           getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
    505     }
    506   }
    507 
    508   /**
    509    * <pre>
    510    * Test service that supports all call types.
    511    * </pre>
    512    */
    513   public static final class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> {
    514     private TestServiceFutureStub(io.grpc.Channel channel) {
    515       super(channel);
    516     }
    517 
    518     private TestServiceFutureStub(io.grpc.Channel channel,
    519         io.grpc.CallOptions callOptions) {
    520       super(channel, callOptions);
    521     }
    522 
    523     @java.lang.Override
    524     protected TestServiceFutureStub build(io.grpc.Channel channel,
    525         io.grpc.CallOptions callOptions) {
    526       return new TestServiceFutureStub(channel, callOptions);
    527     }
    528 
    529     /**
    530      * <pre>
    531      * One request followed by one response.
    532      * The server returns the client payload as-is.
    533      * </pre>
    534      */
    535     public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.Test.SimpleResponse> unaryCall(
    536         io.grpc.testing.compiler.Test.SimpleRequest request) {
    537       return futureUnaryCall(
    538           getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
    539     }
    540   }
    541 
    542   private static final int METHODID_UNARY_CALL = 0;
    543   private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
    544   private static final int METHODID_STREAMING_INPUT_CALL = 2;
    545   private static final int METHODID_FULL_BIDI_CALL = 3;
    546   private static final int METHODID_HALF_BIDI_CALL = 4;
    547   private static final int METHODID_IMPORT = 5;
    548 
    549   private static final class MethodHandlers<Req, Resp> implements
    550       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
    551       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
    552       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
    553       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    554     private final TestServiceImplBase serviceImpl;
    555     private final int methodId;
    556 
    557     MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
    558       this.serviceImpl = serviceImpl;
    559       this.methodId = methodId;
    560     }
    561 
    562     @java.lang.Override
    563     @java.lang.SuppressWarnings("unchecked")
    564     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
    565       switch (methodId) {
    566         case METHODID_UNARY_CALL:
    567           serviceImpl.unaryCall((io.grpc.testing.compiler.Test.SimpleRequest) request,
    568               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.SimpleResponse>) responseObserver);
    569           break;
    570         case METHODID_STREAMING_OUTPUT_CALL:
    571           serviceImpl.streamingOutputCall((io.grpc.testing.compiler.Test.StreamingOutputCallRequest) request,
    572               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
    573           break;
    574         default:
    575           throw new AssertionError();
    576       }
    577     }
    578 
    579     @java.lang.Override
    580     @java.lang.SuppressWarnings("unchecked")
    581     public io.grpc.stub.StreamObserver<Req> invoke(
    582         io.grpc.stub.StreamObserver<Resp> responseObserver) {
    583       switch (methodId) {
    584         case METHODID_STREAMING_INPUT_CALL:
    585           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
    586               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse>) responseObserver);
    587         case METHODID_FULL_BIDI_CALL:
    588           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
    589               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
    590         case METHODID_HALF_BIDI_CALL:
    591           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
    592               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingOutputCallResponse>) responseObserver);
    593         case METHODID_IMPORT:
    594           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
    595               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.Test.StreamingInputCallResponse>) responseObserver);
    596         default:
    597           throw new AssertionError();
    598       }
    599     }
    600   }
    601 
    602   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
    603 
    604   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    605     io.grpc.ServiceDescriptor result = serviceDescriptor;
    606     if (result == null) {
    607       synchronized (TestServiceGrpc.class) {
    608         result = serviceDescriptor;
    609         if (result == null) {
    610           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
    611               .addMethod(getUnaryCallMethod())
    612               .addMethod(getStreamingOutputCallMethod())
    613               .addMethod(getStreamingInputCallMethod())
    614               .addMethod(getFullBidiCallMethod())
    615               .addMethod(getHalfBidiCallMethod())
    616               .addMethod(getImportMethod())
    617               .build();
    618         }
    619       }
    620     }
    621     return result;
    622   }
    623 }
    624