4747import io .grpc .Status ;
4848import io .grpc .Status .Code ;
4949import io .grpc .StatusRuntimeException ;
50+ import io .grpc .protobuf .ProtoUtils ;
5051import io .grpc .stub .StreamObserver ;
5152import java .nio .ByteBuffer ;
5253import java .util .Arrays ;
5859
5960public final class ITBlobDescriptorFakeTest {
6061
62+ private static final Metadata .Key <com .google .rpc .Status > GRPC_STATUS_DETAILS_KEY =
63+ Metadata .Key .of (
64+ "grpc-status-details-bin" ,
65+ ProtoUtils .metadataMarshaller (com .google .rpc .Status .getDefaultInstance ()));
66+
6167 /**
6268 *
6369 *
@@ -156,7 +162,7 @@ public void onNext(BidiReadObjectRequest value) {
156162 .build ();
157163
158164 Metadata trailers = new Metadata ();
159- trailers .put (GrpcUtils . GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
165+ trailers .put (GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
160166 StatusRuntimeException statusRuntimeException =
161167 Status .UNAVAILABLE .withDescription ("redirect" ).asRuntimeException (trailers );
162168 respond .onError (statusRuntimeException );
@@ -181,14 +187,7 @@ public void onCompleted() {
181187 };
182188
183189 try (FakeServer fakeServer = FakeServer .of (fake );
184- Storage storage =
185- fakeServer
186- .getGrpcStorageOptions ()
187- .toBuilder ()
188- .setGrpcInterceptorProvider (
189- GrpcPlainRequestLoggingInterceptor .getInterceptorProvider ())
190- .build ()
191- .getService ()) {
190+ Storage storage = fakeServer .getGrpcStorageOptions ().toBuilder ().build ().getService ()) {
192191
193192 BlobId id = BlobId .of ("b" , "o" );
194193 ApiFuture <BlobDescriptor > futureBlobDescriptor = storage .getBlobDescriptor (id );
@@ -270,7 +269,7 @@ public void onNext(BidiReadObjectRequest value) {
270269 .build ();
271270
272271 Metadata trailers = new Metadata ();
273- trailers .put (GrpcUtils . GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
272+ trailers .put (GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
274273 StatusRuntimeException statusRuntimeException =
275274 Status .UNAVAILABLE .withDescription ("redirect" ).asRuntimeException (trailers );
276275 respond .onError (statusRuntimeException );
@@ -344,7 +343,7 @@ public void onNext(BidiReadObjectRequest value) {
344343 .build ();
345344
346345 Metadata trailers = new Metadata ();
347- trailers .put (GrpcUtils . GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
346+ trailers .put (GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
348347 StatusRuntimeException statusRuntimeException =
349348 Status .UNAVAILABLE
350349 .withDescription (String .format ("redirect %03d" , requestCount ))
@@ -366,14 +365,7 @@ public void onCompleted() {
366365 };
367366
368367 try (FakeServer fakeServer = FakeServer .of (fake );
369- Storage storage =
370- fakeServer
371- .getGrpcStorageOptions ()
372- .toBuilder ()
373- .setGrpcInterceptorProvider (
374- GrpcPlainRequestLoggingInterceptor .getInterceptorProvider ())
375- .build ()
376- .getService ()) {
368+ Storage storage = fakeServer .getGrpcStorageOptions ().toBuilder ().build ().getService ()) {
377369
378370 BlobId id = BlobId .of ("b" , "o" );
379371 ApiFuture <BlobDescriptor > futureBlobDescriptor = storage .getBlobDescriptor (id );
@@ -499,7 +491,7 @@ public void onNext(BidiReadObjectRequest value) {
499491 .build ();
500492
501493 Metadata trailers = new Metadata ();
502- trailers .put (GrpcUtils . GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
494+ trailers .put (GRPC_STATUS_DETAILS_KEY , grpcStatusDetails );
503495 StatusRuntimeException statusRuntimeException =
504496 Status .UNAVAILABLE .withDescription ("redirect" ).asRuntimeException (trailers );
505497 respond .onNext (res2 );
@@ -525,14 +517,7 @@ public void onCompleted() {
525517 };
526518
527519 try (FakeServer fakeServer = FakeServer .of (fake );
528- Storage storage =
529- fakeServer
530- .getGrpcStorageOptions ()
531- .toBuilder ()
532- .setGrpcInterceptorProvider (
533- GrpcPlainRequestLoggingInterceptor .getInterceptorProvider ())
534- .build ()
535- .getService ()) {
520+ Storage storage = fakeServer .getGrpcStorageOptions ().toBuilder ().build ().getService ()) {
536521
537522 BlobId id = BlobId .of ("b" , "o" );
538523 ApiFuture <BlobDescriptor > futureBlobDescriptor = storage .getBlobDescriptor (id );
0 commit comments