From 2c1ca3f83070155a27166d4e6f1fcc5827e2ce6e Mon Sep 17 00:00:00 2001 From: Hosain Date: Sun, 19 Jul 2020 21:48:42 +0100 Subject: [PATCH] fix: set storage update time in FakeStorageRpc --- .../contrib/nio/testing/FakeStorageRpc.java | 13 ++++++++++++ .../nio/testing/LocalStorageHelperTest.java | 20 +++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java b/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java index 55d0b52b..f47f3024 100644 --- a/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java +++ b/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/testing/FakeStorageRpc.java @@ -16,6 +16,7 @@ package com.google.cloud.storage.contrib.nio.testing; +import com.google.api.client.util.DateTime; import com.google.api.services.storage.model.Bucket; import com.google.api.services.storage.model.ServiceAccount; import com.google.api.services.storage.model.StorageObject; @@ -29,8 +30,10 @@ import java.io.OutputStream; import java.math.BigInteger; import java.nio.file.FileAlreadyExistsException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -70,6 +73,9 @@ @NotThreadSafe class FakeStorageRpc extends StorageRpcTestBase { + private static final SimpleDateFormat RFC_3339_FORMATTER = + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + // fullname -> metadata Map metadata = new HashMap<>(); // fullname -> contents @@ -95,6 +101,7 @@ public StorageObject create(StorageObject object, InputStream content, Map