From caa67be994eab600dead84ee5a8e5859dd4c5945 Mon Sep 17 00:00:00 2001 From: Mridula <66699525+mpeddada1@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:17:07 +0000 Subject: [PATCH] chore: refactor ITKmsTest to avoid using deprecated method (#9854) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: refactor ITKmsTest to avoid using deprecated method * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- java-kms/README.md | 4 ++-- .../src/test/java/com/google/cloud/kms/it/ITKmsTest.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/java-kms/README.md b/java-kms/README.md index 04b41fb744e1..619acaafd338 100644 --- a/java-kms/README.md +++ b/java-kms/README.md @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.22.0 + 26.23.0 pom import @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-kms.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-kms/2.26.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-kms/2.27.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/it/ITKmsTest.java b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/it/ITKmsTest.java index 96befff120b5..852281ad95e1 100644 --- a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/it/ITKmsTest.java +++ b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/it/ITKmsTest.java @@ -72,7 +72,7 @@ private static KeyRing getKeyRing( GetKeyRingRequest.newBuilder().setName(kmsKeyRingResourcePath).build(); requestParamsHeader.put(requestParamsKey, "name=" + kmsKeyRingResourcePath); KeyManagementServiceGrpc.KeyManagementServiceBlockingStub stubForGetKeyRing = - MetadataUtils.attachHeaders(kmsStub, requestParamsHeader); + kmsStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(requestParamsHeader)); return stubForGetKeyRing.getKeyRing(getKeyRingRequest); } catch (StatusRuntimeException ex) { if (ex.getStatus().getCode() == Status.Code.NOT_FOUND) { @@ -85,7 +85,8 @@ private static KeyRing getKeyRing( .build(); requestParamsHeader.put(requestParamsKey, "parent=" + keyRingParent); KeyManagementServiceGrpc.KeyManagementServiceBlockingStub stubForCreateKeyRing = - MetadataUtils.attachHeaders(kmsStub, requestParamsHeader); + kmsStub.withInterceptors( + MetadataUtils.newAttachHeadersInterceptor(requestParamsHeader)); return stubForCreateKeyRing.createKeyRing(createKeyRingRequest); } else { throw ex;