aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-08-13 14:27:00 -0700
committerGravatar Vijay Pai <vpai@google.com>2015-08-13 14:27:00 -0700
commited48bf8f71efce4a9037a74ae9ab2c83a3e9b4a7 (patch)
tree0c7147e7ae84071f87fc7501430f4563d35af3f0 /test/cpp
parentc16d9e4af81856e7e95e0f77775ab5e47dc68c2c (diff)
parentf6befe86904260591cf117e2819ad8e0ea071679 (diff)
Merge pull request #2922 from yang-g/proto3_cpp
use proto3 syntax in c++ test protos
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/interop/interop_client.cc3
-rw-r--r--test/cpp/interop/server.cc4
-rw-r--r--test/cpp/util/echo.proto2
-rw-r--r--test/cpp/util/echo_duplicate.proto2
-rw-r--r--test/cpp/util/messages.proto30
5 files changed, 19 insertions, 22 deletions
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index dfb90fadc2..066877e0c6 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -316,7 +316,6 @@ void InteropClient::DoHalfDuplex() {
unsigned int i = 0;
StreamingOutputCallResponse response;
while (stream->Read(&response)) {
- GPR_ASSERT(response.payload().has_body());
GPR_ASSERT(response.payload().body() ==
grpc::string(response_stream_sizes[i], '\0'));
++i;
@@ -346,7 +345,6 @@ void InteropClient::DoPingPong() {
payload->set_body(grpc::string(request_stream_sizes[i], '\0'));
GPR_ASSERT(stream->Write(request));
GPR_ASSERT(stream->Read(&response));
- GPR_ASSERT(response.payload().has_body());
GPR_ASSERT(response.payload().body() ==
grpc::string(response_stream_sizes[i], '\0'));
}
@@ -393,7 +391,6 @@ void InteropClient::DoCancelAfterFirstResponse() {
StreamingOutputCallResponse response;
GPR_ASSERT(stream->Write(request));
GPR_ASSERT(stream->Read(&response));
- GPR_ASSERT(response.payload().has_body());
GPR_ASSERT(response.payload().body() == grpc::string(31415, '\0'));
gpr_log(GPR_INFO, "Trying to cancel...");
context.TryCancel();
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 05a10de51e..4e809ed902 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -99,7 +99,7 @@ class TestServiceImpl : public TestService::Service {
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) {
- if (request->has_response_size() && request->response_size() > 0) {
+ if (request->response_size() > 0) {
if (!SetPayload(request->response_type(), request->response_size(),
response->mutable_payload())) {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
@@ -140,7 +140,7 @@ class TestServiceImpl : public TestService::Service {
StreamingInputCallRequest request;
int aggregated_payload_size = 0;
while (reader->Read(&request)) {
- if (request.has_payload() && request.payload().has_body()) {
+ if (request.has_payload()) {
aggregated_payload_size += request.payload().body().size();
}
}
diff --git a/test/cpp/util/echo.proto b/test/cpp/util/echo.proto
index 58ec680ecd..6bb09316b4 100644
--- a/test/cpp/util/echo.proto
+++ b/test/cpp/util/echo.proto
@@ -28,7 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-syntax = "proto2";
+syntax = "proto3";
import "test/cpp/util/messages.proto";
diff --git a/test/cpp/util/echo_duplicate.proto b/test/cpp/util/echo_duplicate.proto
index e54c016d2f..9c1d67825a 100644
--- a/test/cpp/util/echo_duplicate.proto
+++ b/test/cpp/util/echo_duplicate.proto
@@ -30,7 +30,7 @@
// This is a partial copy of echo.proto with a different package name.
-syntax = "proto2";
+syntax = "proto3";
import "test/cpp/util/messages.proto";
diff --git a/test/cpp/util/messages.proto b/test/cpp/util/messages.proto
index 24e199b809..359d1db74f 100644
--- a/test/cpp/util/messages.proto
+++ b/test/cpp/util/messages.proto
@@ -28,32 +28,32 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-syntax = "proto2";
+syntax = "proto3";
package grpc.cpp.test.util;
message RequestParams {
- optional bool echo_deadline = 1;
- optional int32 client_cancel_after_us = 2;
- optional int32 server_cancel_after_us = 3;
- optional bool echo_metadata = 4;
- optional bool check_auth_context = 5;
- optional int32 response_message_length = 6;
- optional bool echo_peer = 7;
+ bool echo_deadline = 1;
+ int32 client_cancel_after_us = 2;
+ int32 server_cancel_after_us = 3;
+ bool echo_metadata = 4;
+ bool check_auth_context = 5;
+ int32 response_message_length = 6;
+ bool echo_peer = 7;
}
message EchoRequest {
- optional string message = 1;
- optional RequestParams param = 2;
+ string message = 1;
+ RequestParams param = 2;
}
message ResponseParams {
- optional int64 request_deadline = 1;
- optional string host = 2;
- optional string peer = 3;
+ int64 request_deadline = 1;
+ string host = 2;
+ string peer = 3;
}
message EchoResponse {
- optional string message = 1;
- optional ResponseParams param = 2;
+ string message = 1;
+ ResponseParams param = 2;
}