Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 1 | package io.grpc.testing.integration; |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 2 | |
| 3 | import static io.grpc.stub.ClientCalls.asyncUnaryCall; |
| 4 | import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; |
| 5 | import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; |
| 6 | import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; |
| 7 | import static io.grpc.stub.ClientCalls.blockingUnaryCall; |
| 8 | import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; |
| 9 | import static io.grpc.stub.ClientCalls.futureUnaryCall; |
| 10 | import static io.grpc.MethodDescriptor.generateFullMethodName; |
| 11 | import static io.grpc.stub.ServerCalls.asyncUnaryCall; |
| 12 | import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; |
| 13 | import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; |
| 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; |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 23 | @javax.annotation.Generated( |
Eric Anderson | e9643bb | 2016-07-11 16:57:58 -0700 | [diff] [blame^] | 24 | value = "by gRPC proto compiler (version 1.1.0-SNAPSHOT)", |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 25 | comments = "Source: test.proto") |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 26 | public class TestServiceGrpc { |
| 27 | |
| 28 | private TestServiceGrpc() {} |
| 29 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 30 | public static final String SERVICE_NAME = "grpc.testing.TestService"; |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 31 | |
| 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") |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 34 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest, |
| 35 | io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 36 | io.grpc.MethodDescriptor.create( |
| 37 | io.grpc.MethodDescriptor.MethodType.UNARY, |
| 38 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 39 | "grpc.testing.TestService", "UnaryCall"), |
| 40 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()), |
| 41 | io.grpc.protobuf.lite.ProtoLiteUtils.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") |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 43 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 44 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 45 | io.grpc.MethodDescriptor.create( |
| 46 | io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING, |
| 47 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 48 | "grpc.testing.TestService", "StreamingOutputCall"), |
| 49 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 50 | io.grpc.protobuf.lite.ProtoLiteUtils.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") |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 52 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, |
| 53 | io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 54 | io.grpc.MethodDescriptor.create( |
| 55 | io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING, |
| 56 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 57 | "grpc.testing.TestService", "StreamingInputCall"), |
| 58 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()), |
| 59 | io.grpc.protobuf.lite.ProtoLiteUtils.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") |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 61 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 62 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 63 | io.grpc.MethodDescriptor.create( |
| 64 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
| 65 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 66 | "grpc.testing.TestService", "FullBidiCall"), |
| 67 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 68 | io.grpc.protobuf.lite.ProtoLiteUtils.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") |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 70 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 71 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 72 | io.grpc.MethodDescriptor.create( |
| 73 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
| 74 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 75 | "grpc.testing.TestService", "HalfBidiCall"), |
| 76 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 77 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.getDefaultInstance())); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 82 | public static TestServiceStub newStub(io.grpc.Channel channel) { |
| 83 | return new TestServiceStub(channel); |
| 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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 89 | public static TestServiceBlockingStub newBlockingStub( |
| 90 | io.grpc.Channel channel) { |
| 91 | return new TestServiceBlockingStub(channel); |
| 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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 97 | public static TestServiceFutureStub newFutureStub( |
| 98 | io.grpc.Channel channel) { |
| 99 | return new TestServiceFutureStub(channel); |
| 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 | */ |
ZHANG Dapeng | f149e4c | 2016-06-29 21:17:03 -0700 | [diff] [blame] | 107 | @java.lang.Deprecated public static interface TestService { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 143 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
| 144 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 154 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
| 155 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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") |
ZHANG Dapeng | f149e4c | 2016-06-29 21:17:03 -0700 | [diff] [blame] | 159 | public static abstract class TestServiceImplBase implements TestService, io.grpc.BindableService { |
Lukasz Strzalkowski | 2fbf142 | 2016-04-08 02:28:32 +0200 | [diff] [blame] | 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 | */ |
ZHANG Dapeng | f149e4c | 2016-06-29 21:17:03 -0700 | [diff] [blame] | 201 | @java.lang.Deprecated public static interface TestServiceBlockingClient { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 209 | public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 217 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 218 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
ZHANG Dapeng | f149e4c | 2016-06-29 21:17:03 -0700 | [diff] [blame] | 226 | @java.lang.Deprecated public static interface TestServiceFutureClient { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 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 | */ |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> |
| 239 | implements TestService { |
| 240 | private TestServiceStub(io.grpc.Channel channel) { |
| 241 | super(channel); |
| 242 | } |
| 243 | |
| 244 | private TestServiceStub(io.grpc.Channel channel, |
| 245 | io.grpc.CallOptions callOptions) { |
| 246 | super(channel, callOptions); |
| 247 | } |
| 248 | |
| 249 | @java.lang.Override |
| 250 | protected TestServiceStub build(io.grpc.Channel channel, |
| 251 | io.grpc.CallOptions callOptions) { |
| 252 | return new TestServiceStub(channel, callOptions); |
| 253 | } |
| 254 | |
| 255 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 258 | asyncUnaryCall( |
| 259 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); |
| 260 | } |
| 261 | |
| 262 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 265 | asyncServerStreamingCall( |
| 266 | getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); |
| 267 | } |
| 268 | |
| 269 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 272 | return asyncClientStreamingCall( |
| 273 | getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); |
| 274 | } |
| 275 | |
| 276 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 277 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
| 278 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 279 | return asyncBidiStreamingCall( |
| 280 | getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); |
| 281 | } |
| 282 | |
| 283 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 284 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
| 285 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 286 | return asyncBidiStreamingCall( |
| 287 | getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> |
| 292 | implements TestServiceBlockingClient { |
| 293 | private TestServiceBlockingStub(io.grpc.Channel channel) { |
| 294 | super(channel); |
| 295 | } |
| 296 | |
| 297 | private TestServiceBlockingStub(io.grpc.Channel channel, |
| 298 | io.grpc.CallOptions callOptions) { |
| 299 | super(channel, callOptions); |
| 300 | } |
| 301 | |
| 302 | @java.lang.Override |
| 303 | protected TestServiceBlockingStub build(io.grpc.Channel channel, |
| 304 | io.grpc.CallOptions callOptions) { |
| 305 | return new TestServiceBlockingStub(channel, callOptions); |
| 306 | } |
| 307 | |
| 308 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 309 | public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 310 | return blockingUnaryCall( |
| 311 | getChannel(), METHOD_UNARY_CALL, getCallOptions(), request); |
| 312 | } |
| 313 | |
| 314 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 315 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 316 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 317 | return blockingServerStreamingCall( |
| 318 | getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> |
| 323 | implements TestServiceFutureClient { |
| 324 | private TestServiceFutureStub(io.grpc.Channel channel) { |
| 325 | super(channel); |
| 326 | } |
| 327 | |
| 328 | private TestServiceFutureStub(io.grpc.Channel channel, |
| 329 | io.grpc.CallOptions callOptions) { |
| 330 | super(channel, callOptions); |
| 331 | } |
| 332 | |
| 333 | @java.lang.Override |
| 334 | protected TestServiceFutureStub build(io.grpc.Channel channel, |
| 335 | io.grpc.CallOptions callOptions) { |
| 336 | return new TestServiceFutureStub(channel, callOptions); |
| 337 | } |
| 338 | |
| 339 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [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) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 342 | return futureUnaryCall( |
| 343 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request); |
| 344 | } |
| 345 | } |
| 346 | |
ZHANG Dapeng | f149e4c | 2016-06-29 21:17:03 -0700 | [diff] [blame] | 347 | @java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {} |
| 348 | |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 349 | private static final int METHODID_UNARY_CALL = 0; |
| 350 | private static final int METHODID_STREAMING_OUTPUT_CALL = 1; |
| 351 | private static final int METHODID_STREAMING_INPUT_CALL = 2; |
| 352 | private static final int METHODID_FULL_BIDI_CALL = 3; |
| 353 | private static final int METHODID_HALF_BIDI_CALL = 4; |
| 354 | |
| 355 | private static class MethodHandlers<Req, Resp> implements |
| 356 | io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, |
| 357 | io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, |
| 358 | io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, |
| 359 | io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { |
| 360 | private final TestService serviceImpl; |
| 361 | private final int methodId; |
| 362 | |
| 363 | public MethodHandlers(TestService serviceImpl, int methodId) { |
| 364 | this.serviceImpl = serviceImpl; |
| 365 | this.methodId = methodId; |
| 366 | } |
| 367 | |
| 368 | @java.lang.Override |
| 369 | @java.lang.SuppressWarnings("unchecked") |
| 370 | public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 371 | switch (methodId) { |
| 372 | case METHODID_UNARY_CALL: |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 373 | serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request, |
| 374 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 375 | break; |
| 376 | case METHODID_STREAMING_OUTPUT_CALL: |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 377 | serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request, |
| 378 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 379 | break; |
| 380 | default: |
| 381 | throw new AssertionError(); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | @java.lang.Override |
| 386 | @java.lang.SuppressWarnings("unchecked") |
| 387 | public io.grpc.stub.StreamObserver<Req> invoke( |
| 388 | io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 389 | switch (methodId) { |
| 390 | case METHODID_STREAMING_INPUT_CALL: |
| 391 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 392 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 393 | case METHODID_FULL_BIDI_CALL: |
| 394 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 395 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 396 | case METHODID_HALF_BIDI_CALL: |
| 397 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 398 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 399 | default: |
| 400 | throw new AssertionError(); |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
Eric Anderson | 66ab956 | 2016-06-20 15:22:23 -0700 | [diff] [blame] | 405 | public static io.grpc.ServiceDescriptor getServiceDescriptor() { |
| 406 | return new io.grpc.ServiceDescriptor(SERVICE_NAME, |
| 407 | METHOD_UNARY_CALL, |
| 408 | METHOD_STREAMING_OUTPUT_CALL, |
| 409 | METHOD_STREAMING_INPUT_CALL, |
| 410 | METHOD_FULL_BIDI_CALL, |
| 411 | METHOD_HALF_BIDI_CALL); |
| 412 | } |
| 413 | |
ZHANG Dapeng | f149e4c | 2016-06-29 21:17:03 -0700 | [diff] [blame] | 414 | @java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 415 | final TestService serviceImpl) { |
Eric Anderson | 66ab956 | 2016-06-20 15:22:23 -0700 | [diff] [blame] | 416 | return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 417 | .addMethod( |
| 418 | METHOD_UNARY_CALL, |
| 419 | asyncUnaryCall( |
| 420 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 421 | io.grpc.testing.integration.Test.SimpleRequest, |
| 422 | io.grpc.testing.integration.Test.SimpleResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 423 | serviceImpl, METHODID_UNARY_CALL))) |
| 424 | .addMethod( |
| 425 | METHOD_STREAMING_OUTPUT_CALL, |
| 426 | asyncServerStreamingCall( |
| 427 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 428 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 429 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 430 | serviceImpl, METHODID_STREAMING_OUTPUT_CALL))) |
| 431 | .addMethod( |
| 432 | METHOD_STREAMING_INPUT_CALL, |
| 433 | asyncClientStreamingCall( |
| 434 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 435 | io.grpc.testing.integration.Test.StreamingInputCallRequest, |
| 436 | io.grpc.testing.integration.Test.StreamingInputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 437 | serviceImpl, METHODID_STREAMING_INPUT_CALL))) |
| 438 | .addMethod( |
| 439 | METHOD_FULL_BIDI_CALL, |
| 440 | asyncBidiStreamingCall( |
| 441 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 442 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 443 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 444 | serviceImpl, METHODID_FULL_BIDI_CALL))) |
| 445 | .addMethod( |
| 446 | METHOD_HALF_BIDI_CALL, |
| 447 | asyncBidiStreamingCall( |
| 448 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 449 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 450 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 451 | serviceImpl, METHODID_HALF_BIDI_CALL))) |
| 452 | .build(); |
| 453 | } |
| 454 | } |