Skip to content

Commit 0c13635

Browse files
authored
deps: update dependency com.google.cloud:google-cloud-storage to v2.25.0 (#1215)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-storage](https://togithub.com/googleapis/java-storage) | `2.22.6` -> `2.25.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.cloud:google-cloud-storage/2.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.cloud:google-cloud-storage/2.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.cloud:google-cloud-storage/2.22.6/2.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.cloud:google-cloud-storage/2.22.6/2.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-storage (com.google.cloud:google-cloud-storage)</summary> ### [`v2.25.0`](https://togithub.com/googleapis/java-storage/blob/HEAD/CHANGELOG.md#2250-2023-07-24) [Compare Source](https://togithub.com/googleapis/java-storage/compare/v2.24.0...v2.25.0) ##### Features - BlobWriteChannelV2 - same throughput less GC ([#&#8203;2110](https://togithub.com/googleapis/java-storage/issues/2110)) ([1b52a10](https://togithub.com/googleapis/java-storage/commit/1b52a1053130620011515060787bada10c324c0b)) - Update Storage.createFrom(BlobInfo, Path) to have 150% higher throughput ([#&#8203;2059](https://togithub.com/googleapis/java-storage/issues/2059)) ([4c2f44e](https://togithub.com/googleapis/java-storage/commit/4c2f44e28a1ff19ffb2a02e3cefc062a1dd98fdc)) ##### Bug Fixes - Update BlobWriteChannelV2 to properly carry forward offset after incremental flush ([#&#8203;2125](https://togithub.com/googleapis/java-storage/issues/2125)) ([c099a2f](https://togithub.com/googleapis/java-storage/commit/c099a2f4f8ea9afa6953270876653916b021fd9f)) - Update GrpcStorageImpl.createFrom(BlobInfo, Path) to use RewindableContent ([#&#8203;2112](https://togithub.com/googleapis/java-storage/issues/2112)) ([c805051](https://togithub.com/googleapis/java-storage/commit/c80505129baa831e492a5514e937875407211595)) ##### Documentation - Fix broken link for TESTING.md ([#&#8203;2126](https://togithub.com/googleapis/java-storage/issues/2126)) ([fe9662d](https://togithub.com/googleapis/java-storage/commit/fe9662d7e552aabfc9012e582ae634f46af1f255)) ##### Dependencies - **test:** Update gcr.io/cloud-devrel-public-resources/storage-testbench docker tag to v0.37.0 ([#&#8203;2130](https://togithub.com/googleapis/java-storage/issues/2130)) ([9e8b6d3](https://togithub.com/googleapis/java-storage/commit/9e8b6d324bfef84e2c2ee93c424b2e7fcb601945)) - Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.13.1 ([#&#8203;2129](https://togithub.com/googleapis/java-storage/issues/2129)) ([a7e854e](https://togithub.com/googleapis/java-storage/commit/a7e854ecb4d7fa9508a8d0844fc08d9eeab6f653)) - Update dependency org.junit.vintage:junit-vintage-engine to v5.10.0 ([#&#8203;2132](https://togithub.com/googleapis/java-storage/issues/2132)) ([f5477e4](https://togithub.com/googleapis/java-storage/commit/f5477e4eb168dfd3151d0e2c0462e5b35eb3de37)) - Update junit-platform.version to v5.10.0 ([#&#8203;2133](https://togithub.com/googleapis/java-storage/issues/2133)) ([3d22686](https://togithub.com/googleapis/java-storage/commit/3d2268642dcecea8ca55e78479ad4e4390075814)) ### [`v2.24.0`](https://togithub.com/googleapis/java-storage/blob/HEAD/CHANGELOG.md#2240-2023-07-11) [Compare Source](https://togithub.com/googleapis/java-storage/compare/v2.23.0...v2.24.0) ##### Features - Add validation around bytes received vs bytes expected ([#&#8203;2078](https://togithub.com/googleapis/java-storage/issues/2078)) ([45d142a](https://togithub.com/googleapis/java-storage/commit/45d142a7ba45a80fca05fc9d8c8d7ce376d3f39c)) - Initial Preview of Transfer Manager [#&#8203;2105](https://togithub.com/googleapis/java-storage/issues/2105) ([8b17574](https://togithub.com/googleapis/java-storage/commit/8b175745d306e3da58ec3c9307442f14a34fd4ef)) ##### Bug Fixes - Update grpc upload logic to follow hashing behavior of json ([#&#8203;2107](https://togithub.com/googleapis/java-storage/issues/2107)) ([ed05232](https://togithub.com/googleapis/java-storage/commit/ed05232889c0442f43eacde5dbc80f44f09ebe83)) - Update UploadCallable to use createFrom to avoid NPE trying to resolve resulting object ([#&#8203;2086](https://togithub.com/googleapis/java-storage/issues/2086)) ([6769a2b](https://togithub.com/googleapis/java-storage/commit/6769a2b3b06fb297ebce819fbdfba5ee377be147)) ##### Documentation - Javadocs for remainder of Transfer Manager ([#&#8203;2097](https://togithub.com/googleapis/java-storage/issues/2097)) ([0362e80](https://togithub.com/googleapis/java-storage/commit/0362e80386d8055811082204536f596ba948a963)) - Javadocs for TransferManager interface and ParallelUploadConfig ([#&#8203;2094](https://togithub.com/googleapis/java-storage/issues/2094)) ([63d8ed3](https://togithub.com/googleapis/java-storage/commit/63d8ed37a80304e57b3f48aae614af89a9543ffa)) - **samples:** Add storage_grpc_quickstart samples ([#&#8203;2041](https://togithub.com/googleapis/java-storage/issues/2041)) ([5f916fb](https://togithub.com/googleapis/java-storage/commit/5f916fbba789edd33c2b4195db885d2b0191f860)) ##### Dependencies - Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.12.0 ([#&#8203;2088](https://togithub.com/googleapis/java-storage/issues/2088)) ([18adb5a](https://togithub.com/googleapis/java-storage/commit/18adb5a18fc37eb3bb3553fe20648d68a53f987a)) - Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.13.0 ([#&#8203;2106](https://togithub.com/googleapis/java-storage/issues/2106)) ([734dee0](https://togithub.com/googleapis/java-storage/commit/734dee0402fc16a3cc8d842eb135cc5743586e35)) - Update dependency io.grpc:grpc-bom to v1.56.1 ([#&#8203;2101](https://togithub.com/googleapis/java-storage/issues/2101)) ([3102941](https://togithub.com/googleapis/java-storage/commit/31029414d8e758c01faaab398a701afebf5e934d)) - Update dependency net.jqwik:jqwik to v1.7.4 ([#&#8203;2103](https://togithub.com/googleapis/java-storage/issues/2103)) ([c681ccf](https://togithub.com/googleapis/java-storage/commit/c681ccfffe6b861c19b92e496363146adc7d862b)) - Update gcr.io/cloud-devrel-public-resources/storage-testbench docker tag to v0.36.0 ([#&#8203;2080](https://togithub.com/googleapis/java-storage/issues/2080)) ([ba5c11a](https://togithub.com/googleapis/java-storage/commit/ba5c11a1589d1c7ffefd15e921da914289bc219e)) ### [`v2.23.0`](https://togithub.com/googleapis/java-storage/blob/HEAD/CHANGELOG.md#2230-2023-06-21) [Compare Source](https://togithub.com/googleapis/java-storage/compare/v2.22.6...v2.23.0) ##### Features - Add new dedup utility method to Option classes ([#&#8203;2063](https://togithub.com/googleapis/java-storage/issues/2063)) ([2ad196c](https://togithub.com/googleapis/java-storage/commit/2ad196c063e67c7efdac344792b67de3479d789d)) ##### Dependencies - Update dependencies io.grpc:\* to v1.56.0 ([#&#8203;2072](https://togithub.com/googleapis/java-storage/issues/2072)) ([e10bde2](https://togithub.com/googleapis/java-storage/commit/e10bde26416bcf17401516e43949e12246f4831c)) - Update dependency com.google.apis:google-api-services-storage to v1-rev20230617-2.0.0 ([#&#8203;2077](https://togithub.com/googleapis/java-storage/issues/2077)) ([9f618cd](https://togithub.com/googleapis/java-storage/commit/9f618cddbeb471f7bd0f2332c70e501afbaccc36)) - Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.23 ([#&#8203;2074](https://togithub.com/googleapis/java-storage/issues/2074)) ([427f330](https://togithub.com/googleapis/java-storage/commit/427f330793a20b0c3da4cbe5e85984a0df508c79)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/googleapis/java-storage-nio). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi41LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNi4xMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
1 parent 270306a commit 0c13635

2 files changed

Lines changed: 61 additions & 12 deletions

File tree

java-storage-nio/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.api.client.http.LowLevelHttpRequest;
2222
import com.google.api.client.http.LowLevelHttpResponse;
2323
import com.google.api.client.json.gson.GsonFactory;
24+
import com.google.api.client.testing.http.MockHttpTransport;
2425
import com.google.api.client.testing.http.MockLowLevelHttpRequest;
2526
import com.google.api.client.testing.http.MockLowLevelHttpResponse;
2627
import com.google.api.client.util.DateTime;
@@ -34,12 +35,14 @@
3435
import com.google.cloud.storage.testing.StorageRpcTestBase;
3536
import com.google.common.base.Preconditions;
3637
import java.io.ByteArrayInputStream;
38+
import java.io.ByteArrayOutputStream;
3739
import java.io.IOException;
3840
import java.io.InputStream;
3941
import java.io.OutputStream;
4042
import java.io.UnsupportedEncodingException;
4143
import java.math.BigInteger;
4244
import java.net.URLDecoder;
45+
import java.nio.ByteBuffer;
4346
import java.nio.charset.StandardCharsets;
4447
import java.nio.file.FileAlreadyExistsException;
4548
import java.text.SimpleDateFormat;
@@ -48,6 +51,7 @@
4851
import java.util.Date;
4952
import java.util.List;
5053
import java.util.Map;
54+
import java.util.Objects;
5155
import java.util.concurrent.ConcurrentHashMap;
5256
import java.util.regex.Matcher;
5357
import java.util.regex.Pattern;
@@ -547,13 +551,13 @@ public com.google.api.services.storage.Storage getStorage() {
547551
}
548552

549553
private static String fullname(String bucket, String object) {
550-
return String.format("%s/%s", bucket, object);
554+
return String.format("http://localhost:65555/b/%s/o/%s", bucket, object);
551555
}
552556

553557
private static final String KEY_PATTERN_DEFINITION = "^.*?/b/(.*?)/o/(.*?)(?:[?].*|$)";
554558
private static final Pattern KEY_PATTERN = Pattern.compile(KEY_PATTERN_DEFINITION);
555559

556-
MyMockLowLevelHttpRequest create(String url) {
560+
MyMockLowLevelHttpRequest create(String method, String url) {
557561
Matcher m = KEY_PATTERN.matcher(url);
558562
Preconditions.checkArgument(
559563
m.matches(),
@@ -566,7 +570,7 @@ MyMockLowLevelHttpRequest create(String url) {
566570

567571
String decode = urlDecode(object);
568572
String key = fullname(bucket, decode);
569-
return new MyMockLowLevelHttpRequest(url, key);
573+
return new MyMockLowLevelHttpRequest(method, url, key);
570574
}
571575

572576
private static String urlDecode(String object) {
@@ -579,10 +583,12 @@ private static String urlDecode(String object) {
579583

580584
private class MyMockLowLevelHttpRequest extends MockLowLevelHttpRequest {
581585

586+
private final String method;
582587
private final String key;
583588

584-
private MyMockLowLevelHttpRequest(String url, String key) {
589+
private MyMockLowLevelHttpRequest(String method, String url, String key) {
585590
super(url);
591+
this.method = method;
586592
this.key = key;
587593
}
588594

@@ -600,8 +606,46 @@ public MockLowLevelHttpResponse getResponse() {
600606

601607
MockLowLevelHttpResponse resp = new MockLowLevelHttpResponse();
602608
byte[] bytes = contents.get(key);
603-
if (bytes == null) {
609+
StorageObject storageObject = metadata.get(key);
610+
if (bytes == null && storageObject == null) {
604611
resp.setStatusCode(NOT_FOUND);
612+
} else if (storageObject != null && method.equals("PUT")) {
613+
try {
614+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
615+
this.getStreamingContent().writeTo(baos);
616+
byte[] byteArray = baos.toByteArray();
617+
if (storageObject.getGeneration() != null) {
618+
contents.put(key, concat(bytes, byteArray));
619+
} else {
620+
contents.put(key, byteArray);
621+
}
622+
623+
List<String> contentRanges = getHeaders().get("content-range");
624+
if (contentRanges != null && !contentRanges.isEmpty()) {
625+
String contentRange = contentRanges.get(0);
626+
// finalization PUT
627+
// Pattern matches both froms of begin-end/size, */size
628+
Pattern pattern = Pattern.compile("bytes (?:\\d+-\\d+|\\*)/(\\d+)");
629+
Matcher matcher = pattern.matcher(contentRange);
630+
if (matcher.matches()) {
631+
storageObject.setSize(new BigInteger(matcher.group(1), 10));
632+
storageObject.setGeneration(System.currentTimeMillis());
633+
DateTime now = now();
634+
storageObject.setTimeCreated(now);
635+
storageObject.setUpdated(now);
636+
String string = GsonFactory.getDefaultInstance().toPrettyString(storageObject);
637+
resp.addHeader("Content-Type", "application/json;charset=utf-8");
638+
resp.addHeader("Content-Length", String.valueOf(string.length()));
639+
resp.setContent(string);
640+
} else {
641+
resp.setStatusCode(NOT_FOUND);
642+
}
643+
} else {
644+
resp.setStatusCode(NOT_FOUND);
645+
}
646+
} catch (IOException e) {
647+
throw new RuntimeException(e);
648+
}
605649
} else {
606650
int length = bytes.length;
607651
Map<String, List<String>> headers = getHeaders();
@@ -661,16 +705,21 @@ public MockLowLevelHttpResponse getResponse() {
661705
}
662706
}
663707

664-
private class FakeStorageRpcHttpTransport extends HttpTransport {
708+
private static byte[] concat(byte[]... arrays) {
709+
int total = Arrays.stream(arrays).filter(Objects::nonNull).mapToInt(a -> a.length).sum();
710+
byte[] retVal = new byte[total];
665711

666-
@Override
667-
public boolean supportsMethod(String method) {
668-
return "GET".equals(method);
669-
}
712+
ByteBuffer wrap = ByteBuffer.wrap(retVal);
713+
Arrays.stream(arrays).filter(Objects::nonNull).forEach(wrap::put);
714+
715+
return retVal;
716+
}
717+
718+
private class FakeStorageRpcHttpTransport extends MockHttpTransport {
670719

671720
@Override
672721
public LowLevelHttpRequest buildRequest(String method, String url) {
673-
return create(url);
722+
return create(method, url);
674723
}
675724
}
676725
}

java-storage-nio/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<dependency>
7979
<groupId>com.google.cloud</groupId>
8080
<artifactId>google-cloud-storage</artifactId>
81-
<version>2.22.6</version>
81+
<version>2.25.0</version>
8282
</dependency>
8383
<dependency>
8484
<groupId>com.google.apis</groupId>

0 commit comments

Comments
 (0)