From ae003cdf8f4c2c23c28f1c4b4e23d6f20af98d71 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 13 Apr 2023 16:48:40 +0100 Subject: [PATCH 01/16] chore(deps): update dependency com.google.cloud:google-cloud-storage to v2.22.0 (#1981) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:google-cloud-storage to v2.22.0 * 🦉 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 --- README.md | 8 ++++---- samples/install-without-bom/pom.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd132b1e34..7b06437a9d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-storage - 2.21.0 + 2.22.0 ``` @@ -57,13 +57,13 @@ implementation 'com.google.cloud:google-cloud-storage' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-storage:2.21.0' +implementation 'com.google.cloud:google-cloud-storage:2.22.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.21.0" +libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.22.0" ``` @@ -426,7 +426,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/java-storage/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-storage.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.21.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.22.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/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index b37019de90..b1a76f48d4 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -30,7 +30,7 @@ com.google.cloud google-cloud-storage - 2.21.0 + 2.22.0 From 8012c737cb187788e4381d98840f00d492f926bc Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 13 Apr 2023 16:26:12 +0000 Subject: [PATCH 02/16] chore(main): release 2.22.1-SNAPSHOT (#1980) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- gapic-google-cloud-storage-v2/pom.xml | 4 ++-- google-cloud-storage-bom/pom.xml | 10 +++++----- google-cloud-storage/pom.xml | 4 ++-- grpc-google-cloud-storage-v2/pom.xml | 4 ++-- pom.xml | 10 +++++----- proto-google-cloud-storage-v2/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 8 ++++---- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/gapic-google-cloud-storage-v2/pom.xml b/gapic-google-cloud-storage-v2/pom.xml index 68758bfffb..01e4796fbf 100644 --- a/gapic-google-cloud-storage-v2/pom.xml +++ b/gapic-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc gapic-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT gapic-google-cloud-storage-v2 GRPC library for gapic-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.22.0 + 2.22.1-SNAPSHOT diff --git a/google-cloud-storage-bom/pom.xml b/google-cloud-storage-bom/pom.xml index 0ca1a03372..996455e011 100644 --- a/google-cloud-storage-bom/pom.xml +++ b/google-cloud-storage-bom/pom.xml @@ -19,7 +19,7 @@ 4.0.0 com.google.cloud google-cloud-storage-bom - 2.22.0 + 2.22.1-SNAPSHOT pom com.google.cloud @@ -69,22 +69,22 @@ com.google.cloud google-cloud-storage - 2.22.0 + 2.22.1-SNAPSHOT com.google.api.grpc gapic-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT com.google.api.grpc grpc-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT com.google.api.grpc proto-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index 7e2fdd66fb..d049fb1b5e 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-storage - 2.22.0 + 2.22.1-SNAPSHOT jar Google Cloud Storage https://github.com/googleapis/java-storage @@ -12,7 +12,7 @@ com.google.cloud google-cloud-storage-parent - 2.22.0 + 2.22.1-SNAPSHOT google-cloud-storage diff --git a/grpc-google-cloud-storage-v2/pom.xml b/grpc-google-cloud-storage-v2/pom.xml index 3f18fa3278..7bba8b3295 100644 --- a/grpc-google-cloud-storage-v2/pom.xml +++ b/grpc-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT grpc-google-cloud-storage-v2 GRPC library for grpc-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.22.0 + 2.22.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index 4ec52b8fef..19ad7af330 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-storage-parent pom - 2.22.0 + 2.22.1-SNAPSHOT Storage Parent https://github.com/googleapis/java-storage @@ -70,7 +70,7 @@ com.google.cloud google-cloud-storage - 2.22.0 + 2.22.1-SNAPSHOT com.google.apis @@ -111,17 +111,17 @@ com.google.api.grpc proto-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT com.google.api.grpc grpc-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT com.google.api.grpc gapic-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT com.google.cloud diff --git a/proto-google-cloud-storage-v2/pom.xml b/proto-google-cloud-storage-v2/pom.xml index 7c510f5ded..01d97d0e7c 100644 --- a/proto-google-cloud-storage-v2/pom.xml +++ b/proto-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-storage-v2 - 2.22.0-alpha + 2.22.1-alpha-SNAPSHOT proto-google-cloud-storage-v2 PROTO library for proto-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.22.0 + 2.22.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 35e856d0f6..3b7c2abe7b 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-storage - 2.22.0 + 2.22.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index d4afd57ced..2baae6a35f 100644 --- a/versions.txt +++ b/versions.txt @@ -1,7 +1,7 @@ # Format: # module:released-version:current-version -google-cloud-storage:2.22.0:2.22.0 -gapic-google-cloud-storage-v2:2.22.0-alpha:2.22.0-alpha -grpc-google-cloud-storage-v2:2.22.0-alpha:2.22.0-alpha -proto-google-cloud-storage-v2:2.22.0-alpha:2.22.0-alpha +google-cloud-storage:2.22.0:2.22.1-SNAPSHOT +gapic-google-cloud-storage-v2:2.22.0-alpha:2.22.1-alpha-SNAPSHOT +grpc-google-cloud-storage-v2:2.22.0-alpha:2.22.1-alpha-SNAPSHOT +proto-google-cloud-storage-v2:2.22.0-alpha:2.22.1-alpha-SNAPSHOT From 03c6f7718d2ac729ea90a425eaaa4bc2e37868fb Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Thu, 13 Apr 2023 15:27:51 -0400 Subject: [PATCH 03/16] chore: README.md to be updated by Release Please (#1963) * chore: README.md to be updated by Release Please * extraFiles as the yaml parameter --- .github/release-please.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/release-please.yml b/.github/release-please.yml index 57c7d5135d..d71d8f4eae 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,6 +1,7 @@ bumpMinorPreMajor: true handleGHRelease: true releaseType: java-yoshi +extraFiles: ["README.md"] branches: - bumpMinorPreMajor: true handleGHRelease: true From 9bafe145e556d2822cdcd2d4602155c22a5b1e72 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Thu, 13 Apr 2023 15:28:18 -0400 Subject: [PATCH 04/16] chore: README.md to be updated by Release Please (#1963) * chore: README.md to be updated by Release Please * extraFiles as the yaml parameter From 73076aacde289a0a611a75d870b2cb8b5ba7aa77 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 13 Apr 2023 23:50:28 +0100 Subject: [PATCH 05/16] test(deps): update cross product test dependencies (#1982) --- google-cloud-storage/pom.xml | 2 +- pom.xml | 2 +- samples/install-without-bom/pom.xml | 2 +- samples/native-image-sample/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index d049fb1b5e..030097f390 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -16,7 +16,7 @@ google-cloud-storage - 1.105.8 + 1.105.9 5.9.2 diff --git a/pom.xml b/pom.xml index 19ad7af330..81e2c39e4c 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,7 @@ com.google.cloud google-cloud-pubsub - 1.123.8 + 1.123.9 test diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index b1a76f48d4..8a2347e6db 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-pubsub - 1.123.8 + 1.123.9 test diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 1767e003e2..5d91a18234 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-pubsub - 1.123.8 + 1.123.9 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 3b7c2abe7b..cef22d5280 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -52,7 +52,7 @@ com.google.cloud google-cloud-pubsub - 1.123.8 + 1.123.9 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index eedc38348e..047177f3eb 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -72,7 +72,7 @@ com.google.cloud google-cloud-pubsub - 1.123.8 + 1.123.9 test From 96a9294106d941606c74132dd3106be2e9a2b7be Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 14 Apr 2023 21:26:13 +0100 Subject: [PATCH 06/16] test(deps): update cross product test dependencies (#1984) --- google-cloud-storage/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index 030097f390..a9f4989889 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -168,13 +168,13 @@ com.google.api.grpc proto-google-cloud-kms-v1 - 0.108.0 + 0.109.0 test com.google.cloud google-cloud-kms - 2.17.0 + 2.18.0 test From 38d86ad763322d96e4c453037288039fba8f03c1 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 18 Apr 2023 18:07:38 +0200 Subject: [PATCH 07/16] test(deps): update cross product test dependencies (#1985) --- google-cloud-storage/pom.xml | 2 +- pom.xml | 2 +- samples/install-without-bom/pom.xml | 2 +- samples/native-image-sample/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index a9f4989889..7ee580e971 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -16,7 +16,7 @@ google-cloud-storage - 1.105.9 + 1.105.10 5.9.2 diff --git a/pom.xml b/pom.xml index 81e2c39e4c..789a67e6e2 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,7 @@ com.google.cloud google-cloud-pubsub - 1.123.9 + 1.123.10 test diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 8a2347e6db..1c4f294f20 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-pubsub - 1.123.9 + 1.123.10 test diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 5d91a18234..a521e73586 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-pubsub - 1.123.9 + 1.123.10 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index cef22d5280..eff2284581 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -52,7 +52,7 @@ com.google.cloud google-cloud-pubsub - 1.123.9 + 1.123.10 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 047177f3eb..33a8c24ea8 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -72,7 +72,7 @@ com.google.cloud google-cloud-pubsub - 1.123.9 + 1.123.10 test From 5fa27f5c32e6b80b5dad7ca39332e25621d91170 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 18 Apr 2023 18:03:38 -0400 Subject: [PATCH 08/16] chore: update go namespace to match open source (#1986) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update go namespace to match open source PiperOrigin-RevId: 525165420 Source-Link: https://github.com/googleapis/googleapis/commit/c7f62d0da5eb9e5d34f2c08c609338cd0949cfd1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4719324d2acddc21f64c33da24d3ffc0f0dcdf58 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDcxOTMyNGQyYWNkZGMyMWY2NGMzM2RhMjRkM2ZmYzBmMGRjZGY1OCJ9 * 🦉 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/com/google/storage/v2/StorageProto.java | 14 +++++++------- .../src/main/proto/google/storage/v2/storage.proto | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java b/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java index d4fb8f7dff..66b7a005a1 100644 --- a/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java +++ b/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java @@ -869,13 +869,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "s.com/auth/devstorage.full_control,https" + "://www.googleapis.com/auth/devstorage.re" + "ad_only,https://www.googleapis.com/auth/" - + "devstorage.read_writeB\334\001\n\025com.google.sto" - + "rage.v2B\014StorageProtoP\001Z8google.golang.o" - + "rg/genproto/googleapis/storage/v2;storag" - + "e\352Ax\n!cloudkms.googleapis.com/CryptoKey\022" - + "Sprojects/{project}/locations/{location}" - + "/keyRings/{key_ring}/cryptoKeys/{crypto_" - + "key}b\006proto3" + + "devstorage.read_writeB\342\001\n\025com.google.sto" + + "rage.v2B\014StorageProtoP\001Z>cloud.google.co" + + "m/go/storage/internal/apiv2/storagepb;st" + + "oragepb\352Ax\n!cloudkms.googleapis.com/Cryp" + + "toKey\022Sprojects/{project}/locations/{loc" + + "ation}/keyRings/{key_ring}/cryptoKeys/{c" + + "rypto_key}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto b/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto index 9ad3df6d22..f5053eaed6 100644 --- a/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto +++ b/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto @@ -28,7 +28,7 @@ import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/type/date.proto"; -option go_package = "google.golang.org/genproto/googleapis/storage/v2;storage"; +option go_package = "cloud.google.com/go/storage/internal/apiv2/storagepb;storagepb"; option java_multiple_files = true; option java_outer_classname = "StorageProto"; option java_package = "com.google.storage.v2"; From 86fbc4a3474f0fe48287e57345d19e152d0ccad8 Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Tue, 18 Apr 2023 18:57:42 -0400 Subject: [PATCH 09/16] chore: move tests which use FakeServer to be Integration Tests (#1987) GitHub actions seem to sometimes have issues with tcp connection's lingering longer than they should, or having things delayed. Other languages have encountered TCP issues in their actions too. In an effort to try and reduce the likelihood of this causing build flakiness move these test which use FakeServer to be Integration tests where we haven't encountered these kinds of failures. --- ...{GapicReadTimeoutTest.java => ITGapicReadTimeoutTest.java} | 2 +- ...est.java => ITGapicUnbufferedReadableByteChannelTest.java} | 2 +- ...est.java => ITGapicUnbufferedWritableByteChannelTest.java} | 4 ++-- ...adRetryTest.java => ITGrpcStorageImplUploadRetryTest.java} | 4 ++-- ...yteChannelTest.java => ITGzipReadableByteChannelTest.java} | 2 +- .../storage/{UpdateMaskTest.java => ITUpdateMaskTest.java} | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename google-cloud-storage/src/test/java/com/google/cloud/storage/{GapicReadTimeoutTest.java => ITGapicReadTimeoutTest.java} (99%) rename google-cloud-storage/src/test/java/com/google/cloud/storage/{GapicUnbufferedReadableByteChannelTest.java => ITGapicUnbufferedReadableByteChannelTest.java} (99%) rename google-cloud-storage/src/test/java/com/google/cloud/storage/{GapicUnbufferedWritableByteChannelTest.java => ITGapicUnbufferedWritableByteChannelTest.java} (99%) rename google-cloud-storage/src/test/java/com/google/cloud/storage/{GrpcStorageImplUploadRetryTest.java => ITGrpcStorageImplUploadRetryTest.java} (98%) rename google-cloud-storage/src/test/java/com/google/cloud/storage/{GzipReadableByteChannelTest.java => ITGzipReadableByteChannelTest.java} (99%) rename google-cloud-storage/src/test/java/com/google/cloud/storage/{UpdateMaskTest.java => ITUpdateMaskTest.java} (99%) diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/GapicReadTimeoutTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicReadTimeoutTest.java similarity index 99% rename from google-cloud-storage/src/test/java/com/google/cloud/storage/GapicReadTimeoutTest.java rename to google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicReadTimeoutTest.java index b5f064e112..9cef9159c0 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/GapicReadTimeoutTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicReadTimeoutTest.java @@ -56,7 +56,7 @@ *

NOTE:Unfortunately, these tests are slow as they are waiting on wall clock time in * several circumstances. */ -public final class GapicReadTimeoutTest { +public final class ITGapicReadTimeoutTest { private final String objectName = "name"; private final Object expectedResult = diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/GapicUnbufferedReadableByteChannelTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicUnbufferedReadableByteChannelTest.java similarity index 99% rename from google-cloud-storage/src/test/java/com/google/cloud/storage/GapicUnbufferedReadableByteChannelTest.java rename to google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicUnbufferedReadableByteChannelTest.java index f399986214..ba9a972cc2 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/GapicUnbufferedReadableByteChannelTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicUnbufferedReadableByteChannelTest.java @@ -47,7 +47,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; -public final class GapicUnbufferedReadableByteChannelTest { +public final class ITGapicUnbufferedReadableByteChannelTest { private final byte[] bytes = DataGenerator.base64Characters().genBytes(40); private final ByteString data1 = ByteString.copyFrom(bytes, 0, 10); private final ByteString data2 = ByteString.copyFrom(bytes, 10, 10); diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/GapicUnbufferedWritableByteChannelTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicUnbufferedWritableByteChannelTest.java similarity index 99% rename from google-cloud-storage/src/test/java/com/google/cloud/storage/GapicUnbufferedWritableByteChannelTest.java rename to google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicUnbufferedWritableByteChannelTest.java index 30eb4ea0e3..6ee17f1172 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/GapicUnbufferedWritableByteChannelTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGapicUnbufferedWritableByteChannelTest.java @@ -54,9 +54,9 @@ import java.util.stream.Collectors; import org.junit.Test; -public final class GapicUnbufferedWritableByteChannelTest { +public final class ITGapicUnbufferedWritableByteChannelTest { private static final Logger LOGGER = - Logger.getLogger(GapicUnbufferedWritableByteChannelTest.class.getName()); + Logger.getLogger(ITGapicUnbufferedWritableByteChannelTest.class.getName()); private static final ChunkSegmenter segmenter = new ChunkSegmenter(Hasher.noop(), ByteStringStrategy.copy(), 10, 5); diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/GrpcStorageImplUploadRetryTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGrpcStorageImplUploadRetryTest.java similarity index 98% rename from google-cloud-storage/src/test/java/com/google/cloud/storage/GrpcStorageImplUploadRetryTest.java rename to google-cloud-storage/src/test/java/com/google/cloud/storage/ITGrpcStorageImplUploadRetryTest.java index 6d0ffc6fb9..ad3621e648 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/GrpcStorageImplUploadRetryTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGrpcStorageImplUploadRetryTest.java @@ -21,7 +21,7 @@ import com.google.api.core.ApiFuture; import com.google.api.gax.grpc.GrpcCallContext; -import com.google.cloud.storage.GapicUnbufferedWritableByteChannelTest.DirectWriteService; +import com.google.cloud.storage.ITGapicUnbufferedWritableByteChannelTest.DirectWriteService; import com.google.cloud.storage.Storage.BlobTargetOption; import com.google.cloud.storage.Storage.BlobWriteOption; import com.google.common.collect.ImmutableList; @@ -50,7 +50,7 @@ * Verify some simplistic retries can take place and that we're constructing {@link * WriteObjectRequest}s as expected. */ -public final class GrpcStorageImplUploadRetryTest { +public final class ITGrpcStorageImplUploadRetryTest { private static final String FORMATTED_BUCKET_NAME = "projects/_/buckets/buck"; private static final int objectContentSize = 64; private static final byte[] bytes = DataGenerator.base64Characters().genBytes(objectContentSize); diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/GzipReadableByteChannelTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGzipReadableByteChannelTest.java similarity index 99% rename from google-cloud-storage/src/test/java/com/google/cloud/storage/GzipReadableByteChannelTest.java rename to google-cloud-storage/src/test/java/com/google/cloud/storage/ITGzipReadableByteChannelTest.java index 9e30d019ad..2e8efa0589 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/GzipReadableByteChannelTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITGzipReadableByteChannelTest.java @@ -44,7 +44,7 @@ import org.junit.runner.RunWith; @RunWith(Enclosed.class) -public class GzipReadableByteChannelTest { +public class ITGzipReadableByteChannelTest { @SuppressWarnings("PointlessArithmeticExpression") private static final int _1KiB = 1 * 1024; diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/UpdateMaskTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITUpdateMaskTest.java similarity index 99% rename from google-cloud-storage/src/test/java/com/google/cloud/storage/UpdateMaskTest.java rename to google-cloud-storage/src/test/java/com/google/cloud/storage/ITUpdateMaskTest.java index 6d343f2ea2..4fc803b819 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/UpdateMaskTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITUpdateMaskTest.java @@ -50,7 +50,7 @@ import org.junit.runner.RunWith; @RunWith(Enclosed.class) -public final class UpdateMaskTest { +public final class ITUpdateMaskTest { public static final class BlobInfoUpdateMask { From f2747391b6daadd6a12a2dcb54714cce237eb1ac Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Thu, 20 Apr 2023 11:50:38 -0400 Subject: [PATCH 10/16] fix: update grpc x-goog-user-project handling gracefulness (#1983) When an instance of credentials that hasRequestMetadata() but can't refresh an IllegalStateException can be thrown. Add new tests to force failure and update handling to be graceful of this. --- .../cloud/storage/GrpcStorageOptions.java | 28 ++++-- .../com/google/cloud/storage/TestUtils.java | 20 +++++ .../storage/it/ITStorageOptionsTest.java | 85 +++++++++++++++++++ 3 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageOptionsTest.java diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageOptions.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageOptions.java index d1b0f5802c..639f60e3a4 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageOptions.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/GrpcStorageOptions.java @@ -164,17 +164,27 @@ private Tuple> resolveSettingsAndOpts() throw } else { boolean foundQuotaProject = false; if (credentials.hasRequestMetadata()) { - Map> requestMetadata = credentials.getRequestMetadata(uri); - for (Entry> e : requestMetadata.entrySet()) { - String key = e.getKey(); - if ("x-goog-user-project".equals(key.trim().toLowerCase(Locale.ENGLISH))) { - List value = e.getValue(); - if (!value.isEmpty()) { - foundQuotaProject = true; - defaultOpts = Opts.from(UnifiedOpts.userProject(value.get(0))); - break; + try { + Map> requestMetadata = credentials.getRequestMetadata(uri); + for (Entry> e : requestMetadata.entrySet()) { + String key = e.getKey(); + if ("x-goog-user-project".equals(key.trim().toLowerCase(Locale.ENGLISH))) { + List value = e.getValue(); + if (!value.isEmpty()) { + foundQuotaProject = true; + defaultOpts = Opts.from(UnifiedOpts.userProject(value.get(0))); + break; + } } } + } catch (IllegalStateException e) { + // This happens when an instance of OAuth2Credentials attempts to refresh its + // access token during our attempt at getting request metadata. + // This is most easily reproduced by OAuth2Credentials.create(null); + // see com.google.auth.oauth2.OAuth2Credentials.refreshAccessToken + if (!e.getMessage().startsWith("OAuth2Credentials")) { + throw e; + } } } if (foundQuotaProject) { diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java index 0ce0b4c31e..875a3b0d85 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java @@ -35,6 +35,7 @@ import com.google.cloud.storage.Retrying.RetryingDependencies; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; +import com.google.common.io.Files; import com.google.protobuf.Any; import com.google.protobuf.ByteString; import com.google.rpc.DebugInfo; @@ -45,10 +46,12 @@ import io.grpc.netty.shaded.io.netty.buffer.ByteBufUtil; import io.grpc.netty.shaded.io.netty.buffer.Unpooled; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.nio.Buffer; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -264,4 +267,21 @@ public static void assertAll(ThrowingRunnable... trs) throws Exception { map.put(k2, v2); return Collections.unmodifiableMap(map); } + + // copied with minor modification from + // com.google.api.gax.grpc.InstantiatingGrpcChannelProvider#isOnComputeEngine + public static boolean isOnComputeEngine() { + String osName = System.getProperty("os.name"); + if ("Linux".equals(osName)) { + try { + String result = + Files.asCharSource(new File("/sys/class/dmi/id/product_name"), StandardCharsets.UTF_8) + .readFirstLine(); + return result != null && (result.contains("Google") || result.contains("Compute Engine")); + } catch (IOException ignored) { + return false; + } + } + return false; + } } diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageOptionsTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageOptionsTest.java new file mode 100644 index 0000000000..85ee5f642c --- /dev/null +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageOptionsTest.java @@ -0,0 +1,85 @@ +/* + * Copyright 2023 Google LLC + * + * 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. + */ + +package com.google.cloud.storage.it; + +import static org.junit.Assume.assumeTrue; + +import com.google.auth.Credentials; +import com.google.auth.oauth2.GoogleCredentials; +import com.google.auth.oauth2.OAuth2Credentials; +import com.google.cloud.NoCredentials; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import com.google.cloud.storage.TestUtils; +import com.google.cloud.storage.it.ITStorageOptionsTest.CredentialsParameters; +import com.google.cloud.storage.it.runner.StorageITRunner; +import com.google.cloud.storage.it.runner.annotations.Backend; +import com.google.cloud.storage.it.runner.annotations.Parameterized; +import com.google.cloud.storage.it.runner.annotations.Parameterized.Parameter; +import com.google.cloud.storage.it.runner.annotations.Parameterized.ParametersProvider; +import com.google.cloud.storage.it.runner.annotations.SingleBackend; +import com.google.common.collect.ImmutableList; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(StorageITRunner.class) +@SingleBackend(Backend.PROD) +@Parameterized(CredentialsParameters.class) +public final class ITStorageOptionsTest { + + public static final class CredentialsParameters implements ParametersProvider { + + @Override + public ImmutableList parameters() { + return ImmutableList.of( + NoCredentials.getInstance(), + GoogleCredentials.create(/* accessToken= */ null), + OAuth2Credentials.create(null)); + } + } + + @Parameter public Credentials credentials; + + @Test + public void clientShouldConstructCleanly_http() throws Exception { + StorageOptions options = StorageOptions.http().setCredentials(credentials).build(); + doTest(options); + } + + @Test + public void clientShouldConstructCleanly_grpc() throws Exception { + StorageOptions options = + StorageOptions.grpc().setCredentials(credentials).setAttemptDirectPath(false).build(); + doTest(options); + } + + @Test + @Ignore("waiting on conformation from the backend team if this should even be possible") + public void clientShouldConstructCleanly_directPath() throws Exception { + assumeTrue( + "Unable to determine environment can access directPath", TestUtils.isOnComputeEngine()); + StorageOptions options = + StorageOptions.grpc().setCredentials(credentials).setAttemptDirectPath(true).build(); + doTest(options); + } + + private static void doTest(StorageOptions options) throws Exception { + //noinspection EmptyTryBlock + try (Storage ignore = options.getService()) {} + } +} From a52bb375eb53732b953354ffebd3970a217e2a41 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 20 Apr 2023 22:10:01 +0200 Subject: [PATCH 11/16] chore(deps): update dependency com.google.cloud:libraries-bom to v26.13.0 (#1991) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update dependency com.google.cloud:libraries-bom to v26.13.0 * 🦉 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 --- README.md | 4 ++-- samples/native-image-sample/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7b06437a9d..fb4980ea2b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.12.0 + 26.13.0 pom import @@ -50,7 +50,7 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.12.0') +implementation platform('com.google.cloud:libraries-bom:26.13.0') implementation 'com.google.cloud:google-cloud-storage' ``` diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index a521e73586..ca84f8ff99 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -29,7 +29,7 @@ com.google.cloud libraries-bom - 26.12.0 + 26.13.0 pom import diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 33a8c24ea8..4287692ddd 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -31,7 +31,7 @@ com.google.cloud libraries-bom - 26.12.0 + 26.13.0 pom import From e36f8f1822d1290b984a8ae57efedd0276ca39f5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:35:27 -0400 Subject: [PATCH 12/16] docs: update routing annotations for CancelResumableWriteRequest and QueryWriteStatusRequest (#1992) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: update routing annotations for CancelResumableWriteRequest and QueryWriteStatusRequest PiperOrigin-RevId: 526066043 Source-Link: https://github.com/googleapis/googleapis/commit/c87b67d9c2c993621399d1fdc8e6f82d6fe39ee8 Source-Link: https://github.com/googleapis/googleapis-gen/commit/791b51688aa2f10e07614840908c2affb92b9317 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzkxYjUxNjg4YWEyZjEwZTA3NjE0ODQwOTA4YzJhZmZiOTJiOTMxNyJ9 * 🦉 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 --- .../main/java/com/google/storage/v2/stub/GrpcStorageStub.java | 4 ++-- .../src/main/java/com/google/storage/v2/StorageProto.java | 4 ++-- .../src/main/proto/google/storage/v2/storage.proto | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gapic-google-cloud-storage-v2/src/main/java/com/google/storage/v2/stub/GrpcStorageStub.java b/gapic-google-cloud-storage-v2/src/main/java/com/google/storage/v2/stub/GrpcStorageStub.java index d9519f9f96..bf3d106405 100644 --- a/gapic-google-cloud-storage-v2/src/main/java/com/google/storage/v2/stub/GrpcStorageStub.java +++ b/gapic-google-cloud-storage-v2/src/main/java/com/google/storage/v2/stub/GrpcStorageStub.java @@ -472,7 +472,7 @@ public class GrpcStorageStub extends StorageStub { private static final PathTemplate DELETE_OBJECT_0_PATH_TEMPLATE = PathTemplate.create("{bucket=**}"); private static final PathTemplate CANCEL_RESUMABLE_WRITE_0_PATH_TEMPLATE = - PathTemplate.create("{bucket=projects/*/buckets/*}:**"); + PathTemplate.create("{bucket=projects/*/buckets/*}/**"); private static final PathTemplate GET_OBJECT_0_PATH_TEMPLATE = PathTemplate.create("{bucket=**}"); private static final PathTemplate READ_OBJECT_0_PATH_TEMPLATE = PathTemplate.create("{bucket=**}"); @@ -487,7 +487,7 @@ public class GrpcStorageStub extends StorageStub { private static final PathTemplate START_RESUMABLE_WRITE_0_PATH_TEMPLATE = PathTemplate.create("{bucket=**}"); private static final PathTemplate QUERY_WRITE_STATUS_0_PATH_TEMPLATE = - PathTemplate.create("{bucket=projects/*/buckets/*}:**"); + PathTemplate.create("{bucket=projects/*/buckets/*}/**"); private static final PathTemplate GET_SERVICE_ACCOUNT_0_PATH_TEMPLATE = PathTemplate.create("{project=**}"); private static final PathTemplate CREATE_HMAC_KEY_0_PATH_TEMPLATE = diff --git a/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java b/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java index 66b7a005a1..a6a8af9891 100644 --- a/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java +++ b/proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageProto.java @@ -811,7 +811,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "ncelResumableWriteRequest\032/.google.stora" + "ge.v2.CancelResumableWriteResponse\"A\212\323\344\223" + "\002/\022-\n\tupload_id\022 {bucket=projects/*/buck" - + "ets/*}:**\332A\tupload_id\022\225\001\n\tGetObject\022#.go" + + "ets/*}/**\332A\tupload_id\022\225\001\n\tGetObject\022#.go" + "ogle.storage.v2.GetObjectRequest\032\031.googl" + "e.storage.v2.Object\"H\212\323\344\223\002\027\022\025\n\006bucket\022\013{" + "bucket=**}\332A\rbucket,object\332A\030bucket,obje" @@ -841,7 +841,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "storage.v2.QueryWriteStatusRequest\032+.goo" + "gle.storage.v2.QueryWriteStatusResponse\"" + "A\212\323\344\223\002/\022-\n\tupload_id\022 {bucket=projects/*" - + "/buckets/*}:**\332A\tupload_id\022\200\001\n\021GetServic" + + "/buckets/*}/**\332A\tupload_id\022\200\001\n\021GetServic" + "eAccount\022+.google.storage.v2.GetServiceA" + "ccountRequest\032!.google.storage.v2.Servic" + "eAccount\"\033\212\323\344\223\002\013\022\t\n\007project\332A\007project\022\225\001" diff --git a/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto b/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto index f5053eaed6..02d78323b6 100644 --- a/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto +++ b/proto-google-cloud-storage-v2/src/main/proto/google/storage/v2/storage.proto @@ -252,7 +252,7 @@ service Storage { option (google.api.routing) = { routing_parameters { field: "upload_id" - path_template: "{bucket=projects/*/buckets/*}:**" + path_template: "{bucket=projects/*/buckets/*}/**" } }; option (google.api.method_signature) = "upload_id"; @@ -391,7 +391,7 @@ service Storage { option (google.api.routing) = { routing_parameters { field: "upload_id" - path_template: "{bucket=projects/*/buckets/*}:**" + path_template: "{bucket=projects/*/buckets/*}/**" } }; option (google.api.method_signature) = "upload_id"; From 46c926e537f387b77a56f9275eb99b4f749ce094 Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Tue, 25 Apr 2023 14:30:03 -0400 Subject: [PATCH 13/16] test: add integration to verify behavior of reader with effective length <= 0 (#1988) StorageReadChannel is able to detect when an effective read length is <= 0 and will return EOF without sending an RPC. If we ever return object metadata along with a read, we will need to amend this behavior so that the metadata can be resolved. --- .../storage/it/ITStorageReadChannelTest.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageReadChannelTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageReadChannelTest.java index 317974d472..5c6bb4ef18 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageReadChannelTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageReadChannelTest.java @@ -40,9 +40,14 @@ import com.google.cloud.storage.it.runner.annotations.CrossRun; import com.google.cloud.storage.it.runner.annotations.Inject; import com.google.cloud.storage.it.runner.registry.Generator; +import com.google.cloud.storage.it.runner.registry.ObjectsFixture; +import com.google.common.io.ByteStreams; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; +import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; +import java.nio.channels.WritableByteChannel; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Function; @@ -61,6 +66,8 @@ public final class ITStorageReadChannelTest { @Inject public Generator generator; + @Inject public ObjectsFixture objectsFixture; + @Test public void storageReadChannel_getObject_returns() throws Exception { int _512KiB = 512 * 1024; @@ -109,7 +116,6 @@ public void storageReadChannel_getObject_returns() throws Exception { } @Test - // @CrossRun.Exclude(transports = Transport.GRPC) public void storageReadChannel_shouldAllowDisablingBufferingBySettingChunkSize_lteq0() throws IOException { int _512KiB = 512 * 1024; @@ -137,6 +143,21 @@ public void storageReadChannel_shouldAllowDisablingBufferingBySettingChunkSize_l } } + @Test + public void storageReadChannel_attemptToReadZeroBytes() throws IOException { + BlobInfo info1 = objectsFixture.getInfo1(); + try (ReadChannel r = storage.reader(info1.getBlobId()); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + WritableByteChannel w = Channels.newChannel(baos)) { + r.setChunkSize(10); + r.seek(10); + r.limit(10); + + ByteStreams.copy(r, w); + assertThat(baos.toByteArray()).isEmpty(); + } + } + @Test public void storageReadChannel_getObject_404() { BlobId id = BlobId.of(bucket.getName(), generator.randomObjectName()); From b7fb0373955cf9d60ce46a3827152041c19e943e Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 25 Apr 2023 20:48:06 +0200 Subject: [PATCH 14/16] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v3.8.0 (#1995) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 789a67e6e2..a6c02bbaae 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ UTF-8 github google-cloud-storage-parent - 3.7.0 + 3.8.0 From 68de5c7fae6df2f3df5c8c413b206bd7c7e230ea Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Wed, 26 Apr 2023 12:17:22 -0400 Subject: [PATCH 15/16] fix: introduce new BlobId#toGsUtilUriWithGeneration (#1998) When BlobId#toGsUtilUri was updated to output generation if defined, this broken older clients ability to parse the value via BlobId#fromGsUtilUri. This adds the new method toGsUtilUriWithGeneration to explicitly opt in to generation being okay in the output. Related to #1928 Related to #1929 --- .../java/com/google/cloud/storage/BlobId.java | 15 ++++++++++++++- .../java/com/google/cloud/storage/BlobIdTest.java | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java index c1914d6a13..1fa1245eeb 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java @@ -58,8 +58,21 @@ public Long getGeneration() { return generation; } - /** Returns this blob's Storage url which can be used with gsutil */ + /** + * Returns this blob's Storage url which can be used with gsutil. If {@link #generation} is + * non-null it will not be included in the uri. + */ public String toGsUtilUri() { + return "gs://" + bucket + "/" + name; + } + + /** + * Returns this blob's Storage url which can be used with gsutil. If {@link #generation} is + * non-null it will be included in the uri + * + * @since 2.23.0 + */ + public String toGsUtilUriWithGeneration() { return "gs://" + bucket + "/" + name + (generation == null ? "" : ("#" + generation)); } diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java index 03bf2218f4..f1c37ce1e6 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobIdTest.java @@ -45,7 +45,8 @@ public void testToFromGsUtilUriWithGeneration() { assertEquals("bucket", blobId.getBucket()); assertEquals("path/to/blob", blobId.getName()); assertEquals(Long.valueOf(1360887697105000L), blobId.getGeneration()); - assertEquals("gs://bucket/path/to/blob#1360887697105000", blobId.toGsUtilUri()); + assertEquals("gs://bucket/path/to/blob", blobId.toGsUtilUri()); + assertEquals("gs://bucket/path/to/blob#1360887697105000", blobId.toGsUtilUriWithGeneration()); } @Test From f5a4c9249eb55504a1cf5c30bf39323f88bc47a5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 17:14:13 +0000 Subject: [PATCH 16/16] chore(main): release 2.22.1 (#1989) :robot: I have created a release *beep* *boop* --- ## [2.22.1](https://togithub.com/googleapis/java-storage/compare/v2.22.0...v2.22.1) (2023-04-26) ### Bug Fixes * Introduce new BlobId#toGsUtilUriWithGeneration ([#1998](https://togithub.com/googleapis/java-storage/issues/1998)) ([68de5c7](https://togithub.com/googleapis/java-storage/commit/68de5c7fae6df2f3df5c8c413b206bd7c7e230ea)) * Update grpc x-goog-user-project handling gracefulness ([#1983](https://togithub.com/googleapis/java-storage/issues/1983)) ([f274739](https://togithub.com/googleapis/java-storage/commit/f2747391b6daadd6a12a2dcb54714cce237eb1ac)) ### Documentation * Update routing annotations for CancelResumableWriteRequest and QueryWriteStatusRequest ([#1992](https://togithub.com/googleapis/java-storage/issues/1992)) ([e36f8f1](https://togithub.com/googleapis/java-storage/commit/e36f8f1822d1290b984a8ae57efedd0276ca39f5)) ### Dependencies * Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.8.0 ([#1995](https://togithub.com/googleapis/java-storage/issues/1995)) ([b7fb037](https://togithub.com/googleapis/java-storage/commit/b7fb0373955cf9d60ce46a3827152041c19e943e)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please). --- CHANGELOG.md | 18 ++++++++++++++++++ gapic-google-cloud-storage-v2/pom.xml | 4 ++-- google-cloud-storage-bom/pom.xml | 10 +++++----- google-cloud-storage/pom.xml | 4 ++-- .../java/com/google/cloud/storage/BlobId.java | 2 +- grpc-google-cloud-storage-v2/pom.xml | 4 ++-- pom.xml | 10 +++++----- proto-google-cloud-storage-v2/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 8 ++++---- 10 files changed, 42 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ab6c2d5dd..136833246f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [2.22.1](https://github.com/googleapis/java-storage/compare/v2.22.0...v2.22.1) (2023-04-26) + + +### Bug Fixes + +* Introduce new BlobId#toGsUtilUriWithGeneration ([#1998](https://github.com/googleapis/java-storage/issues/1998)) ([68de5c7](https://github.com/googleapis/java-storage/commit/68de5c7fae6df2f3df5c8c413b206bd7c7e230ea)) +* Update grpc x-goog-user-project handling gracefulness ([#1983](https://github.com/googleapis/java-storage/issues/1983)) ([f274739](https://github.com/googleapis/java-storage/commit/f2747391b6daadd6a12a2dcb54714cce237eb1ac)) + + +### Documentation + +* Update routing annotations for CancelResumableWriteRequest and QueryWriteStatusRequest ([#1992](https://github.com/googleapis/java-storage/issues/1992)) ([e36f8f1](https://github.com/googleapis/java-storage/commit/e36f8f1822d1290b984a8ae57efedd0276ca39f5)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.8.0 ([#1995](https://github.com/googleapis/java-storage/issues/1995)) ([b7fb037](https://github.com/googleapis/java-storage/commit/b7fb0373955cf9d60ce46a3827152041c19e943e)) + ## [2.22.0](https://github.com/googleapis/java-storage/compare/v2.21.0...v2.22.0) (2023-04-12) diff --git a/gapic-google-cloud-storage-v2/pom.xml b/gapic-google-cloud-storage-v2/pom.xml index 01e4796fbf..bb361c6d89 100644 --- a/gapic-google-cloud-storage-v2/pom.xml +++ b/gapic-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc gapic-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha gapic-google-cloud-storage-v2 GRPC library for gapic-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.22.1-SNAPSHOT + 2.22.1 diff --git a/google-cloud-storage-bom/pom.xml b/google-cloud-storage-bom/pom.xml index 996455e011..8b093cc434 100644 --- a/google-cloud-storage-bom/pom.xml +++ b/google-cloud-storage-bom/pom.xml @@ -19,7 +19,7 @@ 4.0.0 com.google.cloud google-cloud-storage-bom - 2.22.1-SNAPSHOT + 2.22.1 pom com.google.cloud @@ -69,22 +69,22 @@ com.google.cloud google-cloud-storage - 2.22.1-SNAPSHOT + 2.22.1 com.google.api.grpc gapic-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha com.google.api.grpc grpc-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha com.google.api.grpc proto-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index 7ee580e971..8893d3c416 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-storage - 2.22.1-SNAPSHOT + 2.22.1 jar Google Cloud Storage https://github.com/googleapis/java-storage @@ -12,7 +12,7 @@ com.google.cloud google-cloud-storage-parent - 2.22.1-SNAPSHOT + 2.22.1 google-cloud-storage diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java index 1fa1245eeb..6d05899787 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobId.java @@ -70,7 +70,7 @@ public String toGsUtilUri() { * Returns this blob's Storage url which can be used with gsutil. If {@link #generation} is * non-null it will be included in the uri * - * @since 2.23.0 + * @since 2.22.1 */ public String toGsUtilUriWithGeneration() { return "gs://" + bucket + "/" + name + (generation == null ? "" : ("#" + generation)); diff --git a/grpc-google-cloud-storage-v2/pom.xml b/grpc-google-cloud-storage-v2/pom.xml index 7bba8b3295..d89bb262f9 100644 --- a/grpc-google-cloud-storage-v2/pom.xml +++ b/grpc-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha grpc-google-cloud-storage-v2 GRPC library for grpc-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.22.1-SNAPSHOT + 2.22.1 diff --git a/pom.xml b/pom.xml index a6c02bbaae..9a7ffa351d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-storage-parent pom - 2.22.1-SNAPSHOT + 2.22.1 Storage Parent https://github.com/googleapis/java-storage @@ -70,7 +70,7 @@ com.google.cloud google-cloud-storage - 2.22.1-SNAPSHOT + 2.22.1 com.google.apis @@ -111,17 +111,17 @@ com.google.api.grpc proto-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha com.google.api.grpc grpc-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha com.google.api.grpc gapic-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha com.google.cloud diff --git a/proto-google-cloud-storage-v2/pom.xml b/proto-google-cloud-storage-v2/pom.xml index 01d97d0e7c..dc87529b81 100644 --- a/proto-google-cloud-storage-v2/pom.xml +++ b/proto-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-storage-v2 - 2.22.1-alpha-SNAPSHOT + 2.22.1-alpha proto-google-cloud-storage-v2 PROTO library for proto-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.22.1-SNAPSHOT + 2.22.1 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index eff2284581..ab65e59171 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-storage - 2.22.1-SNAPSHOT + 2.22.1 diff --git a/versions.txt b/versions.txt index 2baae6a35f..ffe85487db 100644 --- a/versions.txt +++ b/versions.txt @@ -1,7 +1,7 @@ # Format: # module:released-version:current-version -google-cloud-storage:2.22.0:2.22.1-SNAPSHOT -gapic-google-cloud-storage-v2:2.22.0-alpha:2.22.1-alpha-SNAPSHOT -grpc-google-cloud-storage-v2:2.22.0-alpha:2.22.1-alpha-SNAPSHOT -proto-google-cloud-storage-v2:2.22.0-alpha:2.22.1-alpha-SNAPSHOT +google-cloud-storage:2.22.1:2.22.1 +gapic-google-cloud-storage-v2:2.22.1-alpha:2.22.1-alpha +grpc-google-cloud-storage-v2:2.22.1-alpha:2.22.1-alpha +proto-google-cloud-storage-v2:2.22.1-alpha:2.22.1-alpha