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( |
Carl Mastrangelo | 3c5b5a5 | 2016-04-29 13:37:20 -0700 | [diff] [blame^] | 24 | value = "by gRPC proto compiler (version 0.15.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. |
| 33 | @io.grpc.ExperimentalApi |
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 | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 42 | @io.grpc.ExperimentalApi |
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 | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 51 | @io.grpc.ExperimentalApi |
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 | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 60 | @io.grpc.ExperimentalApi |
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 | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 69 | @io.grpc.ExperimentalApi |
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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
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 | 9bc5d93 | 2016-04-19 09:36:24 -0700 | [diff] [blame] | 158 | @io.grpc.ExperimentalApi |
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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
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 | */ |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [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 | */ |
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 | |
| 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 | |
| 366 | @java.lang.Override |
| 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: |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 371 | serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request, |
| 372 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 373 | break; |
| 374 | case METHODID_STREAMING_OUTPUT_CALL: |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 375 | serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request, |
| 376 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 377 | break; |
| 378 | default: |
| 379 | throw new AssertionError(); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | @java.lang.Override |
| 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( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 390 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 391 | case METHODID_FULL_BIDI_CALL: |
| 392 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 393 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 394 | case METHODID_HALF_BIDI_CALL: |
| 395 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 396 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 397 | default: |
| 398 | throw new AssertionError(); |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | public static io.grpc.ServerServiceDefinition bindService( |
| 404 | final TestService serviceImpl) { |
| 405 | return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME) |
| 406 | .addMethod( |
| 407 | METHOD_UNARY_CALL, |
| 408 | asyncUnaryCall( |
| 409 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 410 | io.grpc.testing.integration.Test.SimpleRequest, |
| 411 | io.grpc.testing.integration.Test.SimpleResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 412 | serviceImpl, METHODID_UNARY_CALL))) |
| 413 | .addMethod( |
| 414 | METHOD_STREAMING_OUTPUT_CALL, |
| 415 | asyncServerStreamingCall( |
| 416 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 417 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 418 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 419 | serviceImpl, METHODID_STREAMING_OUTPUT_CALL))) |
| 420 | .addMethod( |
| 421 | METHOD_STREAMING_INPUT_CALL, |
| 422 | asyncClientStreamingCall( |
| 423 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 424 | io.grpc.testing.integration.Test.StreamingInputCallRequest, |
| 425 | io.grpc.testing.integration.Test.StreamingInputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 426 | serviceImpl, METHODID_STREAMING_INPUT_CALL))) |
| 427 | .addMethod( |
| 428 | METHOD_FULL_BIDI_CALL, |
| 429 | asyncBidiStreamingCall( |
| 430 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 431 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 432 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 433 | serviceImpl, METHODID_FULL_BIDI_CALL))) |
| 434 | .addMethod( |
| 435 | METHOD_HALF_BIDI_CALL, |
| 436 | asyncBidiStreamingCall( |
| 437 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 438 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 439 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 440 | serviceImpl, METHODID_HALF_BIDI_CALL))) |
| 441 | .build(); |
| 442 | } |
| 443 | } |