diff --git a/BUILD.bazel b/BUILD.bazel index db8511db..3a040752 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -111,6 +111,22 @@ proto_library( visibility = ["//visibility:public"], ) +proto_library( + name = "test_proto", + srcs = ["grpc/testing/test.proto"], + visibility = ["//visibility:public"], + deps = [ + ":empty_proto", + ":messages_proto", + ], +) + +proto_library( + name = "empty_proto", + srcs = ["grpc/testing/empty.proto"], + visibility = ["//visibility:public"], +) + # Deprecated: do not use proto_library( name = "reflection_proto_deprecated", diff --git a/grpc/testing/empty.proto b/grpc/testing/empty.proto new file mode 100644 index 00000000..bd626abe --- /dev/null +++ b/grpc/testing/empty.proto @@ -0,0 +1,29 @@ +// Copyright 2015 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +syntax = "proto2"; + +package grpc.testing; + +option java_package = "io.grpc.testing.integration"; +option java_outer_classname = "EmptyProtos"; + +// An empty message that you can re-use to avoid defining duplicated empty +// messages in your project. A typical example is to use it as argument or the +// return value of a service API. For instance: +// +// service Foo { +// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; +// }; +// +message Empty {} diff --git a/grpc/testing/messages.proto b/grpc/testing/messages.proto index 7b1b7286..9db2d36f 100644 --- a/grpc/testing/messages.proto +++ b/grpc/testing/messages.proto @@ -19,6 +19,8 @@ syntax = "proto3"; package grpc.testing; +option java_package = "io.grpc.testing.integration"; + // 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"; @@ -27,16 +29,10 @@ message BoolValue { 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. message Payload { - // The type of data in body. - PayloadType type = 1; + reserved 1; + // Primary contents of payload. bytes body = 2; } @@ -50,9 +46,7 @@ message EchoStatus { // Unary request. message SimpleRequest { - // 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; + reserved 1; // Desired payload size in the response from the server. int32 response_size = 2; @@ -90,6 +84,10 @@ message SimpleResponse { string oauth_scope = 3; } +message SimpleContext { + string value = 1; +} + // Client-streaming request. message StreamingInputCallRequest { // Optional input payload sent along with the request. @@ -128,11 +126,7 @@ message ResponseParameters { // Server-streaming request. message StreamingOutputCallRequest { - // 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; + reserved 1; // Configuration for each expected response message. repeated ResponseParameters response_parameters = 2; diff --git a/grpc/testing/test.proto b/grpc/testing/test.proto new file mode 100644 index 00000000..053efa00 --- /dev/null +++ b/grpc/testing/test.proto @@ -0,0 +1,81 @@ +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto3"; + +import "grpc/testing/empty.proto"; +import "grpc/testing/messages.proto"; + +package grpc.testing; + +option java_package = "io.grpc.testing.integration"; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); + + // One request followed by one response. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by one response. Response has cache control + // headers set such that a caching HTTP proxy (such as GFE) can + // satisfy subsequent requests. + rpc CacheableUnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. + rpc StreamingOutputCall(StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. + rpc StreamingInputCall(stream StreamingInputCallRequest) + returns (StreamingInputCallResponse); + + // A sequence of requests with each request served by the server immediately. + // As one request could lead to multiple responses, this interface + // demonstrates the idea of full duplexing. + rpc FullDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by a sequence of responses. + // The server buffers all the client requests and then serves them in order. A + // stream of responses are returned to the client when the server starts with + // first request. + rpc HalfDuplexCall(stream StreamingOutputCallRequest) + returns (stream StreamingOutputCallResponse); + + // The test server will not implement this method. It will be used + // to test the behavior when clients call unimplemented methods. + rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty); +} + +// A simple service NOT implemented at servers so clients can test for +// that case. +service UnimplementedService { + // A call that no server should implement + rpc UnimplementedCall(grpc.testing.Empty) returns (grpc.testing.Empty); +} + +// A service used to control reconnect server. +service ReconnectService { + // Starts ReconnectService + rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty); + + // Stops ReconnectService + rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo); +}