nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 1 | package io.grpc.testing.integration; |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 2 | |
Kun Zhang | 2ee4d02 | 2015-06-04 16:39:25 -0700 | [diff] [blame] | 3 | import static io.grpc.stub.ClientCalls.asyncUnaryCall; |
| 4 | import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; |
| 5 | import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 6 | import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; |
Kun Zhang | 2ee4d02 | 2015-06-04 16:39:25 -0700 | [diff] [blame] | 7 | import static io.grpc.stub.ClientCalls.blockingUnaryCall; |
| 8 | import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; |
Kun Zhang | 686dcff | 2015-07-16 12:34:37 -0700 | [diff] [blame] | 9 | import static io.grpc.stub.ClientCalls.futureUnaryCall; |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 10 | import static io.grpc.MethodDescriptor.generateFullMethodName; |
Kun Zhang | 867c76d | 2015-07-13 17:15:34 -0700 | [diff] [blame] | 11 | import static io.grpc.stub.ServerCalls.asyncUnaryCall; |
| 12 | import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; |
| 13 | import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 14 | import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 15 | |
| 16 | @javax.annotation.Generated("by gRPC proto compiler") |
| 17 | public class TestServiceGrpc { |
| 18 | |
Eric Anderson | be0d7e9 | 2015-09-10 09:47:17 -0700 | [diff] [blame] | 19 | private TestServiceGrpc() {} |
| 20 | |
David P. Baker | 66b984c | 2015-08-21 13:00:26 -0400 | [diff] [blame] | 21 | public static final String SERVICE_NAME = "grpc.testing.TestService"; |
| 22 | |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 23 | // Static method descriptors that strictly reflect the proto. |
Kun Zhang | 5bb0ea9 | 2015-08-31 09:56:44 -0700 | [diff] [blame] | 24 | @io.grpc.ExperimentalApi |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 25 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest, |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 26 | io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 27 | io.grpc.MethodDescriptor.create( |
| 28 | io.grpc.MethodDescriptor.MethodType.UNARY, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 29 | generateFullMethodName( |
| 30 | "grpc.testing.TestService", "UnaryCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 31 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()), |
| 32 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance())); |
Kun Zhang | 5bb0ea9 | 2015-08-31 09:56:44 -0700 | [diff] [blame] | 33 | @io.grpc.ExperimentalApi |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 34 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 35 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 36 | io.grpc.MethodDescriptor.create( |
| 37 | io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 38 | generateFullMethodName( |
| 39 | "grpc.testing.TestService", "StreamingOutputCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 40 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 41 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance())); |
Kun Zhang | 5bb0ea9 | 2015-08-31 09:56:44 -0700 | [diff] [blame] | 42 | @io.grpc.ExperimentalApi |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 43 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 44 | io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 45 | io.grpc.MethodDescriptor.create( |
| 46 | io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 47 | generateFullMethodName( |
| 48 | "grpc.testing.TestService", "StreamingInputCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 49 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()), |
| 50 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance())); |
Kun Zhang | 5bb0ea9 | 2015-08-31 09:56:44 -0700 | [diff] [blame] | 51 | @io.grpc.ExperimentalApi |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 52 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 53 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 54 | io.grpc.MethodDescriptor.create( |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 55 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 56 | generateFullMethodName( |
| 57 | "grpc.testing.TestService", "FullBidiCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 58 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 59 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance())); |
Kun Zhang | 5bb0ea9 | 2015-08-31 09:56:44 -0700 | [diff] [blame] | 60 | @io.grpc.ExperimentalApi |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 61 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 62 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 63 | io.grpc.MethodDescriptor.create( |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 64 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 65 | generateFullMethodName( |
| 66 | "grpc.testing.TestService", "HalfBidiCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 67 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 68 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance())); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 69 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 70 | public static TestServiceStub newStub(io.grpc.Channel channel) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 71 | return new TestServiceStub(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | public static TestServiceBlockingStub newBlockingStub( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 75 | io.grpc.Channel channel) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 76 | return new TestServiceBlockingStub(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | public static TestServiceFutureStub newFutureStub( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 80 | io.grpc.Channel channel) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 81 | return new TestServiceFutureStub(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | public static interface TestService { |
| 85 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 86 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 87 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 88 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 89 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 90 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 91 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 92 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 93 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 94 | |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 95 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 96 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 97 | |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 98 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 99 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | public static interface TestServiceBlockingClient { |
| 103 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 104 | public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 105 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 106 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 107 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | public static interface TestServiceFutureClient { |
| 111 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 112 | public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall( |
| 113 | io.grpc.testing.integration.Test.SimpleRequest request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 114 | } |
| 115 | |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 116 | public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 117 | implements TestService { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 118 | private TestServiceStub(io.grpc.Channel channel) { |
| 119 | super(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 120 | } |
| 121 | |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 122 | private TestServiceStub(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 123 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 124 | super(channel, callOptions); |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 125 | } |
| 126 | |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 127 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 128 | protected TestServiceStub build(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 129 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 130 | return new TestServiceStub(channel, callOptions); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 134 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 135 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 136 | asyncUnaryCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 137 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 141 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 142 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 143 | asyncServerStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 144 | getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 148 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 149 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 150 | return asyncClientStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 151 | getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | @java.lang.Override |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 155 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 156 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 157 | return asyncBidiStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 158 | getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | @java.lang.Override |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 162 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 163 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 164 | return asyncBidiStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 165 | getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 169 | public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 170 | implements TestServiceBlockingClient { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 171 | private TestServiceBlockingStub(io.grpc.Channel channel) { |
| 172 | super(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 175 | private TestServiceBlockingStub(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 176 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 177 | super(channel, callOptions); |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 178 | } |
| 179 | |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 180 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 181 | protected TestServiceBlockingStub build(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 182 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 183 | return new TestServiceBlockingStub(channel, callOptions); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 187 | public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 188 | return blockingUnaryCall( |
Eric Anderson | 4168f67 | 2015-08-04 16:37:00 -0700 | [diff] [blame^] | 189 | getChannel(), METHOD_UNARY_CALL, getCallOptions(), request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 193 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 194 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 195 | return blockingServerStreamingCall( |
Eric Anderson | 4168f67 | 2015-08-04 16:37:00 -0700 | [diff] [blame^] | 196 | getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 200 | public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 201 | implements TestServiceFutureClient { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 202 | private TestServiceFutureStub(io.grpc.Channel channel) { |
| 203 | super(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 204 | } |
| 205 | |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 206 | private TestServiceFutureStub(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 207 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 208 | super(channel, callOptions); |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 209 | } |
| 210 | |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 211 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 212 | protected TestServiceFutureStub build(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 213 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 214 | return new TestServiceFutureStub(channel, callOptions); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 218 | public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall( |
| 219 | io.grpc.testing.integration.Test.SimpleRequest request) { |
Kun Zhang | 686dcff | 2015-07-16 12:34:37 -0700 | [diff] [blame] | 220 | return futureUnaryCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 221 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 225 | private static final int METHODID_UNARY_CALL = 0; |
| 226 | private static final int METHODID_STREAMING_OUTPUT_CALL = 1; |
| 227 | private static final int METHODID_STREAMING_INPUT_CALL = 2; |
| 228 | private static final int METHODID_FULL_BIDI_CALL = 3; |
| 229 | private static final int METHODID_HALF_BIDI_CALL = 4; |
| 230 | |
| 231 | private static class MethodHandlers<Req, Resp> implements |
| 232 | io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, |
| 233 | io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, |
| 234 | io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, |
| 235 | io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { |
| 236 | private final TestService serviceImpl; |
| 237 | private final int methodId; |
| 238 | |
| 239 | public MethodHandlers(TestService serviceImpl, int methodId) { |
| 240 | this.serviceImpl = serviceImpl; |
| 241 | this.methodId = methodId; |
| 242 | } |
| 243 | |
| 244 | @java.lang.SuppressWarnings("unchecked") |
| 245 | public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 246 | switch (methodId) { |
| 247 | case METHODID_UNARY_CALL: |
| 248 | serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request, |
| 249 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver); |
| 250 | break; |
| 251 | case METHODID_STREAMING_OUTPUT_CALL: |
| 252 | serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request, |
| 253 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
| 254 | break; |
| 255 | default: |
| 256 | throw new AssertionError(); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | @java.lang.SuppressWarnings("unchecked") |
| 261 | public io.grpc.stub.StreamObserver<Req> invoke( |
| 262 | io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 263 | switch (methodId) { |
| 264 | case METHODID_STREAMING_INPUT_CALL: |
| 265 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall( |
| 266 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver); |
| 267 | case METHODID_FULL_BIDI_CALL: |
| 268 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall( |
| 269 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
| 270 | case METHODID_HALF_BIDI_CALL: |
| 271 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall( |
| 272 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
| 273 | default: |
| 274 | throw new AssertionError(); |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 279 | public static io.grpc.ServerServiceDefinition bindService( |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 280 | final TestService serviceImpl) { |
David P. Baker | 66b984c | 2015-08-21 13:00:26 -0400 | [diff] [blame] | 281 | return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME) |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 282 | .addMethod( |
| 283 | METHOD_UNARY_CALL, |
| 284 | asyncUnaryCall( |
| 285 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 286 | io.grpc.testing.integration.Test.SimpleRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 287 | io.grpc.testing.integration.Test.SimpleResponse>( |
| 288 | serviceImpl, METHODID_UNARY_CALL))) |
| 289 | .addMethod( |
| 290 | METHOD_STREAMING_OUTPUT_CALL, |
| 291 | asyncServerStreamingCall( |
| 292 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 293 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 294 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
| 295 | serviceImpl, METHODID_STREAMING_OUTPUT_CALL))) |
| 296 | .addMethod( |
| 297 | METHOD_STREAMING_INPUT_CALL, |
| 298 | asyncClientStreamingCall( |
| 299 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 300 | io.grpc.testing.integration.Test.StreamingInputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 301 | io.grpc.testing.integration.Test.StreamingInputCallResponse>( |
| 302 | serviceImpl, METHODID_STREAMING_INPUT_CALL))) |
| 303 | .addMethod( |
| 304 | METHOD_FULL_BIDI_CALL, |
| 305 | asyncBidiStreamingCall( |
| 306 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 307 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 308 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
| 309 | serviceImpl, METHODID_FULL_BIDI_CALL))) |
| 310 | .addMethod( |
| 311 | METHOD_HALF_BIDI_CALL, |
| 312 | asyncBidiStreamingCall( |
| 313 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 314 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 315 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
| 316 | serviceImpl, METHODID_HALF_BIDI_CALL))) |
| 317 | .build(); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 318 | } |
| 319 | } |