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; |
Lukasz Strzalkowski | 2fbf142 | 2016-04-08 02:28:32 +0200 | [diff] [blame] | 15 | import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; |
| 16 | import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 17 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 18 | /** |
| 19 | * <pre> |
| 20 | * Test service that supports all call types. |
| 21 | * </pre> |
| 22 | */ |
Carl Mastrangelo | 72f1e88 | 2016-02-29 18:05:33 -0800 | [diff] [blame] | 23 | @javax.annotation.Generated( |
Carl Mastrangelo | 3c5b5a5 | 2016-04-29 13:37:20 -0700 | [diff] [blame] | 24 | value = "by gRPC proto compiler (version 0.15.0-SNAPSHOT)", |
Carl Mastrangelo | 72f1e88 | 2016-02-29 18:05:33 -0800 | [diff] [blame] | 25 | comments = "Source: test.proto") |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 26 | public class TestServiceGrpc { |
| 27 | |
Eric Anderson | be0d7e9 | 2015-09-10 09:47:17 -0700 | [diff] [blame] | 28 | private TestServiceGrpc() {} |
| 29 | |
David P. Baker | 66b984c | 2015-08-21 13:00:26 -0400 | [diff] [blame] | 30 | public static final String SERVICE_NAME = "grpc.testing.TestService"; |
| 31 | |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 32 | // Static method descriptors that strictly reflect the proto. |
Eric Anderson | 7c722e4 | 2016-06-07 15:00:29 -0700 | [diff] [blame] | 33 | @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 34 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest, |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 35 | io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 36 | io.grpc.MethodDescriptor.create( |
| 37 | io.grpc.MethodDescriptor.MethodType.UNARY, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 38 | generateFullMethodName( |
| 39 | "grpc.testing.TestService", "UnaryCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 40 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()), |
| 41 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleResponse.getDefaultInstance())); |
Eric Anderson | 7c722e4 | 2016-06-07 15:00:29 -0700 | [diff] [blame] | 42 | @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 43 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 44 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 45 | io.grpc.MethodDescriptor.create( |
| 46 | io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 47 | generateFullMethodName( |
| 48 | "grpc.testing.TestService", "StreamingOutputCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 49 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 50 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance())); |
Eric Anderson | 7c722e4 | 2016-06-07 15:00:29 -0700 | [diff] [blame] | 51 | @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 52 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 53 | io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 54 | io.grpc.MethodDescriptor.create( |
| 55 | io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 56 | generateFullMethodName( |
| 57 | "grpc.testing.TestService", "StreamingInputCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 58 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()), |
| 59 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance())); |
Eric Anderson | 7c722e4 | 2016-06-07 15:00:29 -0700 | [diff] [blame] | 60 | @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") |
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_FULL_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", "FullBidiCall"), |
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())); |
Eric Anderson | 7c722e4 | 2016-06-07 15:00:29 -0700 | [diff] [blame] | 69 | @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 70 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 71 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = |
Kun Zhang | 73acc73 | 2015-06-26 16:32:05 -0700 | [diff] [blame] | 72 | io.grpc.MethodDescriptor.create( |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 73 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
Kun Zhang | 042b278 | 2015-08-17 15:43:40 -0700 | [diff] [blame] | 74 | generateFullMethodName( |
| 75 | "grpc.testing.TestService", "HalfBidiCall"), |
Eric Anderson | 47a7ccf | 2015-09-03 16:56:36 -0700 | [diff] [blame] | 76 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 77 | io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance())); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 78 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 79 | /** |
| 80 | * Creates a new async stub that supports all call types for the service |
| 81 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 82 | public static TestServiceStub newStub(io.grpc.Channel channel) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 83 | return new TestServiceStub(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 84 | } |
| 85 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 86 | /** |
| 87 | * Creates a new blocking-style stub that supports unary and streaming output calls on the service |
| 88 | */ |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 89 | public static TestServiceBlockingStub newBlockingStub( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 90 | io.grpc.Channel channel) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 91 | return new TestServiceBlockingStub(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 92 | } |
| 93 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 94 | /** |
| 95 | * Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service |
| 96 | */ |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 97 | public static TestServiceFutureStub newFutureStub( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 98 | io.grpc.Channel channel) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 99 | return new TestServiceFutureStub(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 100 | } |
| 101 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 102 | /** |
| 103 | * <pre> |
| 104 | * Test service that supports all call types. |
| 105 | * </pre> |
| 106 | */ |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 107 | public static interface TestService { |
| 108 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 109 | /** |
| 110 | * <pre> |
| 111 | * One request followed by one response. |
| 112 | * The server returns the client payload as-is. |
| 113 | * </pre> |
| 114 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 115 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 116 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 117 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 118 | /** |
| 119 | * <pre> |
| 120 | * One request followed by a sequence of responses (streamed download). |
| 121 | * The server returns the payload with client desired type and sizes. |
| 122 | * </pre> |
| 123 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 124 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 125 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 126 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 127 | /** |
| 128 | * <pre> |
| 129 | * A sequence of requests followed by one response (streamed upload). |
| 130 | * The server returns the aggregated size of client payload as the result. |
| 131 | * </pre> |
| 132 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 133 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 134 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 135 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 136 | /** |
| 137 | * <pre> |
| 138 | * A sequence of requests with each request served by the server immediately. |
| 139 | * As one request could lead to multiple responses, this interface |
| 140 | * demonstrates the idea of full bidirectionality. |
| 141 | * </pre> |
| 142 | */ |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 143 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 144 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 145 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 146 | /** |
| 147 | * <pre> |
| 148 | * A sequence of requests followed by a sequence of responses. |
| 149 | * The server buffers all the client requests and then serves them in order. A |
| 150 | * stream of responses are returned to the client when the server starts with |
| 151 | * first request. |
| 152 | * </pre> |
| 153 | */ |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 154 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 155 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 156 | } |
| 157 | |
Eric Anderson | 7c722e4 | 2016-06-07 15:00:29 -0700 | [diff] [blame] | 158 | @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1469") |
Lukasz Strzalkowski | 2fbf142 | 2016-04-08 02:28:32 +0200 | [diff] [blame] | 159 | public static abstract class AbstractTestService implements TestService, io.grpc.BindableService { |
| 160 | |
| 161 | @java.lang.Override |
| 162 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 163 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) { |
| 164 | asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); |
| 165 | } |
| 166 | |
| 167 | @java.lang.Override |
| 168 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 169 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
| 170 | asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); |
| 171 | } |
| 172 | |
| 173 | @java.lang.Override |
| 174 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 175 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) { |
| 176 | return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); |
| 177 | } |
| 178 | |
| 179 | @java.lang.Override |
| 180 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
| 181 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
| 182 | return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); |
| 183 | } |
| 184 | |
| 185 | @java.lang.Override |
| 186 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
| 187 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
| 188 | return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver); |
| 189 | } |
| 190 | |
| 191 | @java.lang.Override public io.grpc.ServerServiceDefinition bindService() { |
| 192 | return TestServiceGrpc.bindService(this); |
| 193 | } |
| 194 | } |
| 195 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 196 | /** |
| 197 | * <pre> |
| 198 | * Test service that supports all call types. |
| 199 | * </pre> |
| 200 | */ |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 201 | public static interface TestServiceBlockingClient { |
| 202 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 203 | /** |
| 204 | * <pre> |
| 205 | * One request followed by one response. |
| 206 | * The server returns the client payload as-is. |
| 207 | * </pre> |
| 208 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 209 | 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] | 210 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 211 | /** |
| 212 | * <pre> |
| 213 | * One request followed by a sequence of responses (streamed download). |
| 214 | * The server returns the payload with client desired type and sizes. |
| 215 | * </pre> |
| 216 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 217 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 218 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 219 | } |
| 220 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 221 | /** |
| 222 | * <pre> |
| 223 | * Test service that supports all call types. |
| 224 | * </pre> |
| 225 | */ |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 226 | public static interface TestServiceFutureClient { |
| 227 | |
nmittler | 7e8b504 | 2016-04-15 12:52:00 -0700 | [diff] [blame] | 228 | /** |
| 229 | * <pre> |
| 230 | * One request followed by one response. |
| 231 | * The server returns the client payload as-is. |
| 232 | * </pre> |
| 233 | */ |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 234 | public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall( |
| 235 | io.grpc.testing.integration.Test.SimpleRequest request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 236 | } |
| 237 | |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 238 | public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 239 | implements TestService { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 240 | private TestServiceStub(io.grpc.Channel channel) { |
| 241 | super(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 242 | } |
| 243 | |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 244 | private TestServiceStub(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 245 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 246 | super(channel, callOptions); |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 247 | } |
| 248 | |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 249 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 250 | protected TestServiceStub build(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 251 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 252 | return new TestServiceStub(channel, callOptions); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 256 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 257 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 258 | asyncUnaryCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 259 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 263 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 264 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 265 | asyncServerStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 266 | getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 270 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 271 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 272 | return asyncClientStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 273 | getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | @java.lang.Override |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 277 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 278 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 279 | return asyncBidiStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 280 | getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | @java.lang.Override |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 284 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 285 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Carl Mastrangelo | 67fc45d | 2015-08-05 13:56:50 -0700 | [diff] [blame] | 286 | return asyncBidiStreamingCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 287 | getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 288 | } |
| 289 | } |
| 290 | |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 291 | public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 292 | implements TestServiceBlockingClient { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 293 | private TestServiceBlockingStub(io.grpc.Channel channel) { |
| 294 | super(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 295 | } |
| 296 | |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 297 | private TestServiceBlockingStub(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 298 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 299 | super(channel, callOptions); |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 300 | } |
| 301 | |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 302 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 303 | protected TestServiceBlockingStub build(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 304 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 305 | return new TestServiceBlockingStub(channel, callOptions); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 309 | 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] | 310 | return blockingUnaryCall( |
Eric Anderson | 4168f67 | 2015-08-04 16:37:00 -0700 | [diff] [blame] | 311 | getChannel(), METHOD_UNARY_CALL, getCallOptions(), request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 315 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 316 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request) { |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 317 | return blockingServerStreamingCall( |
Eric Anderson | 4168f67 | 2015-08-04 16:37:00 -0700 | [diff] [blame] | 318 | getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 319 | } |
| 320 | } |
| 321 | |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 322 | public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 323 | implements TestServiceFutureClient { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 324 | private TestServiceFutureStub(io.grpc.Channel channel) { |
| 325 | super(channel); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 326 | } |
| 327 | |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 328 | private TestServiceFutureStub(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 329 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 330 | super(channel, callOptions); |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 331 | } |
| 332 | |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 333 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 334 | protected TestServiceFutureStub build(io.grpc.Channel channel, |
Kun Zhang | d3c5b00 | 2015-06-25 20:24:01 -0700 | [diff] [blame] | 335 | io.grpc.CallOptions callOptions) { |
Kun Zhang | eb92967 | 2015-07-17 17:02:58 -0700 | [diff] [blame] | 336 | return new TestServiceFutureStub(channel, callOptions); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | @java.lang.Override |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 340 | public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall( |
| 341 | io.grpc.testing.integration.Test.SimpleRequest request) { |
Kun Zhang | 686dcff | 2015-07-16 12:34:37 -0700 | [diff] [blame] | 342 | return futureUnaryCall( |
Eric Anderson | 23e6318 | 2015-09-10 08:36:08 -0700 | [diff] [blame] | 343 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 344 | } |
| 345 | } |
| 346 | |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 347 | private static final int METHODID_UNARY_CALL = 0; |
| 348 | private static final int METHODID_STREAMING_OUTPUT_CALL = 1; |
| 349 | private static final int METHODID_STREAMING_INPUT_CALL = 2; |
| 350 | private static final int METHODID_FULL_BIDI_CALL = 3; |
| 351 | private static final int METHODID_HALF_BIDI_CALL = 4; |
| 352 | |
| 353 | private static class MethodHandlers<Req, Resp> implements |
| 354 | io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, |
| 355 | io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, |
| 356 | io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, |
| 357 | io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { |
| 358 | private final TestService serviceImpl; |
| 359 | private final int methodId; |
| 360 | |
| 361 | public MethodHandlers(TestService serviceImpl, int methodId) { |
| 362 | this.serviceImpl = serviceImpl; |
| 363 | this.methodId = methodId; |
| 364 | } |
| 365 | |
Carl Mastrangelo | ffe0dce | 2016-03-04 14:15:02 -0800 | [diff] [blame] | 366 | @java.lang.Override |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 367 | @java.lang.SuppressWarnings("unchecked") |
| 368 | public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 369 | switch (methodId) { |
| 370 | case METHODID_UNARY_CALL: |
| 371 | serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request, |
| 372 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver); |
| 373 | break; |
| 374 | case METHODID_STREAMING_OUTPUT_CALL: |
| 375 | serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request, |
| 376 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
| 377 | break; |
| 378 | default: |
| 379 | throw new AssertionError(); |
| 380 | } |
| 381 | } |
| 382 | |
Carl Mastrangelo | ffe0dce | 2016-03-04 14:15:02 -0800 | [diff] [blame] | 383 | @java.lang.Override |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 384 | @java.lang.SuppressWarnings("unchecked") |
| 385 | public io.grpc.stub.StreamObserver<Req> invoke( |
| 386 | io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 387 | switch (methodId) { |
| 388 | case METHODID_STREAMING_INPUT_CALL: |
| 389 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall( |
| 390 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver); |
| 391 | case METHODID_FULL_BIDI_CALL: |
| 392 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall( |
| 393 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
| 394 | case METHODID_HALF_BIDI_CALL: |
| 395 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall( |
| 396 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
| 397 | default: |
| 398 | throw new AssertionError(); |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
Eric Anderson | 66ab956 | 2016-06-20 15:22:23 -0700 | [diff] [blame^] | 403 | public static io.grpc.ServiceDescriptor getServiceDescriptor() { |
| 404 | return new io.grpc.ServiceDescriptor(SERVICE_NAME, |
| 405 | METHOD_UNARY_CALL, |
| 406 | METHOD_STREAMING_OUTPUT_CALL, |
| 407 | METHOD_STREAMING_INPUT_CALL, |
| 408 | METHOD_FULL_BIDI_CALL, |
| 409 | METHOD_HALF_BIDI_CALL); |
| 410 | } |
| 411 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 412 | public static io.grpc.ServerServiceDefinition bindService( |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 413 | final TestService serviceImpl) { |
Eric Anderson | 66ab956 | 2016-06-20 15:22:23 -0700 | [diff] [blame^] | 414 | return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 415 | .addMethod( |
| 416 | METHOD_UNARY_CALL, |
| 417 | asyncUnaryCall( |
| 418 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 419 | io.grpc.testing.integration.Test.SimpleRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 420 | io.grpc.testing.integration.Test.SimpleResponse>( |
| 421 | serviceImpl, METHODID_UNARY_CALL))) |
| 422 | .addMethod( |
| 423 | METHOD_STREAMING_OUTPUT_CALL, |
| 424 | asyncServerStreamingCall( |
| 425 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 426 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 427 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
| 428 | serviceImpl, METHODID_STREAMING_OUTPUT_CALL))) |
| 429 | .addMethod( |
| 430 | METHOD_STREAMING_INPUT_CALL, |
| 431 | asyncClientStreamingCall( |
| 432 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 433 | io.grpc.testing.integration.Test.StreamingInputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 434 | io.grpc.testing.integration.Test.StreamingInputCallResponse>( |
| 435 | serviceImpl, METHODID_STREAMING_INPUT_CALL))) |
| 436 | .addMethod( |
| 437 | METHOD_FULL_BIDI_CALL, |
| 438 | asyncBidiStreamingCall( |
| 439 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 440 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 441 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
| 442 | serviceImpl, METHODID_FULL_BIDI_CALL))) |
| 443 | .addMethod( |
| 444 | METHOD_HALF_BIDI_CALL, |
| 445 | asyncBidiStreamingCall( |
| 446 | new MethodHandlers< |
Eric Anderson | a6621da | 2015-09-10 17:37:21 -0700 | [diff] [blame] | 447 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
Eric Anderson | d52429d | 2015-11-13 16:50:08 -0800 | [diff] [blame] | 448 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
| 449 | serviceImpl, METHODID_HALF_BIDI_CALL))) |
| 450 | .build(); |
zhangkun83 | 5e60785 | 2015-01-22 12:31:56 -0800 | [diff] [blame] | 451 | } |
| 452 | } |