diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index 5940503fa..bbf82065e 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -39,7 +39,7 @@ retry_with_backoff 3 10 \
# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then
- export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS})
+ export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS})
fi
RETURN_CODE=0
diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg
index 40c4abb7b..0048c8ece 100644
--- a/.kokoro/nightly/integration.cfg
+++ b/.kokoro/nightly/integration.cfg
@@ -28,14 +28,10 @@ env_vars: {
env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
- value: "keystore/73713_java_it_service_account"
+ value: "secret_manager/java-it-service-account"
}
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "java_it_service_account"
- }
- }
+env_vars: {
+ key: "SECRET_MANAGER_KEYS"
+ value: "java-it-service-account"
}
diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg
index 20aabd55d..f25429314 100644
--- a/.kokoro/nightly/samples.cfg
+++ b/.kokoro/nightly/samples.cfg
@@ -24,19 +24,15 @@ env_vars: {
env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
- value: "keystore/73713_java_it_service_account"
+ value: "secret_manager/java-docs-samples-service-account"
}
env_vars: {
- key: "ENABLE_BUILD_COP"
- value: "true"
+ key: "SECRET_MANAGER_KEYS"
+ value: "java-docs-samples-service-account"
}
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "java_it_service_account"
- }
- }
+env_vars: {
+ key: "ENABLE_BUILD_COP"
+ value: "true"
}
diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh
new file mode 100755
index 000000000..f52514257
--- /dev/null
+++ b/.kokoro/populate-secrets.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Copyright 2020 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.
+
+set -eo pipefail
+
+function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
+function msg { println "$*" >&2 ;}
+function println { printf '%s\n' "$(now) $*" ;}
+
+
+# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
+# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
+SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
+msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
+mkdir -p ${SECRET_LOCATION}
+for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
+do
+ msg "Retrieving secret ${key}"
+ docker run --entrypoint=gcloud \
+ --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
+ gcr.io/google.com/cloudsdktool/cloud-sdk \
+ secrets versions access latest \
+ --project cloud-devrel-kokoro-resources \
+ --secret ${key} > \
+ "${SECRET_LOCATION}/${key}"
+ if [[ $? == 0 ]]; then
+ msg "Secret written to ${SECRET_LOCATION}/${key}"
+ else
+ msg "Error retrieving secret ${key}"
+ fi
+done
diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg
index 522e5b101..dded67a9d 100644
--- a/.kokoro/presubmit/integration.cfg
+++ b/.kokoro/presubmit/integration.cfg
@@ -24,14 +24,10 @@ env_vars: {
env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
- value: "keystore/73713_java_it_service_account"
+ value: "secret_manager/java-it-service-account"
}
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "java_it_service_account"
- }
- }
+env_vars: {
+ key: "SECRET_MANAGER_KEYS"
+ value: "java-it-service-account"
}
diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg
index 1171aead0..01e096004 100644
--- a/.kokoro/presubmit/samples.cfg
+++ b/.kokoro/presubmit/samples.cfg
@@ -24,14 +24,10 @@ env_vars: {
env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
- value: "keystore/73713_java_it_service_account"
+ value: "secret_manager/java-docs-samples-service-account"
}
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "java_it_service_account"
- }
- }
-}
+env_vars: {
+ key: "SECRET_MANAGER_KEYS"
+ value: "java-docs-samples-service-account"
+}
\ No newline at end of file
diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh
index ba17ce014..9da0f8398 100644
--- a/.kokoro/trampoline.sh
+++ b/.kokoro/trampoline.sh
@@ -21,4 +21,6 @@ function cleanup() {
echo "cleanup";
}
trap cleanup EXIT
+
+$(dirname $0)/populate-secrets.sh # Secret Manager secrets.
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a5ab0a65..48a488fb5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+### [0.120.2](https://www.github.com/googleapis/java-storage-nio/compare/v0.120.1...v0.120.2) (2020-06-18)
+
+
+### Bug Fixes
+
+* update FakeStorageRpc to extend StorageRpcTestBase [#135](https://www.github.com/googleapis/java-storage-nio/issues/135) ([7614295](https://www.github.com/googleapis/java-storage-nio/commit/761429571eea15b11b2d44b4f5a2c65b4f649484))
+
### [0.120.1](https://www.github.com/googleapis/java-storage-nio/compare/v0.120.0...v0.120.1) (2020-06-16)
diff --git a/README.md b/README.md
index d0c90045e..80692cb47 100644
--- a/README.md
+++ b/README.md
@@ -43,16 +43,16 @@ If you are using Maven without a BOM, add this to your dependencies.
com.google.cloud
google-cloud-nio
- 0.121.1
+ 0.121.2
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:google-cloud-nio:0.121.1'
+compile 'com.google.cloud:google-cloud-nio:0.121.2'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-nio" % "0.121.1"
+libraryDependencies += "com.google.cloud" % "google-cloud-nio" % "0.121.2"
```
[//]: # ({x-version-update-end})
diff --git a/google-cloud-nio-examples/pom.xml b/google-cloud-nio-examples/pom.xml
index 4f7e0f4a4..26a9cc0ed 100644
--- a/google-cloud-nio-examples/pom.xml
+++ b/google-cloud-nio-examples/pom.xml
@@ -2,7 +2,7 @@
4.0.0
google-cloud-nio-examples
- 0.121.1
+ 0.121.2
jar
Google Cloud NIO Examples
https://github.com/googleapis/java-storage-nio
@@ -13,7 +13,7 @@
com.google.cloud
google-cloud-nio-parent
- 0.121.1
+ 0.121.2
diff --git a/google-cloud-nio-retrofit/pom.xml b/google-cloud-nio-retrofit/pom.xml
index 504382008..04396e307 100644
--- a/google-cloud-nio-retrofit/pom.xml
+++ b/google-cloud-nio-retrofit/pom.xml
@@ -2,7 +2,7 @@
4.0.0
google-cloud-nio-retrofit
- 0.121.1
+ 0.121.2
jar
Google Cloud NIO Retrofit Example
https://github.com/googleapis/java-storage-nio
@@ -12,7 +12,7 @@
com.google.cloud
google-cloud-nio-parent
- 0.121.1
+ 0.121.2
google-cloud-nio-retrofit
diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml
index d093f8936..b1d630d73 100644
--- a/google-cloud-nio/pom.xml
+++ b/google-cloud-nio/pom.xml
@@ -2,7 +2,7 @@
4.0.0
google-cloud-nio
- 0.121.1
+ 0.121.2
jar
Google Cloud NIO
https://github.com/googleapis/java-storage-nio
@@ -12,7 +12,7 @@
com.google.cloud
google-cloud-nio-parent
- 0.121.1
+ 0.121.2
google-cloud-nio
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 521061418..55d0b52bc 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
@@ -17,20 +17,13 @@
package com.google.cloud.storage.contrib.nio.testing;
import com.google.api.services.storage.model.Bucket;
-import com.google.api.services.storage.model.BucketAccessControl;
-import com.google.api.services.storage.model.HmacKey;
-import com.google.api.services.storage.model.HmacKeyMetadata;
-import com.google.api.services.storage.model.Notification;
-import com.google.api.services.storage.model.ObjectAccessControl;
-import com.google.api.services.storage.model.Policy;
import com.google.api.services.storage.model.ServiceAccount;
import com.google.api.services.storage.model.StorageObject;
-import com.google.api.services.storage.model.TestIamPermissionsResponse;
import com.google.cloud.Tuple;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageException;
-import com.google.cloud.storage.spi.v1.RpcBatch;
import com.google.cloud.storage.spi.v1.StorageRpc;
+import com.google.cloud.storage.testing.StorageRpcTestBase;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -75,7 +68,7 @@
*
*/
@NotThreadSafe
-class FakeStorageRpc implements StorageRpc {
+class FakeStorageRpc extends StorageRpcTestBase {
// fullname -> metadata
Map metadata = new HashMap<>();
@@ -97,11 +90,6 @@ void reset() {
contents = new HashMap<>();
}
- @Override
- public Bucket create(Bucket bucket, Map