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 | |
| 18 | @javax.annotation.Generated( |
Lukasz Strzalkowski | 363e0f6 | 2016-04-11 19:34:15 +0200 | [diff] [blame] | 19 | value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)", |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 20 | comments = "Source: test.proto") |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 21 | public class TestServiceGrpc { |
| 22 | |
| 23 | private TestServiceGrpc() {} |
| 24 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 25 | public static final String SERVICE_NAME = "grpc.testing.TestService"; |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 26 | |
| 27 | // Static method descriptors that strictly reflect the proto. |
| 28 | @io.grpc.ExperimentalApi |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 29 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest, |
| 30 | io.grpc.testing.integration.Test.SimpleResponse> METHOD_UNARY_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 31 | io.grpc.MethodDescriptor.create( |
| 32 | io.grpc.MethodDescriptor.MethodType.UNARY, |
| 33 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 34 | "grpc.testing.TestService", "UnaryCall"), |
| 35 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.getDefaultInstance()), |
| 36 | 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] | 37 | @io.grpc.ExperimentalApi |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 38 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 39 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 40 | io.grpc.MethodDescriptor.create( |
| 41 | io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING, |
| 42 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 43 | "grpc.testing.TestService", "StreamingOutputCall"), |
| 44 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 45 | 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] | 46 | @io.grpc.ExperimentalApi |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 47 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, |
| 48 | io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 49 | io.grpc.MethodDescriptor.create( |
| 50 | io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING, |
| 51 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 52 | "grpc.testing.TestService", "StreamingInputCall"), |
| 53 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()), |
| 54 | 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] | 55 | @io.grpc.ExperimentalApi |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 56 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 57 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_BIDI_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 58 | io.grpc.MethodDescriptor.create( |
| 59 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
| 60 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 61 | "grpc.testing.TestService", "FullBidiCall"), |
| 62 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 63 | 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] | 64 | @io.grpc.ExperimentalApi |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 65 | public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 66 | io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_BIDI_CALL = |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 67 | io.grpc.MethodDescriptor.create( |
| 68 | io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING, |
| 69 | generateFullMethodName( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 70 | "grpc.testing.TestService", "HalfBidiCall"), |
| 71 | io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.getDefaultInstance()), |
| 72 | 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] | 73 | |
| 74 | public static TestServiceStub newStub(io.grpc.Channel channel) { |
| 75 | return new TestServiceStub(channel); |
| 76 | } |
| 77 | |
| 78 | public static TestServiceBlockingStub newBlockingStub( |
| 79 | io.grpc.Channel channel) { |
| 80 | return new TestServiceBlockingStub(channel); |
| 81 | } |
| 82 | |
| 83 | public static TestServiceFutureStub newFutureStub( |
| 84 | io.grpc.Channel channel) { |
| 85 | return new TestServiceFutureStub(channel); |
| 86 | } |
| 87 | |
| 88 | public static interface TestService { |
| 89 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 90 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 91 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 92 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 93 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 94 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 95 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 96 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 97 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 98 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 99 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
| 100 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 101 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 102 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
| 103 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 104 | } |
| 105 | |
Eric Anderson | 9bc5d93 | 2016-04-19 09:36:24 -0700 | [diff] [blame] | 106 | @io.grpc.ExperimentalApi |
Lukasz Strzalkowski | 2fbf142 | 2016-04-08 02:28:32 +0200 | [diff] [blame] | 107 | public static abstract class AbstractTestService implements TestService, io.grpc.BindableService { |
| 108 | |
| 109 | @java.lang.Override |
| 110 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 111 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) { |
| 112 | asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver); |
| 113 | } |
| 114 | |
| 115 | @java.lang.Override |
| 116 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 117 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
| 118 | asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver); |
| 119 | } |
| 120 | |
| 121 | @java.lang.Override |
| 122 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 123 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) { |
| 124 | return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver); |
| 125 | } |
| 126 | |
| 127 | @java.lang.Override |
| 128 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
| 129 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
| 130 | return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver); |
| 131 | } |
| 132 | |
| 133 | @java.lang.Override |
| 134 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
| 135 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
| 136 | return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver); |
| 137 | } |
| 138 | |
| 139 | @java.lang.Override public io.grpc.ServerServiceDefinition bindService() { |
| 140 | return TestServiceGrpc.bindService(this); |
| 141 | } |
| 142 | } |
| 143 | |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 144 | public static interface TestServiceBlockingClient { |
| 145 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 146 | 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] | 147 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 148 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 149 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | public static interface TestServiceFutureClient { |
| 153 | |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 154 | public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall( |
| 155 | io.grpc.testing.integration.Test.SimpleRequest request); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> |
| 159 | implements TestService { |
| 160 | private TestServiceStub(io.grpc.Channel channel) { |
| 161 | super(channel); |
| 162 | } |
| 163 | |
| 164 | private TestServiceStub(io.grpc.Channel channel, |
| 165 | io.grpc.CallOptions callOptions) { |
| 166 | super(channel, callOptions); |
| 167 | } |
| 168 | |
| 169 | @java.lang.Override |
| 170 | protected TestServiceStub build(io.grpc.Channel channel, |
| 171 | io.grpc.CallOptions callOptions) { |
| 172 | return new TestServiceStub(channel, callOptions); |
| 173 | } |
| 174 | |
| 175 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 176 | public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request, |
| 177 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 178 | asyncUnaryCall( |
| 179 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request, responseObserver); |
| 180 | } |
| 181 | |
| 182 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 183 | public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request, |
| 184 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 185 | asyncServerStreamingCall( |
| 186 | getChannel().newCall(METHOD_STREAMING_OUTPUT_CALL, getCallOptions()), request, responseObserver); |
| 187 | } |
| 188 | |
| 189 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 190 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall( |
| 191 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 192 | return asyncClientStreamingCall( |
| 193 | getChannel().newCall(METHOD_STREAMING_INPUT_CALL, getCallOptions()), responseObserver); |
| 194 | } |
| 195 | |
| 196 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 197 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall( |
| 198 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 199 | return asyncBidiStreamingCall( |
| 200 | getChannel().newCall(METHOD_FULL_BIDI_CALL, getCallOptions()), responseObserver); |
| 201 | } |
| 202 | |
| 203 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 204 | public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall( |
| 205 | io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 206 | return asyncBidiStreamingCall( |
| 207 | getChannel().newCall(METHOD_HALF_BIDI_CALL, getCallOptions()), responseObserver); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> |
| 212 | implements TestServiceBlockingClient { |
| 213 | private TestServiceBlockingStub(io.grpc.Channel channel) { |
| 214 | super(channel); |
| 215 | } |
| 216 | |
| 217 | private TestServiceBlockingStub(io.grpc.Channel channel, |
| 218 | io.grpc.CallOptions callOptions) { |
| 219 | super(channel, callOptions); |
| 220 | } |
| 221 | |
| 222 | @java.lang.Override |
| 223 | protected TestServiceBlockingStub build(io.grpc.Channel channel, |
| 224 | io.grpc.CallOptions callOptions) { |
| 225 | return new TestServiceBlockingStub(channel, callOptions); |
| 226 | } |
| 227 | |
| 228 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 229 | 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] | 230 | return blockingUnaryCall( |
| 231 | getChannel(), METHOD_UNARY_CALL, getCallOptions(), request); |
| 232 | } |
| 233 | |
| 234 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 235 | public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall( |
| 236 | io.grpc.testing.integration.Test.StreamingOutputCallRequest request) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 237 | return blockingServerStreamingCall( |
| 238 | getChannel(), METHOD_STREAMING_OUTPUT_CALL, getCallOptions(), request); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> |
| 243 | implements TestServiceFutureClient { |
| 244 | private TestServiceFutureStub(io.grpc.Channel channel) { |
| 245 | super(channel); |
| 246 | } |
| 247 | |
| 248 | private TestServiceFutureStub(io.grpc.Channel channel, |
| 249 | io.grpc.CallOptions callOptions) { |
| 250 | super(channel, callOptions); |
| 251 | } |
| 252 | |
| 253 | @java.lang.Override |
| 254 | protected TestServiceFutureStub build(io.grpc.Channel channel, |
| 255 | io.grpc.CallOptions callOptions) { |
| 256 | return new TestServiceFutureStub(channel, callOptions); |
| 257 | } |
| 258 | |
| 259 | @java.lang.Override |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 260 | public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall( |
| 261 | io.grpc.testing.integration.Test.SimpleRequest request) { |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 262 | return futureUnaryCall( |
| 263 | getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | private static final int METHODID_UNARY_CALL = 0; |
| 268 | private static final int METHODID_STREAMING_OUTPUT_CALL = 1; |
| 269 | private static final int METHODID_STREAMING_INPUT_CALL = 2; |
| 270 | private static final int METHODID_FULL_BIDI_CALL = 3; |
| 271 | private static final int METHODID_HALF_BIDI_CALL = 4; |
| 272 | |
| 273 | private static class MethodHandlers<Req, Resp> implements |
| 274 | io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, |
| 275 | io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, |
| 276 | io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, |
| 277 | io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { |
| 278 | private final TestService serviceImpl; |
| 279 | private final int methodId; |
| 280 | |
| 281 | public MethodHandlers(TestService serviceImpl, int methodId) { |
| 282 | this.serviceImpl = serviceImpl; |
| 283 | this.methodId = methodId; |
| 284 | } |
| 285 | |
| 286 | @java.lang.Override |
| 287 | @java.lang.SuppressWarnings("unchecked") |
| 288 | public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 289 | switch (methodId) { |
| 290 | case METHODID_UNARY_CALL: |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 291 | serviceImpl.unaryCall((io.grpc.testing.integration.Test.SimpleRequest) request, |
| 292 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 293 | break; |
| 294 | case METHODID_STREAMING_OUTPUT_CALL: |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 295 | serviceImpl.streamingOutputCall((io.grpc.testing.integration.Test.StreamingOutputCallRequest) request, |
| 296 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 297 | break; |
| 298 | default: |
| 299 | throw new AssertionError(); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | @java.lang.Override |
| 304 | @java.lang.SuppressWarnings("unchecked") |
| 305 | public io.grpc.stub.StreamObserver<Req> invoke( |
| 306 | io.grpc.stub.StreamObserver<Resp> responseObserver) { |
| 307 | switch (methodId) { |
| 308 | case METHODID_STREAMING_INPUT_CALL: |
| 309 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 310 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 311 | case METHODID_FULL_BIDI_CALL: |
| 312 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 313 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 314 | case METHODID_HALF_BIDI_CALL: |
| 315 | return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall( |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 316 | (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver); |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 317 | default: |
| 318 | throw new AssertionError(); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | public static io.grpc.ServerServiceDefinition bindService( |
| 324 | final TestService serviceImpl) { |
| 325 | return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME) |
| 326 | .addMethod( |
| 327 | METHOD_UNARY_CALL, |
| 328 | asyncUnaryCall( |
| 329 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 330 | io.grpc.testing.integration.Test.SimpleRequest, |
| 331 | io.grpc.testing.integration.Test.SimpleResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 332 | serviceImpl, METHODID_UNARY_CALL))) |
| 333 | .addMethod( |
| 334 | METHOD_STREAMING_OUTPUT_CALL, |
| 335 | asyncServerStreamingCall( |
| 336 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 337 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 338 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 339 | serviceImpl, METHODID_STREAMING_OUTPUT_CALL))) |
| 340 | .addMethod( |
| 341 | METHOD_STREAMING_INPUT_CALL, |
| 342 | asyncClientStreamingCall( |
| 343 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 344 | io.grpc.testing.integration.Test.StreamingInputCallRequest, |
| 345 | io.grpc.testing.integration.Test.StreamingInputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 346 | serviceImpl, METHODID_STREAMING_INPUT_CALL))) |
| 347 | .addMethod( |
| 348 | METHOD_FULL_BIDI_CALL, |
| 349 | asyncBidiStreamingCall( |
| 350 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 351 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 352 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 353 | serviceImpl, METHODID_FULL_BIDI_CALL))) |
| 354 | .addMethod( |
| 355 | METHOD_HALF_BIDI_CALL, |
| 356 | asyncBidiStreamingCall( |
| 357 | new MethodHandlers< |
Eric Anderson | b22bcdf | 2016-03-29 14:13:28 -0700 | [diff] [blame] | 358 | io.grpc.testing.integration.Test.StreamingOutputCallRequest, |
| 359 | io.grpc.testing.integration.Test.StreamingOutputCallResponse>( |
Eric Anderson | 99a6d8d | 2016-03-22 11:31:36 -0700 | [diff] [blame] | 360 | serviceImpl, METHODID_HALF_BIDI_CALL))) |
| 361 | .build(); |
| 362 | } |
| 363 | } |