Skip to content

Commit

Permalink
Update grpc-java to 1.25.0 apple#877
Browse files Browse the repository at this point in the history
Motivation:

Update grpc-java to 1.25.0

Modifications:

added `assertFallbackStatus` method to check new behaviour of `io.grpc.protobuf.StatusProto.fromStatusAndTrailers`

Result:

Fixes apple#877
  • Loading branch information
volyx committed Nov 26, 2019
1 parent 03a7b0a commit 62cab87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -52,7 +52,7 @@ apacheDirectoryServerVersion=1.5.7
commonsLangVersion=2.6

# gRPC
grpcVersion=1.24.2
grpcVersion=1.25.0
protobufGradlePluginVersion=0.8.10
protobufVersion=3.10.0
protoGoogleCommonProtosVersion=1.17.0
Expand Down
Expand Up @@ -556,11 +556,11 @@ private static void assertStatusRuntimeException(final StatusRuntimeException st
final Status grpcStatus = statusException.getStatus();
assertEquals(CUSTOM_ERROR_MESSAGE, grpcStatus.getDescription());
final com.google.rpc.Status status = StatusProto.fromThrowable(statusException);
assertNotNull(status);
if (withStatus) {
assertNotNull(status);
assertStatus(status, grpcStatus.getCode().value(), grpcStatus.getDescription());
} else {
assertNull(status);
assertFallbackStatus(status, grpcStatus.getCode().value(), grpcStatus.getDescription());
}
}

Expand All @@ -575,6 +575,14 @@ private static void assertStatus(final com.google.rpc.Status status,
assertEquals(999, detail.getId());
}

private static void assertFallbackStatus(final com.google.rpc.Status status, final int expectedCode,
@Nullable final String expectedMessage) {
assertEquals(expectedCode, status.getCode());
assertEquals(expectedMessage, status.getMessage());
final List<Any> anyList = status.getDetailsList();
assertEquals(0, anyList.size());
}

private static com.google.rpc.Status newStatus() {
// We just use CompatResponse as part of the status to keep it simple.
return com.google.rpc.Status.newBuilder()
Expand Down

0 comments on commit 62cab87

Please sign in to comment.