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