forked from grpc/grpc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interop-testing: add echo-server for proxyless gRPC testing in Istio (g…
- Loading branch information
1 parent
4227324
commit 0b85d5c
Showing
4 changed files
with
997 additions
and
0 deletions.
There are no files selected for viewing
350 changes: 350 additions & 0 deletions
350
interop-testing/src/generated/main/grpc/io/grpc/testing/istio/EchoTestServiceGrpc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,350 @@ | ||
package io.grpc.testing.istio; | ||
|
||
import static io.grpc.MethodDescriptor.generateFullMethodName; | ||
|
||
/** | ||
*/ | ||
@javax.annotation.Generated( | ||
value = "by gRPC proto compiler", | ||
comments = "Source: istio/testing/echo.proto") | ||
@io.grpc.stub.annotations.GrpcGenerated | ||
public final class EchoTestServiceGrpc { | ||
|
||
private EchoTestServiceGrpc() {} | ||
|
||
public static final String SERVICE_NAME = "istio.testing.EchoTestService"; | ||
|
||
// Static method descriptors that strictly reflect the proto. | ||
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.istio.Istio.EchoRequest, | ||
io.grpc.testing.istio.Istio.EchoResponse> getEchoMethod; | ||
|
||
@io.grpc.stub.annotations.RpcMethod( | ||
fullMethodName = SERVICE_NAME + '/' + "Echo", | ||
requestType = io.grpc.testing.istio.Istio.EchoRequest.class, | ||
responseType = io.grpc.testing.istio.Istio.EchoResponse.class, | ||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY) | ||
public static io.grpc.MethodDescriptor<io.grpc.testing.istio.Istio.EchoRequest, | ||
io.grpc.testing.istio.Istio.EchoResponse> getEchoMethod() { | ||
io.grpc.MethodDescriptor<io.grpc.testing.istio.Istio.EchoRequest, io.grpc.testing.istio.Istio.EchoResponse> getEchoMethod; | ||
if ((getEchoMethod = EchoTestServiceGrpc.getEchoMethod) == null) { | ||
synchronized (EchoTestServiceGrpc.class) { | ||
if ((getEchoMethod = EchoTestServiceGrpc.getEchoMethod) == null) { | ||
EchoTestServiceGrpc.getEchoMethod = getEchoMethod = | ||
io.grpc.MethodDescriptor.<io.grpc.testing.istio.Istio.EchoRequest, io.grpc.testing.istio.Istio.EchoResponse>newBuilder() | ||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY) | ||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Echo")) | ||
.setSampledToLocalTracing(true) | ||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( | ||
io.grpc.testing.istio.Istio.EchoRequest.getDefaultInstance())) | ||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( | ||
io.grpc.testing.istio.Istio.EchoResponse.getDefaultInstance())) | ||
.setSchemaDescriptor(new EchoTestServiceMethodDescriptorSupplier("Echo")) | ||
.build(); | ||
} | ||
} | ||
} | ||
return getEchoMethod; | ||
} | ||
|
||
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.istio.Istio.ForwardEchoRequest, | ||
io.grpc.testing.istio.Istio.ForwardEchoResponse> getForwardEchoMethod; | ||
|
||
@io.grpc.stub.annotations.RpcMethod( | ||
fullMethodName = SERVICE_NAME + '/' + "ForwardEcho", | ||
requestType = io.grpc.testing.istio.Istio.ForwardEchoRequest.class, | ||
responseType = io.grpc.testing.istio.Istio.ForwardEchoResponse.class, | ||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY) | ||
public static io.grpc.MethodDescriptor<io.grpc.testing.istio.Istio.ForwardEchoRequest, | ||
io.grpc.testing.istio.Istio.ForwardEchoResponse> getForwardEchoMethod() { | ||
io.grpc.MethodDescriptor<io.grpc.testing.istio.Istio.ForwardEchoRequest, io.grpc.testing.istio.Istio.ForwardEchoResponse> getForwardEchoMethod; | ||
if ((getForwardEchoMethod = EchoTestServiceGrpc.getForwardEchoMethod) == null) { | ||
synchronized (EchoTestServiceGrpc.class) { | ||
if ((getForwardEchoMethod = EchoTestServiceGrpc.getForwardEchoMethod) == null) { | ||
EchoTestServiceGrpc.getForwardEchoMethod = getForwardEchoMethod = | ||
io.grpc.MethodDescriptor.<io.grpc.testing.istio.Istio.ForwardEchoRequest, io.grpc.testing.istio.Istio.ForwardEchoResponse>newBuilder() | ||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY) | ||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ForwardEcho")) | ||
.setSampledToLocalTracing(true) | ||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( | ||
io.grpc.testing.istio.Istio.ForwardEchoRequest.getDefaultInstance())) | ||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( | ||
io.grpc.testing.istio.Istio.ForwardEchoResponse.getDefaultInstance())) | ||
.setSchemaDescriptor(new EchoTestServiceMethodDescriptorSupplier("ForwardEcho")) | ||
.build(); | ||
} | ||
} | ||
} | ||
return getForwardEchoMethod; | ||
} | ||
|
||
/** | ||
* Creates a new async stub that supports all call types for the service | ||
*/ | ||
public static EchoTestServiceStub newStub(io.grpc.Channel channel) { | ||
io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceStub> factory = | ||
new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceStub>() { | ||
@java.lang.Override | ||
public EchoTestServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
return new EchoTestServiceStub(channel, callOptions); | ||
} | ||
}; | ||
return EchoTestServiceStub.newStub(factory, channel); | ||
} | ||
|
||
/** | ||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service | ||
*/ | ||
public static EchoTestServiceBlockingStub newBlockingStub( | ||
io.grpc.Channel channel) { | ||
io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceBlockingStub> factory = | ||
new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceBlockingStub>() { | ||
@java.lang.Override | ||
public EchoTestServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
return new EchoTestServiceBlockingStub(channel, callOptions); | ||
} | ||
}; | ||
return EchoTestServiceBlockingStub.newStub(factory, channel); | ||
} | ||
|
||
/** | ||
* Creates a new ListenableFuture-style stub that supports unary calls on the service | ||
*/ | ||
public static EchoTestServiceFutureStub newFutureStub( | ||
io.grpc.Channel channel) { | ||
io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceFutureStub> factory = | ||
new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceFutureStub>() { | ||
@java.lang.Override | ||
public EchoTestServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
return new EchoTestServiceFutureStub(channel, callOptions); | ||
} | ||
}; | ||
return EchoTestServiceFutureStub.newStub(factory, channel); | ||
} | ||
|
||
/** | ||
*/ | ||
public static abstract class EchoTestServiceImplBase implements io.grpc.BindableService { | ||
|
||
/** | ||
*/ | ||
public void echo(io.grpc.testing.istio.Istio.EchoRequest request, | ||
io.grpc.stub.StreamObserver<io.grpc.testing.istio.Istio.EchoResponse> responseObserver) { | ||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getEchoMethod(), responseObserver); | ||
} | ||
|
||
/** | ||
*/ | ||
public void forwardEcho(io.grpc.testing.istio.Istio.ForwardEchoRequest request, | ||
io.grpc.stub.StreamObserver<io.grpc.testing.istio.Istio.ForwardEchoResponse> responseObserver) { | ||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getForwardEchoMethod(), responseObserver); | ||
} | ||
|
||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { | ||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) | ||
.addMethod( | ||
getEchoMethod(), | ||
io.grpc.stub.ServerCalls.asyncUnaryCall( | ||
new MethodHandlers< | ||
io.grpc.testing.istio.Istio.EchoRequest, | ||
io.grpc.testing.istio.Istio.EchoResponse>( | ||
this, METHODID_ECHO))) | ||
.addMethod( | ||
getForwardEchoMethod(), | ||
io.grpc.stub.ServerCalls.asyncUnaryCall( | ||
new MethodHandlers< | ||
io.grpc.testing.istio.Istio.ForwardEchoRequest, | ||
io.grpc.testing.istio.Istio.ForwardEchoResponse>( | ||
this, METHODID_FORWARD_ECHO))) | ||
.build(); | ||
} | ||
} | ||
|
||
/** | ||
*/ | ||
public static final class EchoTestServiceStub extends io.grpc.stub.AbstractAsyncStub<EchoTestServiceStub> { | ||
private EchoTestServiceStub( | ||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
super(channel, callOptions); | ||
} | ||
|
||
@java.lang.Override | ||
protected EchoTestServiceStub build( | ||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
return new EchoTestServiceStub(channel, callOptions); | ||
} | ||
|
||
/** | ||
*/ | ||
public void echo(io.grpc.testing.istio.Istio.EchoRequest request, | ||
io.grpc.stub.StreamObserver<io.grpc.testing.istio.Istio.EchoResponse> responseObserver) { | ||
io.grpc.stub.ClientCalls.asyncUnaryCall( | ||
getChannel().newCall(getEchoMethod(), getCallOptions()), request, responseObserver); | ||
} | ||
|
||
/** | ||
*/ | ||
public void forwardEcho(io.grpc.testing.istio.Istio.ForwardEchoRequest request, | ||
io.grpc.stub.StreamObserver<io.grpc.testing.istio.Istio.ForwardEchoResponse> responseObserver) { | ||
io.grpc.stub.ClientCalls.asyncUnaryCall( | ||
getChannel().newCall(getForwardEchoMethod(), getCallOptions()), request, responseObserver); | ||
} | ||
} | ||
|
||
/** | ||
*/ | ||
public static final class EchoTestServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<EchoTestServiceBlockingStub> { | ||
private EchoTestServiceBlockingStub( | ||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
super(channel, callOptions); | ||
} | ||
|
||
@java.lang.Override | ||
protected EchoTestServiceBlockingStub build( | ||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
return new EchoTestServiceBlockingStub(channel, callOptions); | ||
} | ||
|
||
/** | ||
*/ | ||
public io.grpc.testing.istio.Istio.EchoResponse echo(io.grpc.testing.istio.Istio.EchoRequest request) { | ||
return io.grpc.stub.ClientCalls.blockingUnaryCall( | ||
getChannel(), getEchoMethod(), getCallOptions(), request); | ||
} | ||
|
||
/** | ||
*/ | ||
public io.grpc.testing.istio.Istio.ForwardEchoResponse forwardEcho(io.grpc.testing.istio.Istio.ForwardEchoRequest request) { | ||
return io.grpc.stub.ClientCalls.blockingUnaryCall( | ||
getChannel(), getForwardEchoMethod(), getCallOptions(), request); | ||
} | ||
} | ||
|
||
/** | ||
*/ | ||
public static final class EchoTestServiceFutureStub extends io.grpc.stub.AbstractFutureStub<EchoTestServiceFutureStub> { | ||
private EchoTestServiceFutureStub( | ||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
super(channel, callOptions); | ||
} | ||
|
||
@java.lang.Override | ||
protected EchoTestServiceFutureStub build( | ||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) { | ||
return new EchoTestServiceFutureStub(channel, callOptions); | ||
} | ||
|
||
/** | ||
*/ | ||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.istio.Istio.EchoResponse> echo( | ||
io.grpc.testing.istio.Istio.EchoRequest request) { | ||
return io.grpc.stub.ClientCalls.futureUnaryCall( | ||
getChannel().newCall(getEchoMethod(), getCallOptions()), request); | ||
} | ||
|
||
/** | ||
*/ | ||
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.istio.Istio.ForwardEchoResponse> forwardEcho( | ||
io.grpc.testing.istio.Istio.ForwardEchoRequest request) { | ||
return io.grpc.stub.ClientCalls.futureUnaryCall( | ||
getChannel().newCall(getForwardEchoMethod(), getCallOptions()), request); | ||
} | ||
} | ||
|
||
private static final int METHODID_ECHO = 0; | ||
private static final int METHODID_FORWARD_ECHO = 1; | ||
|
||
private static final class MethodHandlers<Req, Resp> implements | ||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, | ||
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, | ||
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, | ||
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { | ||
private final EchoTestServiceImplBase serviceImpl; | ||
private final int methodId; | ||
|
||
MethodHandlers(EchoTestServiceImplBase serviceImpl, int methodId) { | ||
this.serviceImpl = serviceImpl; | ||
this.methodId = methodId; | ||
} | ||
|
||
@java.lang.Override | ||
@java.lang.SuppressWarnings("unchecked") | ||
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { | ||
switch (methodId) { | ||
case METHODID_ECHO: | ||
serviceImpl.echo((io.grpc.testing.istio.Istio.EchoRequest) request, | ||
(io.grpc.stub.StreamObserver<io.grpc.testing.istio.Istio.EchoResponse>) responseObserver); | ||
break; | ||
case METHODID_FORWARD_ECHO: | ||
serviceImpl.forwardEcho((io.grpc.testing.istio.Istio.ForwardEchoRequest) request, | ||
(io.grpc.stub.StreamObserver<io.grpc.testing.istio.Istio.ForwardEchoResponse>) responseObserver); | ||
break; | ||
default: | ||
throw new AssertionError(); | ||
} | ||
} | ||
|
||
@java.lang.Override | ||
@java.lang.SuppressWarnings("unchecked") | ||
public io.grpc.stub.StreamObserver<Req> invoke( | ||
io.grpc.stub.StreamObserver<Resp> responseObserver) { | ||
switch (methodId) { | ||
default: | ||
throw new AssertionError(); | ||
} | ||
} | ||
} | ||
|
||
private static abstract class EchoTestServiceBaseDescriptorSupplier | ||
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { | ||
EchoTestServiceBaseDescriptorSupplier() {} | ||
|
||
@java.lang.Override | ||
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { | ||
return io.grpc.testing.istio.Istio.getDescriptor(); | ||
} | ||
|
||
@java.lang.Override | ||
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { | ||
return getFileDescriptor().findServiceByName("EchoTestService"); | ||
} | ||
} | ||
|
||
private static final class EchoTestServiceFileDescriptorSupplier | ||
extends EchoTestServiceBaseDescriptorSupplier { | ||
EchoTestServiceFileDescriptorSupplier() {} | ||
} | ||
|
||
private static final class EchoTestServiceMethodDescriptorSupplier | ||
extends EchoTestServiceBaseDescriptorSupplier | ||
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { | ||
private final String methodName; | ||
|
||
EchoTestServiceMethodDescriptorSupplier(String methodName) { | ||
this.methodName = methodName; | ||
} | ||
|
||
@java.lang.Override | ||
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { | ||
return getServiceDescriptor().findMethodByName(methodName); | ||
} | ||
} | ||
|
||
private static volatile io.grpc.ServiceDescriptor serviceDescriptor; | ||
|
||
public static io.grpc.ServiceDescriptor getServiceDescriptor() { | ||
io.grpc.ServiceDescriptor result = serviceDescriptor; | ||
if (result == null) { | ||
synchronized (EchoTestServiceGrpc.class) { | ||
result = serviceDescriptor; | ||
if (result == null) { | ||
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) | ||
.setSchemaDescriptor(new EchoTestServiceFileDescriptorSupplier()) | ||
.addMethod(getEchoMethod()) | ||
.addMethod(getForwardEchoMethod()) | ||
.build(); | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
} |
Oops, something went wrong.