interop-testing: Support syncing protos from grpc-proto

Two main incompatibilities existed in the copy of protos in grpc-proto:
no SimpleContext and an Empty method argument was replaced with a
message. "Context" is a very old word for "Metadata" back from the days
before the current gRPC protocol. We don't need that message in
particular, and well-known protos actually works in Protobuf Lite these
days, so we can swap to wrappers.proto's StringValue and don't need to
upstream a change to grpc-proto. The argument problem is fixed just by
changing the type in the Java code.

With the incompatibilities fixed, do a sync from grpc-proto and include
interop-testing.
This commit is contained in:
Eric Anderson 2022-05-18 14:28:20 -07:00 committed by GitHub
parent 9cb3c6e688
commit 5bb721e217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 89 additions and 71 deletions

View File

@ -18,27 +18,27 @@ public final class ReconnectServiceGrpc {
public static final String SERVICE_NAME = "grpc.testing.ReconnectService"; public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
// Static method descriptors that strictly reflect the proto. // Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod; io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
@io.grpc.stub.annotations.RpcMethod( @io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Start", fullMethodName = SERVICE_NAME + '/' + "Start",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class, requestType = io.grpc.testing.integration.Messages.ReconnectParams.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class, responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY) methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() { io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod; io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) { if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
synchronized (ReconnectServiceGrpc.class) { synchronized (ReconnectServiceGrpc.class) {
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) { if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
ReconnectServiceGrpc.getStartMethod = getStartMethod = ReconnectServiceGrpc.getStartMethod = getStartMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder() io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.ReconnectParams, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start")) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start"))
.setSampledToLocalTracing(true) .setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller( .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance())) io.grpc.testing.integration.Messages.ReconnectParams.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller( .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance())) io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build(); .build();
@ -131,7 +131,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public void start(io.grpc.testing.integration.EmptyProtos.Empty request, public void start(io.grpc.testing.integration.Messages.ReconnectParams request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) { io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver); io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
} }
@ -149,7 +149,7 @@ public final class ReconnectServiceGrpc {
getStartMethod(), getStartMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall( io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers< new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty>( io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_START))) this, METHODID_START)))
.addMethod( .addMethod(
@ -182,7 +182,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public void start(io.grpc.testing.integration.EmptyProtos.Empty request, public void start(io.grpc.testing.integration.Messages.ReconnectParams request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) { io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall( io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver); getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver);
@ -216,7 +216,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.EmptyProtos.Empty request) { public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.Messages.ReconnectParams request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall( return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getStartMethod(), getCallOptions(), request); getChannel(), getStartMethod(), getCallOptions(), request);
} }
@ -249,7 +249,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start( public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start(
io.grpc.testing.integration.EmptyProtos.Empty request) { io.grpc.testing.integration.Messages.ReconnectParams request) {
return io.grpc.stub.ClientCalls.futureUnaryCall( return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request); getChannel().newCall(getStartMethod(), getCallOptions()), request);
} }
@ -284,7 +284,7 @@ public final class ReconnectServiceGrpc {
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) { switch (methodId) {
case METHODID_START: case METHODID_START:
serviceImpl.start((io.grpc.testing.integration.EmptyProtos.Empty) request, serviceImpl.start((io.grpc.testing.integration.Messages.ReconnectParams) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver); (io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break; break;
case METHODID_STOP: case METHODID_STOP:

View File

@ -18,27 +18,27 @@ public final class ReconnectServiceGrpc {
public static final String SERVICE_NAME = "grpc.testing.ReconnectService"; public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
// Static method descriptors that strictly reflect the proto. // Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod; io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
@io.grpc.stub.annotations.RpcMethod( @io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Start", fullMethodName = SERVICE_NAME + '/' + "Start",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class, requestType = io.grpc.testing.integration.Messages.ReconnectParams.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class, responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY) methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() { io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod; io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) { if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
synchronized (ReconnectServiceGrpc.class) { synchronized (ReconnectServiceGrpc.class) {
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) { if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
ReconnectServiceGrpc.getStartMethod = getStartMethod = ReconnectServiceGrpc.getStartMethod = getStartMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder() io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.ReconnectParams, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start")) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start"))
.setSampledToLocalTracing(true) .setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller( .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance())) io.grpc.testing.integration.Messages.ReconnectParams.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller( .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance())) io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.build(); .build();
@ -131,7 +131,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public void start(io.grpc.testing.integration.EmptyProtos.Empty request, public void start(io.grpc.testing.integration.Messages.ReconnectParams request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) { io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver); io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
} }
@ -149,7 +149,7 @@ public final class ReconnectServiceGrpc {
getStartMethod(), getStartMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall( io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers< new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty>( io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_START))) this, METHODID_START)))
.addMethod( .addMethod(
@ -182,7 +182,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public void start(io.grpc.testing.integration.EmptyProtos.Empty request, public void start(io.grpc.testing.integration.Messages.ReconnectParams request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) { io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall( io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver); getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver);
@ -216,7 +216,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.EmptyProtos.Empty request) { public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.Messages.ReconnectParams request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall( return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getStartMethod(), getCallOptions(), request); getChannel(), getStartMethod(), getCallOptions(), request);
} }
@ -249,7 +249,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start( public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start(
io.grpc.testing.integration.EmptyProtos.Empty request) { io.grpc.testing.integration.Messages.ReconnectParams request) {
return io.grpc.stub.ClientCalls.futureUnaryCall( return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request); getChannel().newCall(getStartMethod(), getCallOptions()), request);
} }
@ -284,7 +284,7 @@ public final class ReconnectServiceGrpc {
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) { switch (methodId) {
case METHODID_START: case METHODID_START:
serviceImpl.start((io.grpc.testing.integration.EmptyProtos.Empty) request, serviceImpl.start((io.grpc.testing.integration.Messages.ReconnectParams) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver); (io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break; break;
case METHODID_STOP: case METHODID_STOP:

View File

@ -8,7 +8,7 @@ curl -Ls https://github.com/grpc/grpc-proto/archive/master.tar.gz | tar xz -C "$
base="$tmpdir/grpc-proto-master" base="$tmpdir/grpc-proto-master"
# Copy protos in 'src/main/proto' from grpc-proto for these projects # Copy protos in 'src/main/proto' from grpc-proto for these projects
for project in alts grpclb services rls; do for project in alts grpclb services rls interop-testing; do
while read -r proto; do while read -r proto; do
[ -f "$base/$proto" ] && cp "$base/$proto" "$project/src/main/proto/$proto" [ -f "$base/$proto" ] && cp "$base/$proto" "$project/src/main/proto/$proto"
echo "$proto" echo "$proto"

View File

@ -18,27 +18,27 @@ public final class ReconnectServiceGrpc {
public static final String SERVICE_NAME = "grpc.testing.ReconnectService"; public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
// Static method descriptors that strictly reflect the proto. // Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod; io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
@io.grpc.stub.annotations.RpcMethod( @io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Start", fullMethodName = SERVICE_NAME + '/' + "Start",
requestType = io.grpc.testing.integration.EmptyProtos.Empty.class, requestType = io.grpc.testing.integration.Messages.ReconnectParams.class,
responseType = io.grpc.testing.integration.EmptyProtos.Empty.class, responseType = io.grpc.testing.integration.EmptyProtos.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY) methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() { io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod() {
io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod; io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams, io.grpc.testing.integration.EmptyProtos.Empty> getStartMethod;
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) { if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
synchronized (ReconnectServiceGrpc.class) { synchronized (ReconnectServiceGrpc.class) {
if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) { if ((getStartMethod = ReconnectServiceGrpc.getStartMethod) == null) {
ReconnectServiceGrpc.getStartMethod = getStartMethod = ReconnectServiceGrpc.getStartMethod = getStartMethod =
io.grpc.MethodDescriptor.<io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder() io.grpc.MethodDescriptor.<io.grpc.testing.integration.Messages.ReconnectParams, io.grpc.testing.integration.EmptyProtos.Empty>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start")) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Start"))
.setSampledToLocalTracing(true) .setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance())) io.grpc.testing.integration.Messages.ReconnectParams.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance())) io.grpc.testing.integration.EmptyProtos.Empty.getDefaultInstance()))
.setSchemaDescriptor(new ReconnectServiceMethodDescriptorSupplier("Start")) .setSchemaDescriptor(new ReconnectServiceMethodDescriptorSupplier("Start"))
@ -133,7 +133,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public void start(io.grpc.testing.integration.EmptyProtos.Empty request, public void start(io.grpc.testing.integration.Messages.ReconnectParams request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) { io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver); io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
} }
@ -151,7 +151,7 @@ public final class ReconnectServiceGrpc {
getStartMethod(), getStartMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall( io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers< new MethodHandlers<
io.grpc.testing.integration.EmptyProtos.Empty, io.grpc.testing.integration.Messages.ReconnectParams,
io.grpc.testing.integration.EmptyProtos.Empty>( io.grpc.testing.integration.EmptyProtos.Empty>(
this, METHODID_START))) this, METHODID_START)))
.addMethod( .addMethod(
@ -184,7 +184,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public void start(io.grpc.testing.integration.EmptyProtos.Empty request, public void start(io.grpc.testing.integration.Messages.ReconnectParams request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) { io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall( io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver); getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver);
@ -218,7 +218,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.EmptyProtos.Empty request) { public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.Messages.ReconnectParams request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall( return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getStartMethod(), getCallOptions(), request); getChannel(), getStartMethod(), getCallOptions(), request);
} }
@ -251,7 +251,7 @@ public final class ReconnectServiceGrpc {
/** /**
*/ */
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start( public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start(
io.grpc.testing.integration.EmptyProtos.Empty request) { io.grpc.testing.integration.Messages.ReconnectParams request) {
return io.grpc.stub.ClientCalls.futureUnaryCall( return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getStartMethod(), getCallOptions()), request); getChannel().newCall(getStartMethod(), getCallOptions()), request);
} }
@ -286,7 +286,7 @@ public final class ReconnectServiceGrpc {
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) { switch (methodId) {
case METHODID_START: case METHODID_START:
serviceImpl.start((io.grpc.testing.integration.EmptyProtos.Empty) request, serviceImpl.start((io.grpc.testing.integration.Messages.ReconnectParams) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver); (io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty>) responseObserver);
break; break;
case METHODID_STOP: case METHODID_STOP:

View File

@ -40,6 +40,7 @@ import com.google.common.io.ByteStreams;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.google.protobuf.MessageLite; import com.google.protobuf.MessageLite;
import com.google.protobuf.StringValue;
import io.grpc.CallOptions; import io.grpc.CallOptions;
import io.grpc.Channel; import io.grpc.Channel;
import io.grpc.ClientCall; import io.grpc.ClientCall;
@ -1058,10 +1059,9 @@ public abstract class AbstractInteropTest {
public void exchangeMetadataUnaryCall() throws Exception { public void exchangeMetadataUnaryCall() throws Exception {
// Capture the metadata exchange // Capture the metadata exchange
Metadata fixedHeaders = new Metadata(); Metadata fixedHeaders = new Metadata();
// Send a context proto (as it's in the default extension registry) // Send a metadata proto
Messages.SimpleContext contextValue = StringValue metadataValue = StringValue.newBuilder().setValue("dog").build();
Messages.SimpleContext.newBuilder().setValue("dog").build(); fixedHeaders.put(Util.METADATA_KEY, metadataValue);
fixedHeaders.put(Util.METADATA_KEY, contextValue);
// .. and expect it to be echoed back in trailers // .. and expect it to be echoed back in trailers
AtomicReference<Metadata> trailersCapture = new AtomicReference<>(); AtomicReference<Metadata> trailersCapture = new AtomicReference<>();
AtomicReference<Metadata> headersCapture = new AtomicReference<>(); AtomicReference<Metadata> headersCapture = new AtomicReference<>();
@ -1072,18 +1072,17 @@ public abstract class AbstractInteropTest {
assertNotNull(stub.emptyCall(EMPTY)); assertNotNull(stub.emptyCall(EMPTY));
// Assert that our side channel object is echoed back in both headers and trailers // Assert that our side channel object is echoed back in both headers and trailers
Assert.assertEquals(contextValue, headersCapture.get().get(Util.METADATA_KEY)); Assert.assertEquals(metadataValue, headersCapture.get().get(Util.METADATA_KEY));
Assert.assertEquals(contextValue, trailersCapture.get().get(Util.METADATA_KEY)); Assert.assertEquals(metadataValue, trailersCapture.get().get(Util.METADATA_KEY));
} }
@Test @Test
public void exchangeMetadataStreamingCall() throws Exception { public void exchangeMetadataStreamingCall() throws Exception {
// Capture the metadata exchange // Capture the metadata exchange
Metadata fixedHeaders = new Metadata(); Metadata fixedHeaders = new Metadata();
// Send a context proto (as it's in the default extension registry) // Send a metadata proto
Messages.SimpleContext contextValue = StringValue metadataValue = StringValue.newBuilder().setValue("dog").build();
Messages.SimpleContext.newBuilder().setValue("dog").build(); fixedHeaders.put(Util.METADATA_KEY, metadataValue);
fixedHeaders.put(Util.METADATA_KEY, contextValue);
// .. and expect it to be echoed back in trailers // .. and expect it to be echoed back in trailers
AtomicReference<Metadata> trailersCapture = new AtomicReference<>(); AtomicReference<Metadata> trailersCapture = new AtomicReference<>();
AtomicReference<Metadata> headersCapture = new AtomicReference<>(); AtomicReference<Metadata> headersCapture = new AtomicReference<>();
@ -1114,8 +1113,8 @@ public abstract class AbstractInteropTest {
org.junit.Assert.assertEquals(responseSizes.size() * numRequests, recorder.getValues().size()); org.junit.Assert.assertEquals(responseSizes.size() * numRequests, recorder.getValues().size());
// Assert that our side channel object is echoed back in both headers and trailers // Assert that our side channel object is echoed back in both headers and trailers
Assert.assertEquals(contextValue, headersCapture.get().get(Util.METADATA_KEY)); Assert.assertEquals(metadataValue, headersCapture.get().get(Util.METADATA_KEY));
Assert.assertEquals(contextValue, trailersCapture.get().get(Util.METADATA_KEY)); Assert.assertEquals(metadataValue, trailersCapture.get().get(Util.METADATA_KEY));
} }
@Test @Test

View File

@ -25,6 +25,7 @@ import io.grpc.netty.NettyChannelBuilder;
import io.grpc.okhttp.OkHttpChannelBuilder; import io.grpc.okhttp.OkHttpChannelBuilder;
import io.grpc.testing.integration.EmptyProtos.Empty; import io.grpc.testing.integration.EmptyProtos.Empty;
import io.grpc.testing.integration.Messages.ReconnectInfo; import io.grpc.testing.integration.Messages.ReconnectInfo;
import io.grpc.testing.integration.Messages.ReconnectParams;
/** /**
* Verifies the client is reconnecting the server with correct backoffs * Verifies the client is reconnecting the server with correct backoffs
@ -79,12 +80,12 @@ public class ReconnectTestClient {
.negotiationType(NegotiationType.TLS).build(); .negotiationType(NegotiationType.TLS).build();
} }
retryStub = ReconnectServiceGrpc.newBlockingStub(retryChannel); retryStub = ReconnectServiceGrpc.newBlockingStub(retryChannel);
controlStub.start(Empty.getDefaultInstance()); controlStub.start(ReconnectParams.getDefaultInstance());
long startTimeStamp = System.currentTimeMillis(); long startTimeStamp = System.currentTimeMillis();
while ((System.currentTimeMillis() - startTimeStamp) < TEST_TIME_MS) { while ((System.currentTimeMillis() - startTimeStamp) < TEST_TIME_MS) {
try { try {
retryStub.start(Empty.getDefaultInstance()); retryStub.start(ReconnectParams.getDefaultInstance());
} catch (StatusRuntimeException expected) { } catch (StatusRuntimeException expected) {
// Make CheckStyle happy. // Make CheckStyle happy.
} }

View File

@ -17,6 +17,7 @@
package io.grpc.testing.integration; package io.grpc.testing.integration;
import com.google.protobuf.MessageLite; import com.google.protobuf.MessageLite;
import com.google.protobuf.StringValue;
import io.grpc.Metadata; import io.grpc.Metadata;
import io.grpc.protobuf.lite.ProtoLiteUtils; import io.grpc.protobuf.lite.ProtoLiteUtils;
import java.util.List; import java.util.List;
@ -27,10 +28,10 @@ import org.junit.Assert;
*/ */
public class Util { public class Util {
public static final Metadata.Key<Messages.SimpleContext> METADATA_KEY = public static final Metadata.Key<StringValue> METADATA_KEY =
Metadata.Key.of( Metadata.Key.of(
"grpc.testing.SimpleContext" + Metadata.BINARY_HEADER_SUFFIX, "google.protobuf.StringValue" + Metadata.BINARY_HEADER_SUFFIX,
ProtoLiteUtils.metadataMarshaller(Messages.SimpleContext.getDefaultInstance())); ProtoLiteUtils.metadataMarshaller(StringValue.getDefaultInstance()));
public static final Metadata.Key<String> ECHO_INITIAL_METADATA_KEY public static final Metadata.Key<String> ECHO_INITIAL_METADATA_KEY
= Metadata.Key.of("x-grpc-test-echo-initial", Metadata.ASCII_STRING_MARSHALLER); = Metadata.Key.of("x-grpc-test-echo-initial", Metadata.ASCII_STRING_MARSHALLER);
public static final Metadata.Key<byte[]> ECHO_TRAILING_METADATA_KEY public static final Metadata.Key<byte[]> ECHO_TRAILING_METADATA_KEY

View File

@ -1,4 +1,5 @@
// Copyright 2015 The gRPC Authors
// Copyright 2015 gRPC authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,7 +12,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
syntax = "proto2";
syntax = "proto3";
package grpc.testing; package grpc.testing;

View File

@ -1,4 +1,5 @@
// Copyright 2015 The gRPC Authors
// Copyright 2015-2016 gRPC authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -20,16 +21,24 @@ package grpc.testing;
option java_package = "io.grpc.testing.integration"; option java_package = "io.grpc.testing.integration";
// TODO(jihuncho): Use well-known types once all languages are synced. // TODO(dgq): Go back to using well-known types once
// https://github.com/grpc/grpc/issues/6980 has been fixed.
// import "google/protobuf/wrappers.proto";
message BoolValue { message BoolValue {
// The bool value. // The bool value.
bool value = 1; bool value = 1;
} }
// The type of payload that should be returned.
enum PayloadType {
// Compressable text format.
COMPRESSABLE = 0;
}
// A block of data, to simply increase gRPC message size. // A block of data, to simply increase gRPC message size.
message Payload { message Payload {
reserved 1; // The type of data in body.
PayloadType type = 1;
// Primary contents of payload. // Primary contents of payload.
bytes body = 2; bytes body = 2;
} }
@ -58,7 +67,9 @@ enum GrpclbRouteType {
// Unary request. // Unary request.
message SimpleRequest { message SimpleRequest {
reserved 1; // Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
PayloadType response_type = 1;
// Desired payload size in the response from the server. // Desired payload size in the response from the server.
int32 response_size = 2; int32 response_size = 2;
@ -106,14 +117,11 @@ message SimpleResponse {
string server_id = 4; string server_id = 4;
// gRPCLB Path. // gRPCLB Path.
GrpclbRouteType grpclb_route_type = 5; GrpclbRouteType grpclb_route_type = 5;
// Server hostname. // Server hostname.
string hostname = 6; string hostname = 6;
} }
message SimpleContext {
string value = 1;
}
// Client-streaming request. // Client-streaming request.
message StreamingInputCallRequest { message StreamingInputCallRequest {
// Optional input payload sent along with the request. // Optional input payload sent along with the request.
@ -152,7 +160,11 @@ message ResponseParameters {
// Server-streaming request. // Server-streaming request.
message StreamingOutputCallRequest { message StreamingOutputCallRequest {
reserved 1; // Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
PayloadType response_type = 1;
// Configuration for each expected response message. // Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2; repeated ResponseParameters response_parameters = 2;

View File

@ -1,4 +1,5 @@
// Copyright 2015 The gRPC Authors
// Copyright 2015-2016 gRPC authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -11,8 +12,10 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// An integration test service that covers all the method signature permutations // An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses. // of unary/streaming requests/responses.
syntax = "proto3"; syntax = "proto3";
import "grpc/testing/empty.proto"; import "grpc/testing/empty.proto";
@ -73,7 +76,7 @@ service UnimplementedService {
// A service used to control reconnect server. // A service used to control reconnect server.
service ReconnectService { service ReconnectService {
rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty); rpc Start(grpc.testing.ReconnectParams) returns (grpc.testing.Empty);
rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo); rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
} }

View File

@ -35,7 +35,7 @@ option java_outer_classname = "ChannelzProto";
// Channel is a logical grouping of channels, subchannels, and sockets. // Channel is a logical grouping of channels, subchannels, and sockets.
message Channel { message Channel {
// The identifier for this channel. This should bet set. // The identifier for this channel. This should be set.
ChannelRef ref = 1; ChannelRef ref = 1;
// Data specific to this channel. // Data specific to this channel.
ChannelData data = 2; ChannelData data = 2;