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