From 20642141fd9c88e33769e47b077f7175cd3eba85 Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Wed, 27 Sep 2023 13:29:07 -0400 Subject: [PATCH 1/2] chore: deleting outdated files in favor of https://github.com/googleapis/google-cloud-java/tree/main/java-core --- .github/CODEOWNERS | 13 - .github/ISSUE_TEMPLATE/bug_report.md | 56 - .github/ISSUE_TEMPLATE/feature_request.md | 26 - .github/ISSUE_TEMPLATE/support_request.md | 7 - .github/PULL_REQUEST_TEMPLATE.md | 5 - .github/auto-label.yaml | 15 - .github/blunderbuss.yml | 7 - .github/generated-files-bot.yml | 12 - .github/snippet-bot.yml | 0 .github/sync-repo-settings.yaml | 98 -- .github/trusted-contribution.yml | 3 - .github/workflows/approve-readme.yaml | 69 - .github/workflows/auto-release.yaml | 103 -- .github/workflows/ci.yaml | 89 -- .github/workflows/downstream.yaml | 159 -- .gitignore | 15 - .kokoro/build.bat | 18 - .kokoro/build.sh | 134 -- .kokoro/coerce_logs.sh | 37 - .kokoro/common.cfg | 13 - .kokoro/common.sh | 60 - .kokoro/continuous/common.cfg | 25 - .kokoro/continuous/java8.cfg | 12 - .kokoro/continuous/propose_release.sh | 29 - .kokoro/dependencies.sh | 59 - .kokoro/downstream-client-library-check.sh | 101 -- .kokoro/nightly/common.cfg | 25 - .kokoro/nightly/integration.cfg | 37 - .kokoro/nightly/java11-integration.cfg | 37 - .kokoro/nightly/java11.cfg | 7 - .kokoro/nightly/java7.cfg | 7 - .kokoro/nightly/java8-osx.cfg | 3 - .kokoro/nightly/java8-win.cfg | 3 - .kokoro/nightly/java8.cfg | 12 - .kokoro/nightly/samples.cfg | 38 - .kokoro/populate-secrets.sh | 43 - .kokoro/presubmit/clirr.cfg | 13 - .kokoro/presubmit/common.cfg | 34 - .kokoro/presubmit/dependencies.cfg | 12 - .kokoro/presubmit/graalvm-native-17.cfg | 33 - .kokoro/presubmit/graalvm-native.cfg | 33 - .kokoro/presubmit/integration.cfg | 33 - .kokoro/presubmit/java11.cfg | 7 - .kokoro/presubmit/java7.cfg | 7 - .kokoro/presubmit/java8-osx.cfg | 3 - .kokoro/presubmit/java8-win.cfg | 3 - .kokoro/presubmit/java8.cfg | 12 - .kokoro/presubmit/linkage-monitor.cfg | 12 - .kokoro/presubmit/lint.cfg | 13 - .kokoro/presubmit/samples.cfg | 33 - .kokoro/readme.sh | 45 - .kokoro/release/bump_snapshot.cfg | 53 - .kokoro/release/bump_snapshot.sh | 30 - .kokoro/release/common.cfg | 49 - .kokoro/release/common.sh | 50 - .kokoro/release/drop.cfg | 6 - .kokoro/release/drop.sh | 32 - .kokoro/release/promote.cfg | 6 - .kokoro/release/promote.sh | 34 - .kokoro/release/publish_javadoc.cfg | 23 - .kokoro/release/publish_javadoc.sh | 53 - .kokoro/release/publish_javadoc11.cfg | 30 - .kokoro/release/publish_javadoc11.sh | 63 - .kokoro/release/snapshot.cfg | 6 - .kokoro/release/snapshot.sh | 33 - .kokoro/release/stage.cfg | 19 - .kokoro/release/stage.sh | 47 - .kokoro/requirements.in | 6 - .kokoro/requirements.txt | 408 ------ .kokoro/trampoline.sh | 26 - .repo-metadata.json | 10 - CHANGELOG.md | 1277 ----------------- codecov.yaml | 4 - google-cloud-core-bom/pom.xml | 92 -- google-cloud-core-grpc/pom.xml | 65 - .../cloud/grpc/BaseGrpcServiceException.java | 85 -- .../cloud/grpc/GrpcTransportOptions.java | 206 --- .../cloud/grpc/LogExceptionRunnable.java | 58 - .../cloud/grpc/SharedResourceHolder.java | 184 --- .../grpc/BaseGrpcServiceExceptionTest.java | 106 -- .../cloud/grpc/GrpcTransportOptionsTest.java | 70 - .../cloud/grpc/SharedResourceHolderTest.java | 292 ---- google-cloud-core-http/pom.xml | 92 -- .../cloud/http/BaseHttpServiceException.java | 166 --- .../google/cloud/http/CensusHttpModule.java | 156 -- .../cloud/http/HttpTransportOptions.java | 230 --- .../http/BaseHttpServiceExceptionTest.java | 165 --- .../cloud/http/CensusHttpModuleTest.java | 161 --- .../cloud/http/HttpTransportOptionsTest.java | 81 -- google-cloud-core/EnableAutoValue.txt | 0 .../clirr-ignored-differences.xml | 15 - google-cloud-core/pom.xml | 100 -- .../java/com/google/cloud/AsyncPageImpl.java | 87 -- .../java/com/google/cloud/BaseService.java | 68 - .../google/cloud/BaseServiceException.java | 343 ----- .../com/google/cloud/BaseWriteChannel.java | 332 ----- .../java/com/google/cloud/BatchResult.java | 103 -- .../main/java/com/google/cloud/Binding.java | 112 -- .../main/java/com/google/cloud/ByteArray.java | 153 -- .../main/java/com/google/cloud/Condition.java | 68 - .../src/main/java/com/google/cloud/Date.java | 159 -- .../com/google/cloud/ExceptionHandler.java | 296 ---- .../java/com/google/cloud/FieldSelector.java | 127 -- .../java/com/google/cloud/GcpLaunchStage.java | 75 - .../main/java/com/google/cloud/Identity.java | 268 ---- .../java/com/google/cloud/MetadataConfig.java | 88 -- .../com/google/cloud/MonitoredResource.java | 165 --- .../cloud/MonitoredResourceDescriptor.java | 342 ----- .../java/com/google/cloud/NoCredentials.java | 50 - .../main/java/com/google/cloud/PageImpl.java | 156 -- .../com/google/cloud/PlatformInformation.java | 34 - .../main/java/com/google/cloud/Policy.java | 455 ------ .../java/com/google/cloud/ReadChannel.java | 108 -- .../java/com/google/cloud/Restorable.java | 49 - .../com/google/cloud/RestorableState.java | 32 - .../java/com/google/cloud/RetryHelper.java | 88 -- .../java/com/google/cloud/RetryOption.java | 150 -- .../src/main/java/com/google/cloud/Role.java | 116 -- .../main/java/com/google/cloud/Service.java | 27 - .../com/google/cloud/ServiceDefaults.java | 30 - .../java/com/google/cloud/ServiceFactory.java | 32 - .../java/com/google/cloud/ServiceOptions.java | 770 ---------- .../java/com/google/cloud/ServiceRpc.java | 19 - .../java/com/google/cloud/StringEnumType.java | 90 -- .../com/google/cloud/StringEnumValue.java | 65 - .../main/java/com/google/cloud/Timestamp.java | 239 --- .../com/google/cloud/TransportOptions.java | 21 - .../src/main/java/com/google/cloud/Tuple.java | 40 - .../java/com/google/cloud/WriteChannel.java | 47 - .../java/com/google/cloud/package-info.java | 18 - .../google/cloud/spi/ServiceRpcFactory.java | 30 - .../cloud/testing/BaseEmulatorHelper.java | 473 ------ .../testing/BlockingProcessStreamReader.java | 140 -- .../google/cloud/testing/CommandWrapper.java | 99 -- .../com/google/cloud/testing/Version.java | 89 -- .../com/google/cloud/AsyncPageImplTest.java | 95 -- .../google/cloud/BaseSerializationTest.java | 81 -- .../cloud/BaseServiceExceptionTest.java | 157 -- .../google/cloud/BaseWriteChannelTest.java | 144 -- .../com/google/cloud/BatchResultTest.java | 116 -- .../java/com/google/cloud/ByteArrayTest.java | 114 -- .../java/com/google/cloud/ConditionTest.java | 40 - .../test/java/com/google/cloud/DateTest.java | 172 --- .../google/cloud/ExceptionHandlerTest.java | 210 --- .../google/cloud/FieldSelectorHelperTest.java | 103 -- .../java/com/google/cloud/IdentityTest.java | 161 --- .../MonitoredResourceDescriptorTest.java | 123 -- .../google/cloud/MonitoredResourceTest.java | 96 -- .../java/com/google/cloud/PageImplTest.java | 64 - .../java/com/google/cloud/PolicyTest.java | 228 --- .../java/com/google/cloud/PolicyV3Test.java | 281 ---- .../com/google/cloud/RetryOptionTest.java | 130 -- .../test/java/com/google/cloud/RoleTest.java | 68 - .../com/google/cloud/SerializationTest.java | 100 -- .../com/google/cloud/ServiceOptionsTest.java | 496 ------- .../java/com/google/cloud/StringEnumTest.java | 128 -- .../java/com/google/cloud/TimestampTest.java | 306 ---- .../cloud/testing/BaseEmulatorHelperTest.java | 185 --- .../BlockingProcessStreamReaderTest.java | 99 -- .../cloud/testing/CommandWrapperTest.java | 120 -- .../com/google/cloud/testing/VersionTest.java | 103 -- .../testing/junit4/MultipleAttemptsRule.java | 107 -- .../testing/junit4/StdErrCaptureRule.java | 56 - .../testing/junit4/StdOutCaptureRule.java | 56 - .../cloud/testing/junit4/StdXCaptureRule.java | 188 --- .../testing/junit4/StdXCaptureRuleTest.java | 76 - .../tests/MultipleAttemptsRuleTest.java | 87 -- .../junit4/tests/StdErrCaptureRuleTest.java | 36 - .../junit4/tests/StdOutCaptureRuleTest.java | 36 - java.header | 15 - license-checks.xml | 10 - pom.xml | 396 ----- renovate.json | 76 - versions.txt | 4 - 174 files changed, 17575 deletions(-) delete mode 100644 .github/CODEOWNERS delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/support_request.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/auto-label.yaml delete mode 100644 .github/blunderbuss.yml delete mode 100644 .github/generated-files-bot.yml delete mode 100644 .github/snippet-bot.yml delete mode 100644 .github/sync-repo-settings.yaml delete mode 100644 .github/trusted-contribution.yml delete mode 100644 .github/workflows/approve-readme.yaml delete mode 100644 .github/workflows/auto-release.yaml delete mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/downstream.yaml delete mode 100644 .gitignore delete mode 100644 .kokoro/build.bat delete mode 100755 .kokoro/build.sh delete mode 100755 .kokoro/coerce_logs.sh delete mode 100644 .kokoro/common.cfg delete mode 100644 .kokoro/common.sh delete mode 100644 .kokoro/continuous/common.cfg delete mode 100644 .kokoro/continuous/java8.cfg delete mode 100755 .kokoro/continuous/propose_release.sh delete mode 100755 .kokoro/dependencies.sh delete mode 100755 .kokoro/downstream-client-library-check.sh delete mode 100644 .kokoro/nightly/common.cfg delete mode 100644 .kokoro/nightly/integration.cfg delete mode 100644 .kokoro/nightly/java11-integration.cfg delete mode 100644 .kokoro/nightly/java11.cfg delete mode 100644 .kokoro/nightly/java7.cfg delete mode 100644 .kokoro/nightly/java8-osx.cfg delete mode 100644 .kokoro/nightly/java8-win.cfg delete mode 100644 .kokoro/nightly/java8.cfg delete mode 100644 .kokoro/nightly/samples.cfg delete mode 100755 .kokoro/populate-secrets.sh delete mode 100644 .kokoro/presubmit/clirr.cfg delete mode 100644 .kokoro/presubmit/common.cfg delete mode 100644 .kokoro/presubmit/dependencies.cfg delete mode 100644 .kokoro/presubmit/graalvm-native-17.cfg delete mode 100644 .kokoro/presubmit/graalvm-native.cfg delete mode 100644 .kokoro/presubmit/integration.cfg delete mode 100644 .kokoro/presubmit/java11.cfg delete mode 100644 .kokoro/presubmit/java7.cfg delete mode 100644 .kokoro/presubmit/java8-osx.cfg delete mode 100644 .kokoro/presubmit/java8-win.cfg delete mode 100644 .kokoro/presubmit/java8.cfg delete mode 100644 .kokoro/presubmit/linkage-monitor.cfg delete mode 100644 .kokoro/presubmit/lint.cfg delete mode 100644 .kokoro/presubmit/samples.cfg delete mode 100755 .kokoro/readme.sh delete mode 100644 .kokoro/release/bump_snapshot.cfg delete mode 100755 .kokoro/release/bump_snapshot.sh delete mode 100644 .kokoro/release/common.cfg delete mode 100755 .kokoro/release/common.sh delete mode 100644 .kokoro/release/drop.cfg delete mode 100755 .kokoro/release/drop.sh delete mode 100644 .kokoro/release/promote.cfg delete mode 100755 .kokoro/release/promote.sh delete mode 100644 .kokoro/release/publish_javadoc.cfg delete mode 100755 .kokoro/release/publish_javadoc.sh delete mode 100644 .kokoro/release/publish_javadoc11.cfg delete mode 100755 .kokoro/release/publish_javadoc11.sh delete mode 100644 .kokoro/release/snapshot.cfg delete mode 100755 .kokoro/release/snapshot.sh delete mode 100644 .kokoro/release/stage.cfg delete mode 100755 .kokoro/release/stage.sh delete mode 100644 .kokoro/requirements.in delete mode 100644 .kokoro/requirements.txt delete mode 100644 .kokoro/trampoline.sh delete mode 100644 .repo-metadata.json delete mode 100644 CHANGELOG.md delete mode 100644 codecov.yaml delete mode 100644 google-cloud-core-bom/pom.xml delete mode 100644 google-cloud-core-grpc/pom.xml delete mode 100644 google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/BaseGrpcServiceException.java delete mode 100644 google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/GrpcTransportOptions.java delete mode 100644 google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/LogExceptionRunnable.java delete mode 100644 google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/SharedResourceHolder.java delete mode 100644 google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/BaseGrpcServiceExceptionTest.java delete mode 100644 google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/GrpcTransportOptionsTest.java delete mode 100644 google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/SharedResourceHolderTest.java delete mode 100644 google-cloud-core-http/pom.xml delete mode 100644 google-cloud-core-http/src/main/java/com/google/cloud/http/BaseHttpServiceException.java delete mode 100644 google-cloud-core-http/src/main/java/com/google/cloud/http/CensusHttpModule.java delete mode 100644 google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java delete mode 100644 google-cloud-core-http/src/test/java/com/google/cloud/http/BaseHttpServiceExceptionTest.java delete mode 100644 google-cloud-core-http/src/test/java/com/google/cloud/http/CensusHttpModuleTest.java delete mode 100644 google-cloud-core-http/src/test/java/com/google/cloud/http/HttpTransportOptionsTest.java delete mode 100644 google-cloud-core/EnableAutoValue.txt delete mode 100644 google-cloud-core/clirr-ignored-differences.xml delete mode 100644 google-cloud-core/pom.xml delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/AsyncPageImpl.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/BaseService.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/BatchResult.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Binding.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ByteArray.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Condition.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Date.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ExceptionHandler.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/FieldSelector.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/GcpLaunchStage.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Identity.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/NoCredentials.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/PageImpl.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/PlatformInformation.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Policy.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ReadChannel.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Restorable.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/RestorableState.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/RetryHelper.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/RetryOption.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Role.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Service.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ServiceDefaults.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ServiceFactory.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/ServiceRpc.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/StringEnumType.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/StringEnumValue.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Timestamp.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/TransportOptions.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/Tuple.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/WriteChannel.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/package-info.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/testing/CommandWrapper.java delete mode 100644 google-cloud-core/src/main/java/com/google/cloud/testing/Version.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/AsyncPageImplTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/BaseSerializationTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/BatchResultTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/ByteArrayTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/ConditionTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/DateTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/IdentityTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/PageImplTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/PolicyTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/PolicyV3Test.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/RetryOptionTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/RoleTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/SerializationTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/ServiceOptionsTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/StringEnumTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/TimestampTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/BaseEmulatorHelperTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/CommandWrapperTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/VersionTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/MultipleAttemptsRule.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdErrCaptureRule.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdOutCaptureRule.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRule.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRuleTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/MultipleAttemptsRuleTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdErrCaptureRuleTest.java delete mode 100644 google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdOutCaptureRuleTest.java delete mode 100644 java.header delete mode 100644 license-checks.xml delete mode 100644 pom.xml delete mode 100644 renovate.json delete mode 100644 versions.txt diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index db2d8ad174..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,13 +0,0 @@ -# Code owners file. -# This file controls who is tagged for review for any given pull request. - -# For syntax help see: -# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax - -* @googleapis/yoshi-java - -# The java-samples-reviewers team is the default owner for samples changes -samples/**/*.java @googleapis/java-samples-reviewers - -# Generated snippets should not be owned by samples reviewers -samples/snippets/generated/ @googleapis/yoshi-java diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 9263de11db..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -:bus: In January 2023, this library has moved to -[google-cloud-java/java-core]( -https://github.com/googleapis/google-cloud-java/tree/main/java-core). -This repository will be archived in the future. - -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - -Please run down the following list and make sure you've tried the usual "quick fixes": - - - Search the issues already opened: https://github.com/googleapis/java-core/issues - - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform - -If you are still having issues, please include as much information as possible: - -#### Environment details - -1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). - General, Core, and Other are also allowed as types -2. OS type and version: -3. Java version: -4. version(s): - -#### Steps to reproduce - - 1. ? - 2. ? - -#### Code example - -```java -// example -``` - -#### Stack trace -``` -Any relevant stacktrace here. -``` - -#### External references such as API reference guides - -- ? - -#### Any additional information below - - -Following these steps guarantees the quickest resolution possible. - -Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index ef90e1ce24..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this library - ---- - -:bus: In January 2023, this library has moved to -[google-cloud-java/java-core]( -https://github.com/googleapis/google-cloud-java/tree/main/java-core). -This repository will be archived in the future. - -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - -**Is your feature request related to a problem? Please describe.** -What the problem is. Example: I'm always frustrated when [...] - -**Describe the solution you'd like** -What you want to happen. - -**Describe alternatives you've considered** -Any alternative solutions or features you've considered. - -**Additional context** -Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md deleted file mode 100644 index 9958690321..0000000000 --- a/.github/ISSUE_TEMPLATE/support_request.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Support request -about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. - ---- - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 8631a37e01..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,5 +0,0 @@ -:bus: In January 2023, this library has moved to -[google-cloud-java/java-core]( -https://github.com/googleapis/google-cloud-java/tree/main/java-core). -This repository will be archived in the future. - diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml deleted file mode 100644 index 4caef688b7..0000000000 --- a/.github/auto-label.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2021 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. -requestsize: - enabled: true diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml deleted file mode 100644 index 2176b05432..0000000000 --- a/.github/blunderbuss.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration for the Blunderbuss GitHub app. For more info see -# https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss -assign_prs_by: -- labels: - - samples - to: - - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml deleted file mode 100644 index c644a24e11..0000000000 --- a/.github/generated-files-bot.yml +++ /dev/null @@ -1,12 +0,0 @@ -externalManifests: -- type: json - file: 'synth.metadata' - jsonpath: '$.generatedFiles[*]' -- type: json - file: '.github/readme/synth.metadata/synth.metadata' - jsonpath: '$.generatedFiles[*]' -ignoreAuthors: -- 'renovate-bot' -- 'yoshi-automation' -- 'release-please[bot]' -- 'gcf-owl-bot[bot]' diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml deleted file mode 100644 index d4bb66b16c..0000000000 --- a/.github/sync-repo-settings.yaml +++ /dev/null @@ -1,98 +0,0 @@ -rebaseMergeAllowed: false -squashMergeAllowed: true -mergeCommitAllowed: false -branchProtectionRules: - - pattern: main - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - lint - - units (8) - - units (11) - - cla/google - - OwlBot Post Processor - - pattern: java7 - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - clirr - - units (7) - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor - - pattern: 2.1.x - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - clirr - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor - - pattern: 2.2.x - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - clirr - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor - - pattern: 2.6.x - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - clirr - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor - - pattern: 2.8.x - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - clirr - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor -permissionRules: - - team: yoshi-admins - permission: admin - - team: yoshi-java-admins - permission: admin - - team: yoshi-java - permission: push diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml deleted file mode 100644 index a0ba1f7d90..0000000000 --- a/.github/trusted-contribution.yml +++ /dev/null @@ -1,3 +0,0 @@ -trustedContributors: -- renovate-bot -- gcf-owl-bot[bot] diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml deleted file mode 100644 index f5fc7d5169..0000000000 --- a/.github/workflows/approve-readme.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: auto-merge-readme -jobs: - approve: - runs-on: ubuntu-latest - if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} - script: | - // only approve PRs from yoshi-automation - if (context.payload.pull_request.user.login !== "yoshi-automation") { - return; - } - - // only approve PRs like "chore: release " - if (!context.payload.pull_request.title === "chore: regenerate README") { - return; - } - - // only approve PRs with README.md and synth.metadata changes - const files = new Set( - ( - await github.paginate( - github.pulls.listFiles.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - }) - ) - ).map(file => file.filename) - ); - if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { - return; - } - - // approve README regeneration PR - await github.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Rubber stamped PR!', - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }); - - // attach automerge label - await github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['automerge'] - }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml deleted file mode 100644 index 7a106d007e..0000000000 --- a/.github/workflows/auto-release.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: auto-release -jobs: - approve: - runs-on: ubuntu-latest - if: contains(github.head_ref, 'release-please') - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} - debug: true - script: | - // only approve PRs from release-please[bot] - if (context.payload.pull_request.user.login !== "release-please[bot]") { - return; - } - - // only approve PRs like "chore(main): release " - if ( !context.payload.pull_request.title.startsWith("chore(main): release") ) { - return; - } - - // only approve PRs with pom.xml and versions.txt changes - const filesPromise = github.rest.pulls.listFiles.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - }); - const changed_files = await github.paginate(filesPromise) - - if ( changed_files.length < 1 ) { - console.log( "Not proceeding since PR is empty!" ) - return; - } - - if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { - console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) - return; - } - - // trigger auto-release when - // 1) it is a SNAPSHOT release (auto-generated post regular release) - // 2) there are dependency updates only - // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) - if ( - context.payload.pull_request.body.includes("Fix") || - context.payload.pull_request.body.includes("Build") || - context.payload.pull_request.body.includes("Documentation") || - context.payload.pull_request.body.includes("BREAKING CHANGES") || - context.payload.pull_request.body.includes("Features") - ) { - console.log( "Not auto-releasing since it is not a dependency-update-only release." ); - return; - } - - const promise = github.rest.pulls.list.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open' - }); - const open_pulls = await github.paginate(promise) - - if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { - for ( const pull of open_pulls ) { - if ( pull.title.startsWith("deps: update dependency") ) { - console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); - return; - } - } - } - - // approve release PR - await github.rest.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Rubber stamped release!', - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }); - - // attach kokoro:force-run and automerge labels - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['kokoro:force-run', 'automerge'] - }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index e3bb26e377..0000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - push: - branches: - - main - pull_request: -name: ci -jobs: - units: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: [8, 11, 17] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: test - windows: - runs-on: windows-latest - steps: - - name: Support longpaths - run: git config --system core.longpaths true - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - run: java -version - - run: .kokoro/build.bat - env: - JOB_TYPE: test - dependencies: - runs-on: ubuntu-latest - strategy: - matrix: - java: [8, 11, 17] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/dependencies.sh - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 11 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: lint - clirr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: clirr diff --git a/.github/workflows/downstream.yaml b/.github/workflows/downstream.yaml deleted file mode 100644 index 31c4429a26..0000000000 --- a/.github/workflows/downstream.yaml +++ /dev/null @@ -1,159 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: - types: [ labeled ] - branches: - - main -name: downstream -jobs: - dependencies: - if: ${{ github.event.label.name == 'downstream-check:run' }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: [17] - repo: - # This list needs to be updated manually until an automated solution is in place. - - accessapproval - - accesscontextmanager - - aiplatform - - analytics-admin - - analytics-data - - api-gateway - - apigee-connect - - appengine-admin - - area120-tables - - artifact-registry - - asset - - assured-workloads - - automl - - bigquery - - bigqueryconnection - - bigquerydatatransfer - - bigquerymigration - - bigqueryreservation - - bigtable - - billing - - billingbudgets - - binary-authorization - - channel - - cloudbuild - - compute - - contact-center-insights - - container - - containeranalysis - - data-fusion - - datacatalog - - dataflow - - datalabeling - - dataproc - - dataproc-metastore - - datastore - - datastream - - debugger-client - - deploy - - dialogflow - - dialogflow-cx - - dlp - - dms - - dns - - document-ai - - domains - - errorreporting - - essential-contacts - - eventarc - - filestore - - firestore - - functions - - game-servers - - gke-connect-gateway - - gkehub - - gsuite-addons - - iam-admin - - iamcredentials - - iot - - kms - - language - - life-sciences - - logging - - logging-logback - - managed-identities - - mediatranslation - - memcache - - monitoring - - monitoring-dashboards - - network-management - - network-security - - networkconnectivity - - notebooks - - orchestration-airflow - - orgpolicy - - os-config - - os-login - - phishingprotection - - policy-troubleshooter - - private-catalog - - profiler - - pubsublite - - recaptchaenterprise - - recommendations-ai - - recommender - - redis - - resource-settings - - resourcemanager - - retail - - scheduler - - secretmanager - - security-private-ca - - securitycenter - - securitycenter-settings - - service-control - - service-management - - service-usage - - servicedirectory - - shell - - spanner - - spanner-jdbc - - speech - - storage - - storage-nio - - storage-transfer - - talent - - tasks - - texttospeech - - tpu - - trace - - translate - - video-intelligence - - video-transcoder - - vision - - vpcaccess - - webrisk - - websecurityscanner - - workflow-executions - - workflows - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: sudo apt-get update -y - - run: sudo apt-get install libxml2-utils - - run: .kokoro/downstream-client-library-check.sh google-cloud-core-bom ${{matrix.repo}} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fadd6afc2d..0000000000 --- a/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# Maven -target/ - -# Eclipse -.classpath -.project -.settings - -# Intellij -*.iml -.idea/ - -# python utilities -*.pyc -__pycache__ diff --git a/.kokoro/build.bat b/.kokoro/build.bat deleted file mode 100644 index 067cf4a4c4..0000000000 --- a/.kokoro/build.bat +++ /dev/null @@ -1,18 +0,0 @@ -:: Copyright 2022 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. -:: Github action job to test core java library features on -:: downstream client libraries before they are released. -:: See documentation in type-shell-output.bat - -"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh deleted file mode 100755 index 927819df78..0000000000 --- a/.kokoro/build.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 - -## Get the directory of the build script -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -## cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -# include common functions -source ${scriptDir}/common.sh - -# Print out Maven & Java version -mvn -version -echo ${JOB_TYPE} - -# attempt to install 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn install -B -V -ntp \ - -DskipTests=true \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dmaven.javadoc.skip=true \ - -Dgcloud.download.skip=true \ - -T 1C - -# if GOOGLE_APPLICATION_CREDENTIALS 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_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) -fi - -RETURN_CODE=0 -set +e - -case ${JOB_TYPE} in -test) - mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; -lint) - mvn com.coveo:fmt-maven-plugin:check -B -ntp - RETURN_CODE=$? - ;; -javadoc) - mvn javadoc:javadoc javadoc:test-javadoc -B -ntp - RETURN_CODE=$? - ;; -integration) - mvn -B ${INTEGRATION_TEST_ARGS} \ - -ntp \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - RETURN_CODE=$? - ;; -graalvm) - # Run Unit and Integration Tests with Native Image - mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test - RETURN_CODE=$? - ;; -graalvm17) - # Run Unit and Integration Tests with Native Image - mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test - RETURN_CODE=$? - ;; -samples) - SAMPLES_DIR=samples - # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. - if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] - then - SAMPLES_DIR=samples/snapshot - fi - - if [[ -f ${SAMPLES_DIR}/pom.xml ]] - then - for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do - [[ -f "$FILE" ]] || continue - source "$FILE" - done - - pushd ${SAMPLES_DIR} - mvn -B \ - -ntp \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - RETURN_CODE=$? - popd - else - echo "no sample pom.xml found - skipping sample tests" - fi - ;; -clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check - RETURN_CODE=$? - ;; -*) - ;; -esac - -if [ "${REPORT_COVERAGE}" == "true" ] -then - bash ${KOKORO_GFILE_DIR}/codecov.sh -fi - -# fix output location of logs -bash .kokoro/coerce_logs.sh - -if [[ "${ENABLE_FLAKYBOT}" == "true" ]] -then - chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot - ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-core -fi - -echo "exiting with ${RETURN_CODE}" -exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh deleted file mode 100755 index 46edbf7f2f..0000000000 --- a/.kokoro/coerce_logs.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright 2019 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. - -# This script finds and moves sponge logs so that they can be found by placer -# and are not flagged as flaky by sponge. - -set -eo pipefail - -## Get the directory of the build script -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -## cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -job=$(basename ${KOKORO_JOB_NAME}) - -echo "coercing sponge logs..." -for xml in `find . -name *-sponge_log.xml` -do - class=$(basename ${xml} | cut -d- -f2) - dir=$(dirname ${xml})/${job}/${class} - text=$(dirname ${xml})/${class}-sponge_log.txt - mkdir -p ${dir} - mv ${xml} ${dir}/sponge_log.xml - mv ${text} ${dir}/sponge_log.txt -done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg deleted file mode 100644 index 054c30c8f7..0000000000 --- a/.kokoro/common.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# All builds use the trampoline script to run in docker. -build_file: "java-core/.kokoro/trampoline.sh" - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/build.sh" -} diff --git a/.kokoro/common.sh b/.kokoro/common.sh deleted file mode 100644 index f8f957af11..0000000000 --- a/.kokoro/common.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/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. - -function retry_with_backoff { - attempts_left=$1 - sleep_seconds=$2 - shift 2 - command=$@ - - - # store current flag state - flags=$- - - # allow a failures to continue - set +e - ${command} - exit_code=$? - - # restore "e" flag - if [[ ${flags} =~ e ]] - then set -e - else set +e - fi - - if [[ $exit_code == 0 ]] - then - return 0 - fi - - # failure - if [[ ${attempts_left} > 0 ]] - then - echo "failure (${exit_code}), sleeping ${sleep_seconds}..." - sleep ${sleep_seconds} - new_attempts=$((${attempts_left} - 1)) - new_sleep=$((${sleep_seconds} * 2)) - retry_with_backoff ${new_attempts} ${new_sleep} ${command} - fi - - return $exit_code -} - -## Helper functionss -function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } -function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } - -## Helper comment to trigger updated repo dependency release \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg deleted file mode 100644 index 0ce89acac3..0000000000 --- a/.kokoro/continuous/common.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - regex: "**/*sponge_log.txt" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-core/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg deleted file mode 100644 index 495cc7bacd..0000000000 --- a/.kokoro/continuous/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "REPORT_COVERAGE" - value: "true" -} diff --git a/.kokoro/continuous/propose_release.sh b/.kokoro/continuous/propose_release.sh deleted file mode 100755 index 1fd8acb1bf..0000000000 --- a/.kokoro/continuous/propose_release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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 -# -# https://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 - -export NPM_CONFIG_PREFIX=/home/node/.npm-global - -if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then - # Groom the release PR as new commits are merged. - npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ - --repo-url=googleapis/java-core \ - --package-name="google-cloud-core" \ - --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ - --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ - --release-type=java-yoshi -fi diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh deleted file mode 100755 index bd8960246f..0000000000 --- a/.kokoro/dependencies.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 -shopt -s nullglob - -## Get the directory of the build script -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -## cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -# include common functions -source ${scriptDir}/common.sh - -# Print out Java -java -version -echo $JOB_TYPE - -function determineMavenOpts() { - local javaVersion=$( - # filter down to the version line, then pull out the version between quotes, - # then trim the version number down to its minimal number (removing any - # update or suffix number). - java -version 2>&1 | grep "version" \ - | sed -E 's/^.*"(.*?)".*$/\1/g' \ - | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' - ) - - if [[ $javaVersion == 17* ]] - then - # MaxPermSize is no longer supported as of jdk 17 - echo -n "-Xmx1024m" - else - echo -n "-Xmx1024m -XX:MaxPermSize=128m" - fi -} - -export MAVEN_OPTS=$(determineMavenOpts) - -# this should run maven enforcer -retry_with_backoff 3 10 \ - mvn install -B -V -ntp \ - -DskipTests=true \ - -Dmaven.javadoc.skip=true \ - -Dclirr.skip=true - -mvn -B dependency:analyze -DfailOnWarning=true diff --git a/.kokoro/downstream-client-library-check.sh b/.kokoro/downstream-client-library-check.sh deleted file mode 100755 index c1e13911b5..0000000000 --- a/.kokoro/downstream-client-library-check.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -# Copyright 2022 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 -# Display commands being run. -set -x - -CORE_LIBRARY_ARTIFACT=$1 -CLIENT_LIBRARY=$2 -## Get the directory of the build script -scriptDir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" -## cd to the parent directory, i.e. the root of the git repo -cd "${scriptDir}"/.. - -# Make java core library artifacts available for 'mvn install' at the bottom -mvn verify install -B -V -ntp -fae \ --DskipTests=true \ --Dmaven.javadoc.skip=true \ --Dgcloud.download.skip=true \ --Denforcer.skip=true - -# Namespace (xmlns) prevents xmllint from specifying tag names in XPath -CORE_VERSION=$(sed -e 's/xmlns=".*"//' pom.xml | xmllint --xpath '/project/version/text()' -) - -if [ -z "${CORE_VERSION}" ]; then - echo "Version is not found in ${CORE_VERSION_POM}" - exit 1 -fi -echo "Version: ${CORE_VERSION}" - -# Round 1 -# Check this java core library against HEAD of java-shared dependencies - -git clone "https://github.com/googleapis/java-shared-dependencies.git" --depth=1 -pushd java-shared-dependencies/first-party-dependencies - -# replace version -xmllint --shell pom.xml << EOF -setns x=http://maven.apache.org/POM/4.0.0 -cd .//x:artifactId[text()="${CORE_LIBRARY_ARTIFACT}"] -cd ../x:version -set ${CORE_VERSION} -save pom.xml -EOF - -# run dependencies script -cd .. - -mvn verify install -B -V -ntp -fae \ --DskipTests=true \ --Dmaven.javadoc.skip=true \ --Dgcloud.download.skip=true \ --Denforcer.skip=true - -# Namespace (xmlns) prevents xmllint from specifying tag names in XPath -SHARED_DEPS_VERSION=$(sed -e 's/xmlns=".*"//' pom.xml | xmllint --xpath '/project/version/text()' -) - -if [ -z "${SHARED_DEPS_VERSION}" ]; then - echo "Version is not found in ${SHARED_DEPS_VERSION_POM}" - exit 1 -fi - -# Round 2 - -# Check this BOM against java client libraries -git clone "https://github.com/googleapis/java-${CLIENT_LIBRARY}.git" --depth=1 -pushd java-"${CLIENT_LIBRARY}" - -if [[ $CLIENT_LIBRARY == "bigtable" ]]; then - pushd google-cloud-bigtable-deps-bom -fi - -# replace version -xmllint --shell pom.xml << EOF -setns x=http://maven.apache.org/POM/4.0.0 -cd .//x:artifactId[text()="google-cloud-shared-dependencies"] -cd ../x:version -set ${SHARED_DEPS_VERSION} -save pom.xml -EOF - -if [[ $CLIENT_LIBRARY == "bigtable" ]]; then - popd -fi - -mvn verify install -B -V -ntp -fae \ --Dmaven.javadoc.skip=true \ --Dgcloud.download.skip=true \ --Denforcer.skip=true diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg deleted file mode 100644 index 0ce89acac3..0000000000 --- a/.kokoro/nightly/common.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - regex: "**/*sponge_log.txt" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-core/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg deleted file mode 100644 index bd0297a331..0000000000 --- a/.kokoro/nightly/integration.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "integration" -} -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "false" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/nightly/java11-integration.cfg b/.kokoro/nightly/java11-integration.cfg deleted file mode 100644 index dc51b65e88..0000000000 --- a/.kokoro/nightly/java11-integration.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/java11014" -} - -env_vars: { - key: "JOB_TYPE" - value: "integration" -} -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "false" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg deleted file mode 100644 index 709f2b4c73..0000000000 --- a/.kokoro/nightly/java11.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg deleted file mode 100644 index cb24f44eea..0000000000 --- a/.kokoro/nightly/java7.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java7" -} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg deleted file mode 100644 index 8b617e2594..0000000000 --- a/.kokoro/nightly/java8-osx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-core/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg deleted file mode 100644 index 1a6311a420..0000000000 --- a/.kokoro/nightly/java8-win.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-core/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg deleted file mode 100644 index 495cc7bacd..0000000000 --- a/.kokoro/nightly/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "REPORT_COVERAGE" - value: "true" -} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg deleted file mode 100644 index fee6a83813..0000000000 --- a/.kokoro/nightly/samples.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "samples" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-docs-samples-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "false" -} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh deleted file mode 100755 index f52514257e..0000000000 --- a/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/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/clirr.cfg b/.kokoro/presubmit/clirr.cfg deleted file mode 100644 index ec572442e2..0000000000 --- a/.kokoro/presubmit/clirr.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. - -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "clirr" -} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg deleted file mode 100644 index dd8a9f7668..0000000000 --- a/.kokoro/presubmit/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - regex: "**/*sponge_log.txt" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-core/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "dpebot_codecov_token" - } - } -} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg deleted file mode 100644 index 895832a928..0000000000 --- a/.kokoro/presubmit/dependencies.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/dependencies.sh" -} diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg deleted file mode 100644 index e20330c3ca..0000000000 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17:22.3.0" -} - -env_vars: { - key: "JOB_TYPE" - value: "graalvm17" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg deleted file mode 100644 index 0fd6ba2fa0..0000000000 --- a/.kokoro/presubmit/graalvm-native.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/graalvm:22.3.0" -} - -env_vars: { - key: "JOB_TYPE" - value: "graalvm" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg deleted file mode 100644 index dded67a9d5..0000000000 --- a/.kokoro/presubmit/integration.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "integration" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg deleted file mode 100644 index 709f2b4c73..0000000000 --- a/.kokoro/presubmit/java11.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg deleted file mode 100644 index cb24f44eea..0000000000 --- a/.kokoro/presubmit/java7.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java7" -} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg deleted file mode 100644 index 8b617e2594..0000000000 --- a/.kokoro/presubmit/java8-osx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-core/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg deleted file mode 100644 index 1a6311a420..0000000000 --- a/.kokoro/presubmit/java8-win.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-core/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg deleted file mode 100644 index 495cc7bacd..0000000000 --- a/.kokoro/presubmit/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "REPORT_COVERAGE" - value: "true" -} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg deleted file mode 100644 index 8703ea2a3e..0000000000 --- a/.kokoro/presubmit/linkage-monitor.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/linkage-monitor.sh" -} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg deleted file mode 100644 index 6d323c8ae7..0000000000 --- a/.kokoro/presubmit/lint.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. - -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "lint" -} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg deleted file mode 100644 index 01e0960047..0000000000 --- a/.kokoro/presubmit/samples.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "samples" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-docs-samples-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" -} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh deleted file mode 100755 index cebf83b9da..0000000000 --- a/.kokoro/readme.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/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 - -cd ${KOKORO_ARTIFACTS_DIR}/github/java-core - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Kokoro exposes this as a file, but the scripts expect just a plain variable. -export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) - -# Setup git credentials -echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials -git config --global credential.helper 'store --file ~/.git-credentials' - -python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool - -set +e -python3.6 -m autosynth.synth \ - --repository=googleapis/java-core \ - --synth-file-name=.github/readme/synth.py \ - --metadata-path=.github/readme/synth.metadata \ - --pr-title="chore: regenerate README" \ - --branch-suffix="readme" - -# autosynth returns 28 to signal there are no changes -RETURN_CODE=$? -if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] -then - exit ${RETURN_CODE} -fi diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg deleted file mode 100644 index a27810aacf..0000000000 --- a/.kokoro/release/bump_snapshot.cfg +++ /dev/null @@ -1,53 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-core/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/bump_snapshot.sh" -} - -# tokens used by release-please to keep an up-to-date release PR. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "github-magic-proxy-key-release-please" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "github-magic-proxy-token-release-please" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "github-magic-proxy-url-release-please" - } - } -} diff --git a/.kokoro/release/bump_snapshot.sh b/.kokoro/release/bump_snapshot.sh deleted file mode 100755 index 712ce36594..0000000000 --- a/.kokoro/release/bump_snapshot.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Copyright 2019 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 -# -# https://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 - -export NPM_CONFIG_PREFIX=/home/node/.npm-global - -if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then - # Groom the snapshot release PR immediately after publishing a release - npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ - --repo-url=googleapis/java-core \ - --package-name="google-cloud-core" \ - --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ - --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ - --snapshot \ - --release-type=java-auth-yoshi -fi diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg deleted file mode 100644 index 4b5b862167..0000000000 --- a/.kokoro/release/common.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "java-core/.kokoro/trampoline.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "maven-gpg-keyring" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "maven-gpg-passphrase" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "maven-gpg-pubkeyring" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 70247 - keyname: "sonatype-credentials" - } - } -} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh deleted file mode 100755 index 7f78ee414f..0000000000 --- a/.kokoro/release/common.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# Get secrets from keystore and set and environment variables -setup_environment_secrets() { - export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) - export GPG_TTY=$(tty) - export GPG_HOMEDIR=/gpg - mkdir $GPG_HOMEDIR - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg - export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') - export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') -} - -create_settings_xml_file() { - echo " - - - ossrh - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-staging - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-snapshots - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - -" > $1 -} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg deleted file mode 100644 index 6590b0c133..0000000000 --- a/.kokoro/release/drop.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/drop.sh" -} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh deleted file mode 100755 index 742ec1a886..0000000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:drop -B \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg deleted file mode 100644 index 800f0884e6..0000000000 --- a/.kokoro/release/promote.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/promote.sh" -} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh deleted file mode 100755 index 3cac3d8a97..0000000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh - -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg deleted file mode 100644 index 11b00bdcf6..0000000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,23 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" - -env_vars: { - key: "STAGING_BUCKET" - value: "docs-staging" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/publish_javadoc.sh" -} - - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh deleted file mode 100755 index e2a55af47a..0000000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-core -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# build the docs -mvn site -B -q - -pushd target/site/apidocs - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload docs -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg deleted file mode 100644 index 52b5dea970..0000000000 --- a/.kokoro/release/publish_javadoc11.cfg +++ /dev/null @@ -1,30 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# cloud-rad production -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2" -} - -# Configure the docker image for kokoro-trampoline -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/publish_javadoc11.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh deleted file mode 100755 index 970a282dec..0000000000 --- a/.kokoro/release/publish_javadoc11.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Copyright 2021 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 - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET_V2 environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-core -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# cloud RAD generation -mvn clean javadoc:aggregate -B -q -P docFX -# include CHANGELOG -cp CHANGELOG.md target/docfx-yml/history.md - -pushd target/docfx-yml - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --xrefs devsite://java/gax \ - --xrefs devsite://java/google-cloud-core \ - --xrefs devsite://java/api-common \ - --xrefs devsite://java/proto-google-common-protos \ - --xrefs devsite://java/google-api-client \ - --xrefs devsite://java/google-http-client \ - --xrefs devsite://java/protobuf \ - --language java - -# upload yml to production bucket -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg deleted file mode 100644 index d435702932..0000000000 --- a/.kokoro/release/snapshot.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/snapshot.sh" -} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh deleted file mode 100755 index 1f55b77024..0000000000 --- a/.kokoro/release/snapshot.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright 2019 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 - -source $(dirname "$0")/common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -# ensure we're trying to push a snapshot (no-result returns non-zero exit code) -grep SNAPSHOT versions.txt - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn clean deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg deleted file mode 100644 index d499007596..0000000000 --- a/.kokoro/release/stage.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-core/.kokoro/release/stage.sh" -} - -# Need to save the properties file -action { - define_artifacts { - regex: "github/java-core/target/nexus-staging/staging/*.properties" - strip_prefix: "github/java-core" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh deleted file mode 100755 index 61e714d6ba..0000000000 --- a/.kokoro/release/stage.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# Start the releasetool reporter -requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) -python3 -m pip install --require-hashes -r $requirementsFile -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -source $(dirname "$0")/common.sh -source $(dirname "$0")/../common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -# attempt to stage 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn clean deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DskipTests=true \ - -Dclirr.skip=true \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} - -if [[ -n "${AUTORELEASE_PR}" ]] -then - mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml -fi diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in deleted file mode 100644 index b19a8dbfdd..0000000000 --- a/.kokoro/requirements.in +++ /dev/null @@ -1,6 +0,0 @@ -gcp-docuploader -gcp-releasetool -wheel -setuptools -typing-extensions -click<8.1.0 \ No newline at end of file diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt deleted file mode 100644 index 4895c9631f..0000000000 --- a/.kokoro/requirements.txt +++ /dev/null @@ -1,408 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.9 -# by the following command: -# -# pip-compile --allow-unsafe --generate-hashes requirements.in -# -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via gcp-releasetool -cachetools==4.2.4 \ - --hash=sha256:89ea6f1b638d5a73a4f9226be57ac5e4f399d22770b92355f92dcb0f7f001693 \ - --hash=sha256:92971d3cb7d2a97efff7c7bb1657f21a8f5fb309a37530537c71b1774189f2d1 - # via google-auth -certifi==2022.12.7 \ - --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ - --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 - # via requests -cffi==1.15.1 \ - --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ - --hash=sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef \ - --hash=sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104 \ - --hash=sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426 \ - --hash=sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405 \ - --hash=sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375 \ - --hash=sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a \ - --hash=sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e \ - --hash=sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc \ - --hash=sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf \ - --hash=sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185 \ - --hash=sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497 \ - --hash=sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3 \ - --hash=sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35 \ - --hash=sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c \ - --hash=sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83 \ - --hash=sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21 \ - --hash=sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca \ - --hash=sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984 \ - --hash=sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac \ - --hash=sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd \ - --hash=sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee \ - --hash=sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a \ - --hash=sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2 \ - --hash=sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192 \ - --hash=sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7 \ - --hash=sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585 \ - --hash=sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f \ - --hash=sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e \ - --hash=sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27 \ - --hash=sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b \ - --hash=sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e \ - --hash=sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e \ - --hash=sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d \ - --hash=sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c \ - --hash=sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415 \ - --hash=sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82 \ - --hash=sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02 \ - --hash=sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314 \ - --hash=sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325 \ - --hash=sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c \ - --hash=sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3 \ - --hash=sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914 \ - --hash=sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045 \ - --hash=sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d \ - --hash=sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9 \ - --hash=sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5 \ - --hash=sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2 \ - --hash=sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c \ - --hash=sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3 \ - --hash=sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2 \ - --hash=sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8 \ - --hash=sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d \ - --hash=sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d \ - --hash=sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9 \ - --hash=sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162 \ - --hash=sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76 \ - --hash=sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4 \ - --hash=sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e \ - --hash=sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9 \ - --hash=sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6 \ - --hash=sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b \ - --hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \ - --hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0 - # via cryptography -charset-normalizer==2.0.12 \ - --hash=sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597 \ - --hash=sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df - # via requests -click==8.0.4 \ - --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ - --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb - # via - # -r requirements.in - # gcp-docuploader - # gcp-releasetool -colorlog==6.7.0 \ - --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ - --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 - # via gcp-docuploader -cryptography==38.0.3 \ - --hash=sha256:068147f32fa662c81aebab95c74679b401b12b57494872886eb5c1139250ec5d \ - --hash=sha256:06fc3cc7b6f6cca87bd56ec80a580c88f1da5306f505876a71c8cfa7050257dd \ - --hash=sha256:25c1d1f19729fb09d42e06b4bf9895212292cb27bb50229f5aa64d039ab29146 \ - --hash=sha256:402852a0aea73833d982cabb6d0c3bb582c15483d29fb7085ef2c42bfa7e38d7 \ - --hash=sha256:4e269dcd9b102c5a3d72be3c45d8ce20377b8076a43cbed6f660a1afe365e436 \ - --hash=sha256:5419a127426084933076132d317911e3c6eb77568a1ce23c3ac1e12d111e61e0 \ - --hash=sha256:554bec92ee7d1e9d10ded2f7e92a5d70c1f74ba9524947c0ba0c850c7b011828 \ - --hash=sha256:5e89468fbd2fcd733b5899333bc54d0d06c80e04cd23d8c6f3e0542358c6060b \ - --hash=sha256:65535bc550b70bd6271984d9863a37741352b4aad6fb1b3344a54e6950249b55 \ - --hash=sha256:6ab9516b85bebe7aa83f309bacc5f44a61eeb90d0b4ec125d2d003ce41932d36 \ - --hash=sha256:6addc3b6d593cd980989261dc1cce38263c76954d758c3c94de51f1e010c9a50 \ - --hash=sha256:728f2694fa743a996d7784a6194da430f197d5c58e2f4e278612b359f455e4a2 \ - --hash=sha256:785e4056b5a8b28f05a533fab69febf5004458e20dad7e2e13a3120d8ecec75a \ - --hash=sha256:78cf5eefac2b52c10398a42765bfa981ce2372cbc0457e6bf9658f41ec3c41d8 \ - --hash=sha256:7f836217000342d448e1c9a342e9163149e45d5b5eca76a30e84503a5a96cab0 \ - --hash=sha256:8d41a46251bf0634e21fac50ffd643216ccecfaf3701a063257fe0b2be1b6548 \ - --hash=sha256:984fe150f350a3c91e84de405fe49e688aa6092b3525f407a18b9646f6612320 \ - --hash=sha256:9b24bcff7853ed18a63cfb0c2b008936a9554af24af2fb146e16d8e1aed75748 \ - --hash=sha256:b1b35d9d3a65542ed2e9d90115dfd16bbc027b3f07ee3304fc83580f26e43249 \ - --hash=sha256:b1b52c9e5f8aa2b802d48bd693190341fae201ea51c7a167d69fc48b60e8a959 \ - --hash=sha256:bbf203f1a814007ce24bd4d51362991d5cb90ba0c177a9c08825f2cc304d871f \ - --hash=sha256:be243c7e2bfcf6cc4cb350c0d5cdf15ca6383bbcb2a8ef51d3c9411a9d4386f0 \ - --hash=sha256:bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd \ - --hash=sha256:c46837ea467ed1efea562bbeb543994c2d1f6e800785bd5a2c98bc096f5cb220 \ - --hash=sha256:dfb4f4dd568de1b6af9f4cda334adf7d72cf5bc052516e1b2608b683375dd95c \ - --hash=sha256:ed7b00096790213e09eb11c97cc6e2b757f15f3d2f85833cd2d3ec3fe37c1722 - # via - # gcp-releasetool - # secretstorage -gcp-docuploader==0.6.4 \ - --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ - --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf - # via -r requirements.in -gcp-releasetool==1.9.1 \ - --hash=sha256:952f4055d5d986b070ae2a71c4410b250000f9cc5a1e26398fcd55a5bbc5a15f \ - --hash=sha256:d0d3c814a97c1a237517e837d8cfa668ced8df4b882452578ecef4a4e79c583b - # via -r requirements.in -google-api-core==2.8.2 \ - --hash=sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc \ - --hash=sha256:93c6a91ccac79079ac6bbf8b74ee75db970cc899278b97d53bc012f35908cf50 - # via - # google-cloud-core - # google-cloud-storage -google-auth==2.14.1 \ - --hash=sha256:ccaa901f31ad5cbb562615eb8b664b3dd0bf5404a67618e642307f00613eda4d \ - --hash=sha256:f5d8701633bebc12e0deea4df8abd8aff31c28b355360597f7f2ee60f2e4d016 - # via - # gcp-releasetool - # google-api-core - # google-cloud-core - # google-cloud-storage -google-cloud-core==2.3.1 \ - --hash=sha256:113ba4f492467d5bd442c8d724c1a25ad7384045c3178369038840ecdd19346c \ - --hash=sha256:34334359cb04187bdc80ddcf613e462dfd7a3aabbc3fe4d118517ab4b9303d53 - # via google-cloud-storage -google-cloud-storage==2.0.0 \ - --hash=sha256:a57a15aead0f9dfbd4381f1bfdbe8bf89818a4bd75bab846cafcefb2db846c47 \ - --hash=sha256:ec4be60bb223a3a960f0d01697d849b86d91cad815a84915a32ed3635e93a5e7 - # via gcp-docuploader -google-crc32c==1.3.0 \ - --hash=sha256:04e7c220798a72fd0f08242bc8d7a05986b2a08a0573396187fd32c1dcdd58b3 \ - --hash=sha256:05340b60bf05b574159e9bd940152a47d38af3fb43803ffe71f11d704b7696a6 \ - --hash=sha256:12674a4c3b56b706153a358eaa1018c4137a5a04635b92b4652440d3d7386206 \ - --hash=sha256:127f9cc3ac41b6a859bd9dc4321097b1a4f6aa7fdf71b4f9227b9e3ebffb4422 \ - --hash=sha256:13af315c3a0eec8bb8b8d80b8b128cb3fcd17d7e4edafc39647846345a3f003a \ - --hash=sha256:1926fd8de0acb9d15ee757175ce7242e235482a783cd4ec711cc999fc103c24e \ - --hash=sha256:226f2f9b8e128a6ca6a9af9b9e8384f7b53a801907425c9a292553a3a7218ce0 \ - --hash=sha256:276de6273eb074a35bc598f8efbc00c7869c5cf2e29c90748fccc8c898c244df \ - --hash=sha256:318f73f5484b5671f0c7f5f63741ab020a599504ed81d209b5c7129ee4667407 \ - --hash=sha256:3bbce1be3687bbfebe29abdb7631b83e6b25da3f4e1856a1611eb21854b689ea \ - --hash=sha256:42ae4781333e331a1743445931b08ebdad73e188fd554259e772556fc4937c48 \ - --hash=sha256:58be56ae0529c664cc04a9c76e68bb92b091e0194d6e3c50bea7e0f266f73713 \ - --hash=sha256:5da2c81575cc3ccf05d9830f9e8d3c70954819ca9a63828210498c0774fda1a3 \ - --hash=sha256:6311853aa2bba4064d0c28ca54e7b50c4d48e3de04f6770f6c60ebda1e975267 \ - --hash=sha256:650e2917660e696041ab3dcd7abac160b4121cd9a484c08406f24c5964099829 \ - --hash=sha256:6a4db36f9721fdf391646685ecffa404eb986cbe007a3289499020daf72e88a2 \ - --hash=sha256:779cbf1ce375b96111db98fca913c1f5ec11b1d870e529b1dc7354b2681a8c3a \ - --hash=sha256:7f6fe42536d9dcd3e2ffb9d3053f5d05221ae3bbcefbe472bdf2c71c793e3183 \ - --hash=sha256:891f712ce54e0d631370e1f4997b3f182f3368179198efc30d477c75d1f44942 \ - --hash=sha256:95c68a4b9b7828ba0428f8f7e3109c5d476ca44996ed9a5f8aac6269296e2d59 \ - --hash=sha256:96a8918a78d5d64e07c8ea4ed2bc44354e3f93f46a4866a40e8db934e4c0d74b \ - --hash=sha256:9c3cf890c3c0ecfe1510a452a165431b5831e24160c5fcf2071f0f85ca5a47cd \ - --hash=sha256:9f58099ad7affc0754ae42e6d87443299f15d739b0ce03c76f515153a5cda06c \ - --hash=sha256:a0b9e622c3b2b8d0ce32f77eba617ab0d6768b82836391e4f8f9e2074582bf02 \ - --hash=sha256:a7f9cbea4245ee36190f85fe1814e2d7b1e5f2186381b082f5d59f99b7f11328 \ - --hash=sha256:bab4aebd525218bab4ee615786c4581952eadc16b1ff031813a2fd51f0cc7b08 \ - --hash=sha256:c124b8c8779bf2d35d9b721e52d4adb41c9bfbde45e6a3f25f0820caa9aba73f \ - --hash=sha256:c9da0a39b53d2fab3e5467329ed50e951eb91386e9d0d5b12daf593973c3b168 \ - --hash=sha256:ca60076c388728d3b6ac3846842474f4250c91efbfe5afa872d3ffd69dd4b318 \ - --hash=sha256:cb6994fff247987c66a8a4e550ef374671c2b82e3c0d2115e689d21e511a652d \ - --hash=sha256:d1c1d6236feab51200272d79b3d3e0f12cf2cbb12b208c835b175a21efdb0a73 \ - --hash=sha256:dd7760a88a8d3d705ff562aa93f8445ead54f58fd482e4f9e2bafb7e177375d4 \ - --hash=sha256:dda4d8a3bb0b50f540f6ff4b6033f3a74e8bf0bd5320b70fab2c03e512a62812 \ - --hash=sha256:e0f1ff55dde0ebcfbef027edc21f71c205845585fffe30d4ec4979416613e9b3 \ - --hash=sha256:e7a539b9be7b9c00f11ef16b55486141bc2cdb0c54762f84e3c6fc091917436d \ - --hash=sha256:eb0b14523758e37802f27b7f8cd973f5f3d33be7613952c0df904b68c4842f0e \ - --hash=sha256:ed447680ff21c14aaceb6a9f99a5f639f583ccfe4ce1a5e1d48eb41c3d6b3217 \ - --hash=sha256:f52a4ad2568314ee713715b1e2d79ab55fab11e8b304fd1462ff5cccf4264b3e \ - --hash=sha256:fbd60c6aaa07c31d7754edbc2334aef50601b7f1ada67a96eb1eb57c7c72378f \ - --hash=sha256:fc28e0db232c62ca0c3600884933178f0825c99be4474cdd645e378a10588125 \ - --hash=sha256:fe31de3002e7b08eb20823b3735b97c86c5926dd0581c7710a680b418a8709d4 \ - --hash=sha256:fec221a051150eeddfdfcff162e6db92c65ecf46cb0f7bb1bf812a1520ec026b \ - --hash=sha256:ff71073ebf0e42258a42a0b34f2c09ec384977e7f6808999102eedd5b49920e3 - # via google-resumable-media -google-resumable-media==2.3.3 \ - --hash=sha256:27c52620bd364d1c8116eaac4ea2afcbfb81ae9139fb3199652fcac1724bfb6c \ - --hash=sha256:5b52774ea7a829a8cdaa8bd2d4c3d4bc660c91b30857ab2668d0eb830f4ea8c5 - # via google-cloud-storage -googleapis-common-protos==1.56.3 \ - --hash=sha256:6f1369b58ed6cf3a4b7054a44ebe8d03b29c309257583a2bbdc064cd1e4a1442 \ - --hash=sha256:87955d7b3a73e6e803f2572a33179de23989ebba725e05ea42f24838b792e461 - # via google-api-core -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via requests -importlib-metadata==4.8.3 \ - --hash=sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e \ - --hash=sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668 - # via keyring -jeepney==0.8.0 \ - --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ - --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 - # via - # keyring - # secretstorage -jinja2==3.0.3 \ - --hash=sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8 \ - --hash=sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7 - # via gcp-releasetool -keyring==23.4.1 \ - --hash=sha256:17e49fb0d6883c2b4445359434dba95aad84aabb29bbff044ad0ed7100232eca \ - --hash=sha256:89cbd74d4683ed164c8082fb38619341097741323b3786905c6dac04d6915a55 - # via gcp-releasetool -markupsafe==2.0.1 \ - --hash=sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298 \ - --hash=sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64 \ - --hash=sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b \ - --hash=sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194 \ - --hash=sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567 \ - --hash=sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff \ - --hash=sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724 \ - --hash=sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74 \ - --hash=sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646 \ - --hash=sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35 \ - --hash=sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6 \ - --hash=sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a \ - --hash=sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6 \ - --hash=sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad \ - --hash=sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26 \ - --hash=sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38 \ - --hash=sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac \ - --hash=sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7 \ - --hash=sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6 \ - --hash=sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047 \ - --hash=sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75 \ - --hash=sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f \ - --hash=sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b \ - --hash=sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135 \ - --hash=sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8 \ - --hash=sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a \ - --hash=sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a \ - --hash=sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1 \ - --hash=sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9 \ - --hash=sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864 \ - --hash=sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914 \ - --hash=sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee \ - --hash=sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f \ - --hash=sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18 \ - --hash=sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8 \ - --hash=sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2 \ - --hash=sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d \ - --hash=sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b \ - --hash=sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b \ - --hash=sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86 \ - --hash=sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6 \ - --hash=sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f \ - --hash=sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb \ - --hash=sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833 \ - --hash=sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28 \ - --hash=sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e \ - --hash=sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415 \ - --hash=sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902 \ - --hash=sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f \ - --hash=sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d \ - --hash=sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9 \ - --hash=sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d \ - --hash=sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145 \ - --hash=sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066 \ - --hash=sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c \ - --hash=sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1 \ - --hash=sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a \ - --hash=sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207 \ - --hash=sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f \ - --hash=sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53 \ - --hash=sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd \ - --hash=sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134 \ - --hash=sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85 \ - --hash=sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9 \ - --hash=sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5 \ - --hash=sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94 \ - --hash=sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509 \ - --hash=sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51 \ - --hash=sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872 - # via jinja2 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 - # via gcp-releasetool -protobuf==3.20.2 \ - --hash=sha256:03d76b7bd42ac4a6e109742a4edf81ffe26ffd87c5993126d894fe48a120396a \ - --hash=sha256:09e25909c4297d71d97612f04f41cea8fa8510096864f2835ad2f3b3df5a5559 \ - --hash=sha256:18e34a10ae10d458b027d7638a599c964b030c1739ebd035a1dfc0e22baa3bfe \ - --hash=sha256:291fb4307094bf5ccc29f424b42268640e00d5240bf0d9b86bf3079f7576474d \ - --hash=sha256:2c0b040d0b5d5d207936ca2d02f00f765906622c07d3fa19c23a16a8ca71873f \ - --hash=sha256:384164994727f274cc34b8abd41a9e7e0562801361ee77437099ff6dfedd024b \ - --hash=sha256:3cb608e5a0eb61b8e00fe641d9f0282cd0eedb603be372f91f163cbfbca0ded0 \ - --hash=sha256:5d9402bf27d11e37801d1743eada54372f986a372ec9679673bfcc5c60441151 \ - --hash=sha256:712dca319eee507a1e7df3591e639a2b112a2f4a62d40fe7832a16fd19151750 \ - --hash=sha256:7a5037af4e76c975b88c3becdf53922b5ffa3f2cddf657574a4920a3b33b80f3 \ - --hash=sha256:8228e56a865c27163d5d1d1771d94b98194aa6917bcfb6ce139cbfa8e3c27334 \ - --hash=sha256:84a1544252a933ef07bb0b5ef13afe7c36232a774affa673fc3636f7cee1db6c \ - --hash=sha256:84fe5953b18a383fd4495d375fe16e1e55e0a3afe7b4f7b4d01a3a0649fcda9d \ - --hash=sha256:9c673c8bfdf52f903081816b9e0e612186684f4eb4c17eeb729133022d6032e3 \ - --hash=sha256:a9e5ae5a8e8985c67e8944c23035a0dff2c26b0f5070b2f55b217a1c33bbe8b1 \ - --hash=sha256:b4fdb29c5a7406e3f7ef176b2a7079baa68b5b854f364c21abe327bbeec01cdb \ - --hash=sha256:c184485e0dfba4dfd451c3bd348c2e685d6523543a0f91b9fd4ae90eb09e8422 \ - --hash=sha256:c9cdf251c582c16fd6a9f5e95836c90828d51b0069ad22f463761d27c6c19019 \ - --hash=sha256:e39cf61bb8582bda88cdfebc0db163b774e7e03364bbf9ce1ead13863e81e359 \ - --hash=sha256:e8fbc522303e09036c752a0afcc5c0603e917222d8bedc02813fd73b4b4ed804 \ - --hash=sha256:f34464ab1207114e73bba0794d1257c150a2b89b7a9faf504e00af7c9fd58978 \ - --hash=sha256:f52dabc96ca99ebd2169dadbe018824ebda08a795c7684a0b7d203a290f3adb0 - # via - # gcp-docuploader - # gcp-releasetool - # google-api-core - # google-cloud-storage -pyasn1==0.4.8 \ - --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ - --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba - # via - # pyasn1-modules - # rsa -pyasn1-modules==0.2.8 \ - --hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \ - --hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74 - # via google-auth -pycparser==2.21 \ - --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ - --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 - # via cffi -pyjwt==2.4.0 \ - --hash=sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf \ - --hash=sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba - # via gcp-releasetool -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pyperclip==1.8.2 \ - --hash=sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57 - # via gcp-releasetool -python-dateutil==2.8.2 \ - --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ - --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 - # via gcp-releasetool -requests==2.27.1 \ - --hash=sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61 \ - --hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d - # via - # gcp-releasetool - # google-api-core - # google-cloud-storage -rsa==4.9 \ - --hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \ - --hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21 - # via google-auth -secretstorage==3.3.3 \ - --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ - --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 - # via keyring -setuptools==65.6.3 \ - --hash=sha256:57f6f22bde4e042978bcd50176fdb381d7c21a9efa4041202288d3737a0c6a54 \ - --hash=sha256:a7620757bf984b58deaf32fc8a4577a9bbc0850cf92c20e1ce41c38c19e5fb75 - # via -r requirements.in -six==1.16.0 \ - --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ - --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # gcp-docuploader - # google-auth - # python-dateutil -typing-extensions==4.4.0 \ - --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ - --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e - # via -r requirements.in -urllib3==1.26.12 \ - --hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \ - --hash=sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997 - # via requests -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 - # via -r requirements.in -zipp==3.6.0 \ - --hash=sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 \ - --hash=sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc - # via importlib-metadata diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh deleted file mode 100644 index 8b69b793c9..0000000000 --- a/.kokoro/trampoline.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json deleted file mode 100644 index 1599ab74dd..0000000000 --- a/.repo-metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "api_shortname": "google-cloud-core", - "name_pretty": "Google Cloud Core", - "release_level": "stable", - "language": "java", - "repo": "googleapis/java-core", - "repo_short": "java-core", - "library_type": "CORE", - "distribution_name": "com.google.cloud:google-cloud-core" -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 59ea2dd72f..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,1277 +0,0 @@ -# Changelog - -## [2.9.4](https://github.com/googleapis/java-core/compare/v2.9.3...v2.9.4) (2023-01-20) - - -### Bug Fixes - -* **java:** Skip fixing poms for special modules ([#1744](https://github.com/googleapis/java-core/issues/1744)) ([#1080](https://github.com/googleapis/java-core/issues/1080)) ([db2cc2f](https://github.com/googleapis/java-core/commit/db2cc2fcd03342948c6c4e753d012d08000e7733)) - -## [2.9.3](https://github.com/googleapis/java-core/compare/v2.9.2...v2.9.3) (2023-01-19) - - -### Dependencies - -* Update dependency com.google.api:api-common to v2.5.0 ([#1083](https://github.com/googleapis/java-core/issues/1083)) ([dc3e6c7](https://github.com/googleapis/java-core/commit/dc3e6c713f3b65b59a0d814cddd1509583db081c)) -* Update dependency com.google.api:gax-bom to v2.22.0 ([#1084](https://github.com/googleapis/java-core/issues/1084)) ([5b94330](https://github.com/googleapis/java-core/commit/5b94330a90920f106e70a0ec7823026c3c87d55e)) -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.13.0 ([#1081](https://github.com/googleapis/java-core/issues/1081)) ([d4bfd0e](https://github.com/googleapis/java-core/commit/d4bfd0efea78e3266f237fbb620ab5441abf0003)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.8.0 ([#1082](https://github.com/googleapis/java-core/issues/1082)) ([bbda002](https://github.com/googleapis/java-core/commit/bbda002fc193af2b6a52fae54f1238c5ce66dc6e)) - -## [2.9.2](https://github.com/googleapis/java-core/compare/v2.9.1...v2.9.2) (2023-01-18) - - -### Dependencies - -* Update dependency io.grpc:grpc-bom to v1.52.1 ([#1073](https://github.com/googleapis/java-core/issues/1073)) ([a45ec31](https://github.com/googleapis/java-core/commit/a45ec316782d2d2a1d3af149f338daf028d94206)) - -## [2.9.1](https://github.com/googleapis/java-core/compare/v2.9.0...v2.9.1) (2023-01-09) - - -### Bug Fixes - -* Make title and description of Condition Nullable ([#1063](https://github.com/googleapis/java-core/issues/1063)) ([1238462](https://github.com/googleapis/java-core/commit/12384628ab07b7edb04181c79ed07e742277e4c4)) - - -### Documentation - -* Update javadocs for ReadChannel to be more clear about the behavior ([#1050](https://github.com/googleapis/java-core/issues/1050)) ([8b574f6](https://github.com/googleapis/java-core/commit/8b574f66c6e77b31ec8d544319a116f5c19804b9)) - - -### Dependencies - -* Update dependency com.google.api-client:google-api-client-bom to v2.1.2 ([#1064](https://github.com/googleapis/java-core/issues/1064)) ([6bf1c24](https://github.com/googleapis/java-core/commit/6bf1c2414978340cb997acb18e98815e20028718)) -* Update dependency com.google.api:api-common to v2.3.1 ([#1053](https://github.com/googleapis/java-core/issues/1053)) ([43ce490](https://github.com/googleapis/java-core/commit/43ce49083ebdfada11732ff82aa407c69311f4c9)) -* Update dependency com.google.api:api-common to v2.4.0 ([#1069](https://github.com/googleapis/java-core/issues/1069)) ([083bc07](https://github.com/googleapis/java-core/commit/083bc071f4529cd2a827cd4586e5c02690f4ffcd)) -* Update dependency com.google.api:gax-bom to v2.21.0 ([#1070](https://github.com/googleapis/java-core/issues/1070)) ([e133832](https://github.com/googleapis/java-core/commit/e133832eb6e81089745e21d9b0188cb91af0a51b)) -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.12.0 ([#1067](https://github.com/googleapis/java-core/issues/1067)) ([bfab3ad](https://github.com/googleapis/java-core/commit/bfab3adbcefea538d50d567297eb491650ad19ba)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.23 ([#1060](https://github.com/googleapis/java-core/issues/1060)) ([a2e5c4e](https://github.com/googleapis/java-core/commit/a2e5c4eb35824ee019b0d0b8f984144f07d76c0a)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.7.0 ([#1068](https://github.com/googleapis/java-core/issues/1068)) ([404f222](https://github.com/googleapis/java-core/commit/404f2220ea85253945f470a6370870cce248c11e)) -* Update dependency com.google.auth:google-auth-library-bom to v1.14.0 ([#1056](https://github.com/googleapis/java-core/issues/1056)) ([328628d](https://github.com/googleapis/java-core/commit/328628da55cea6d27c4fe4ed2aaa14bf2bc59a58)) -* Update dependency com.google.code.gson:gson to v2.10.1 ([#1066](https://github.com/googleapis/java-core/issues/1066)) ([a4b941e](https://github.com/googleapis/java-core/commit/a4b941e8daed4650bd019a7c03602cd617bdcad2)) -* Update dependency com.google.errorprone:error_prone_annotations to v2.17.0 ([#1061](https://github.com/googleapis/java-core/issues/1061)) ([e7159c2](https://github.com/googleapis/java-core/commit/e7159c28eb4882395cc351d3dbd29db74a75c271)) -* Update dependency com.google.errorprone:error_prone_annotations to v2.18.0 ([#1071](https://github.com/googleapis/java-core/issues/1071)) ([b85690f](https://github.com/googleapis/java-core/commit/b85690fdcf0803502412bf5af418c17b43a718e7)) -* Update dependency com.google.protobuf:protobuf-bom to v3.21.12 ([#1054](https://github.com/googleapis/java-core/issues/1054)) ([3fc149e](https://github.com/googleapis/java-core/commit/3fc149e28a8724b100717c0ddfb138338401fea9)) -* Update dependency io.grpc:grpc-bom to v1.51.1 ([#1058](https://github.com/googleapis/java-core/issues/1058)) ([d8ca14c](https://github.com/googleapis/java-core/commit/d8ca14cdb10d5af41396b40702a4abd7c9b5b15c)) -* Update dependency org.easymock:easymock to v5.1.0 ([#1062](https://github.com/googleapis/java-core/issues/1062)) ([4c0095d](https://github.com/googleapis/java-core/commit/4c0095daa0a17564c972434e4824c03b2204e3e0)) -* Update dependency org.threeten:threetenbp to v1.6.5 ([#1052](https://github.com/googleapis/java-core/issues/1052)) ([7e12b5d](https://github.com/googleapis/java-core/commit/7e12b5d137db97d95320416cd80e467bb300c499)) - -## [2.9.0](https://github.com/googleapis/java-core/compare/v2.8.28...v2.9.0) (2022-12-05) - - -### Features - -* Next release from main branch is 2.9.0 ([#1018](https://github.com/googleapis/java-core/issues/1018)) ([e53bf16](https://github.com/googleapis/java-core/commit/e53bf165791149ae4bcbe8ab21f14d8c6331680c)) -* Support get CREDENTIAL_ENV_NAME from properties ([#782](https://github.com/googleapis/java-core/issues/782)) ([2bb7d57](https://github.com/googleapis/java-core/commit/2bb7d576a3da2185a9756c7b4f5386bf67824d1d)) - - -### Dependencies - -* Update dependency com.google.api-client:google-api-client-bom to v2.1.1 ([#1045](https://github.com/googleapis/java-core/issues/1045)) ([c957f18](https://github.com/googleapis/java-core/commit/c957f1882a93cadc19964912ab57eb8119ccf529)) -* Update dependency com.google.api:gax-bom to v2.20.1 ([#1049](https://github.com/googleapis/java-core/issues/1049)) ([46af789](https://github.com/googleapis/java-core/commit/46af7892e49c5967e2fcd82bca21332cad5b5458)) -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.11.0 ([#1046](https://github.com/googleapis/java-core/issues/1046)) ([b0d785a](https://github.com/googleapis/java-core/commit/b0d785a0c77c193a8fdc25f4b43ed26ac1b478bc)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.10 ([#1028](https://github.com/googleapis/java-core/issues/1028)) ([399899a](https://github.com/googleapis/java-core/commit/399899a4a1bcffb4bdbf5ee2898b5f6050ea00a6)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.11 ([#1029](https://github.com/googleapis/java-core/issues/1029)) ([0e33024](https://github.com/googleapis/java-core/commit/0e3302464ff613fa082d6f165155d6a825cf4294)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.12 ([#1031](https://github.com/googleapis/java-core/issues/1031)) ([3705e63](https://github.com/googleapis/java-core/commit/3705e63d3291f4d0d9c6346f32c43f209983e801)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.13 ([#1033](https://github.com/googleapis/java-core/issues/1033)) ([3256faa](https://github.com/googleapis/java-core/commit/3256faa6301939492a07d2c5d02d3a5eb3c75c5e)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.14 ([#1034](https://github.com/googleapis/java-core/issues/1034)) ([03d481b](https://github.com/googleapis/java-core/commit/03d481be4aa7e4885acc6fb204f92606a514db0f)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.15 ([#1035](https://github.com/googleapis/java-core/issues/1035)) ([a0f1915](https://github.com/googleapis/java-core/commit/a0f191579b61db1cfa984d9aba56a293c577f56e)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.16 ([#1036](https://github.com/googleapis/java-core/issues/1036)) ([d236920](https://github.com/googleapis/java-core/commit/d236920a6ddbbac523db19534f5944d38a5feed2)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.17 ([#1037](https://github.com/googleapis/java-core/issues/1037)) ([c06c8e1](https://github.com/googleapis/java-core/commit/c06c8e19cbf7f8e2e4fe387a685cc36fc8be674d)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.18 ([#1040](https://github.com/googleapis/java-core/issues/1040)) ([2baec55](https://github.com/googleapis/java-core/commit/2baec55331fa1e74a9199adcb7eb44b7ac886a6e)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.20 ([#1041](https://github.com/googleapis/java-core/issues/1041)) ([ee64ef7](https://github.com/googleapis/java-core/commit/ee64ef76995061a238957705405b56f4bd4870f9)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.21 ([#1042](https://github.com/googleapis/java-core/issues/1042)) ([df6f385](https://github.com/googleapis/java-core/commit/df6f3857871604663626dbbe6b262fc8b3db1dc3)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.22 ([#1043](https://github.com/googleapis/java-core/issues/1043)) ([84c3820](https://github.com/googleapis/java-core/commit/84c382042cedc934cc571b32de7aa058ac025e9e)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.9 ([#1024](https://github.com/googleapis/java-core/issues/1024)) ([3bb2fae](https://github.com/googleapis/java-core/commit/3bb2fae3c4c96301985f2e4c51d0a6bc9d737341)) -* Update dependency com.google.auth:google-auth-library-bom to v1.13.0 ([#1030](https://github.com/googleapis/java-core/issues/1030)) ([799e584](https://github.com/googleapis/java-core/commit/799e584645fb03c96f7e93156770c9afa631eff6)) -* Update dependency com.google.protobuf:protobuf-bom to v3.21.10 ([#1048](https://github.com/googleapis/java-core/issues/1048)) ([ea0d8d4](https://github.com/googleapis/java-core/commit/ea0d8d4ce7732353506d70c9c16ee6c2d9f01b23)) -* Update dependency io.grpc:grpc-bom to v1.51.0 ([#1032](https://github.com/googleapis/java-core/issues/1032)) ([2572bcc](https://github.com/googleapis/java-core/commit/2572bcc6f62e713009ebcb4c41a2e5ec4ba57707)) - -## [2.8.28](https://github.com/googleapis/java-core/compare/v2.8.27...v2.8.28) (2022-11-09) - - -### Dependencies - -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.8 ([#1020](https://github.com/googleapis/java-core/issues/1020)) ([e8b3608](https://github.com/googleapis/java-core/commit/e8b360836633345db0a8010590cf9a9753e1a1f9)) - -## [2.8.27](https://github.com/googleapis/java-core/compare/v2.8.26...v2.8.27) (2022-11-07) - - -### Dependencies - -* Update dependency com.google.api:gax-bom to v2.19.5 ([#1014](https://github.com/googleapis/java-core/issues/1014)) ([00753f8](https://github.com/googleapis/java-core/commit/00753f88745ad0232658b634aadf5250c6daad01)) - -## [2.8.26](https://github.com/googleapis/java-core/compare/v2.8.25...v2.8.26) (2022-11-07) - - -### Dependencies - -* Update dependency com.google.api-client:google-api-client-bom to v2.0.1 ([#1011](https://github.com/googleapis/java-core/issues/1011)) ([e52b05c](https://github.com/googleapis/java-core/commit/e52b05c0b4973258d7d783af725182d5ba834c25)) -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.10.0 ([#1010](https://github.com/googleapis/java-core/issues/1010)) ([db9d19e](https://github.com/googleapis/java-core/commit/db9d19e9e760bef0c543f7e5da6af172a7ceca06)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.7 ([#1005](https://github.com/googleapis/java-core/issues/1005)) ([45513e6](https://github.com/googleapis/java-core/commit/45513e639543ca2025d4c4c4cd84f5735c067443)) - -## [2.8.25](https://github.com/googleapis/java-core/compare/v2.8.24...v2.8.25) (2022-10-31) - - -### Dependencies - -* Update dependency com.google.api:api-common to v2.2.2 ([#999](https://github.com/googleapis/java-core/issues/999)) ([e639a64](https://github.com/googleapis/java-core/commit/e639a641c3041c829b8e58eeed79df6352e1c7eb)) -* Update dependency com.google.http-client:google-http-client-bom to v1.42.3 ([#1001](https://github.com/googleapis/java-core/issues/1001)) ([8e35c4f](https://github.com/googleapis/java-core/commit/8e35c4ffe5c12f0e4e570b04d0563640c688eb91)) -* Update dependency com.google.protobuf:protobuf-bom to v3.21.9 ([#998](https://github.com/googleapis/java-core/issues/998)) ([ce2d265](https://github.com/googleapis/java-core/commit/ce2d265669cd8fb43d1de43f02c53384c1d73a0d)) -* Update dependency org.threeten:threetenbp to v1.6.4 ([#1003](https://github.com/googleapis/java-core/issues/1003)) ([a69f122](https://github.com/googleapis/java-core/commit/a69f122b6bd84f6a3ddb496f77a1aa1fba072d13)) - -## [2.8.24](https://github.com/googleapis/java-core/compare/v2.8.23...v2.8.24) (2022-10-26) - - -### Dependencies - -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.6 ([#994](https://github.com/googleapis/java-core/issues/994)) ([8a7b330](https://github.com/googleapis/java-core/commit/8a7b3304f714261501c64180abfc94edaa86d9d4)) -* Update dependency com.google.code.gson:gson to v2.10 ([#995](https://github.com/googleapis/java-core/issues/995)) ([5b947a2](https://github.com/googleapis/java-core/commit/5b947a2486979ba26175753fcf054ba3d4904b35)) - -## [2.8.23](https://github.com/googleapis/java-core/compare/v2.8.22...v2.8.23) (2022-10-24) - - -### Dependencies - -* Update dependency io.grpc:grpc-bom to v1.50.2 ([#990](https://github.com/googleapis/java-core/issues/990)) ([42b1081](https://github.com/googleapis/java-core/commit/42b108100173041925cc705f596f388bab26d954)) -* Update dependency org.easymock:easymock to v5 ([#980](https://github.com/googleapis/java-core/issues/980)) ([64be350](https://github.com/googleapis/java-core/commit/64be350d3713af1a95ca51997194a15c7292f7ae)) - -## [2.8.22](https://github.com/googleapis/java-core/compare/v2.8.21...v2.8.22) (2022-10-19) - - -### Dependencies - -* Update dependency com.google.api:gax-bom to v2.19.4 ([#987](https://github.com/googleapis/java-core/issues/987)) ([70a959b](https://github.com/googleapis/java-core/commit/70a959bd01884ec4e9ec4705a25442bf06e9bb73)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.4 ([#976](https://github.com/googleapis/java-core/issues/976)) ([ddf887f](https://github.com/googleapis/java-core/commit/ddf887fa35872299c1b65cd03934595a89c2ab4c)) -* Update dependency com.google.auth:google-auth-library-bom to v1.12.0 ([#981](https://github.com/googleapis/java-core/issues/981)) ([87c5616](https://github.com/googleapis/java-core/commit/87c5616ff8a5c4e96ff761b25cf1423505bdc4e2)) -* Update dependency com.google.auth:google-auth-library-bom to v1.12.1 ([#983](https://github.com/googleapis/java-core/issues/983)) ([ddf787a](https://github.com/googleapis/java-core/commit/ddf787a470a8f4b8416b09bf3bb656f249b1caf5)) -* Update dependency com.google.errorprone:error_prone_annotations to v2.16 ([#977](https://github.com/googleapis/java-core/issues/977)) ([6f9f78e](https://github.com/googleapis/java-core/commit/6f9f78ef38d586e1cded056451658b77c5a093b7)) -* Update dependency com.google.protobuf:protobuf-bom to v3.21.8 ([#984](https://github.com/googleapis/java-core/issues/984)) ([234c9a7](https://github.com/googleapis/java-core/commit/234c9a7788c32692b1e7f9686a6b7329d758acb9)) -* Update dependency io.grpc:grpc-bom to v1.50.0 ([#978](https://github.com/googleapis/java-core/issues/978)) ([024fb77](https://github.com/googleapis/java-core/commit/024fb77b67b4a0f9d8dfcd8315376a0b4937a0da)) -* Update dependency io.grpc:grpc-bom to v1.50.1 ([#985](https://github.com/googleapis/java-core/issues/985)) ([8b71163](https://github.com/googleapis/java-core/commit/8b71163725178ffcbbaae21c6d1fc530be77b9b4)) -* Update dependency org.threeten:threetenbp to v1.6.3 ([#979](https://github.com/googleapis/java-core/issues/979)) ([f51ea92](https://github.com/googleapis/java-core/commit/f51ea92c8bd1ebe0c7a2796d435cceafd037ce06)) - -## [2.8.21](https://github.com/googleapis/java-core/compare/v2.8.20...v2.8.21) (2022-10-10) - - -### Dependencies - -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.2 ([#971](https://github.com/googleapis/java-core/issues/971)) ([5d778fc](https://github.com/googleapis/java-core/commit/5d778fc0d78e67cbcc4eb061da3b66dd3cab440e)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.3 ([#974](https://github.com/googleapis/java-core/issues/974)) ([1b7fcb9](https://github.com/googleapis/java-core/commit/1b7fcb978da55f8d30cf66941bc8208853fef116)) - -## [2.8.20](https://github.com/googleapis/java-core/compare/v2.8.19...v2.8.20) (2022-10-02) - - -### Dependencies - -* Update dependency com.google.api:gax-bom to v2.19.2 ([#969](https://github.com/googleapis/java-core/issues/969)) ([1151449](https://github.com/googleapis/java-core/commit/1151449c061ab51c45982444db5f9da9d2ce4fb7)) -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.9.6 ([#967](https://github.com/googleapis/java-core/issues/967)) ([4a7b524](https://github.com/googleapis/java-core/commit/4a7b524fa366484825bedbc0a4f86d4551a6a0e8)) -* Update dependency io.grpc:grpc-bom to v1.49.2 ([#966](https://github.com/googleapis/java-core/issues/966)) ([b7738aa](https://github.com/googleapis/java-core/commit/b7738aa71fb9cf0994e4ad1dae4bae433754cda0)) - -## [2.8.19](https://github.com/googleapis/java-core/compare/v2.8.18...v2.8.19) (2022-09-30) - - -### Dependencies - -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.9.5 ([#963](https://github.com/googleapis/java-core/issues/963)) ([1ee2f9a](https://github.com/googleapis/java-core/commit/1ee2f9acd3968b21974a550b6732fe68b18085f4)) - -## [2.8.18](https://github.com/googleapis/java-core/compare/v2.8.17...v2.8.18) (2022-09-30) - - -### Dependencies - -* Update dependency com.google.protobuf:protobuf-bom to v3.21.7 ([#960](https://github.com/googleapis/java-core/issues/960)) ([1fcd95f](https://github.com/googleapis/java-core/commit/1fcd95f2401b66a79383bd79729595334493b0e4)) - -## [2.8.17](https://github.com/googleapis/java-core/compare/v2.8.16...v2.8.17) (2022-09-28) - - -### Dependencies - -* Update dependency cachetools to v5 ([#943](https://github.com/googleapis/java-core/issues/943)) ([c6c511d](https://github.com/googleapis/java-core/commit/c6c511d82534e96fe5b42ad9e4886aaa18efaef3)) -* Update dependency certifi to v2022.9.24 ([#934](https://github.com/googleapis/java-core/issues/934)) ([c756885](https://github.com/googleapis/java-core/commit/c75688575c3c19d0d8a1a2b25c6fe3eb99c229cb)) -* Update dependency charset-normalizer to v2.1.1 ([#938](https://github.com/googleapis/java-core/issues/938)) ([1520f65](https://github.com/googleapis/java-core/commit/1520f65cf6655aed9767d9470e3729a0fc270b9e)) -* Update dependency click to v8.1.3 ([#946](https://github.com/googleapis/java-core/issues/946)) ([6f7a7f5](https://github.com/googleapis/java-core/commit/6f7a7f5f318a7c3586fa79a7a0013bca562b059e)) -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.9.4 ([#945](https://github.com/googleapis/java-core/issues/945)) ([307e406](https://github.com/googleapis/java-core/commit/307e40688d55af3cb96e38972af6035cf846c595)) -* Update dependency gcp-releasetool to v1.8.8 ([#935](https://github.com/googleapis/java-core/issues/935)) ([a5ba3b8](https://github.com/googleapis/java-core/commit/a5ba3b8d6bc43734bb01b0ba04e11b5262db526b)) -* Update dependency google-api-core to v2.10.1 ([#947](https://github.com/googleapis/java-core/issues/947)) ([1f3da64](https://github.com/googleapis/java-core/commit/1f3da6450b1a5093aadaa9f299fc797773cc8480)) -* Update dependency google-auth to v2.12.0 ([#948](https://github.com/googleapis/java-core/issues/948)) ([361da3d](https://github.com/googleapis/java-core/commit/361da3dcaecadd708546447737c5a7c1d9799834)) -* Update dependency google-cloud-core to v2.3.2 ([#936](https://github.com/googleapis/java-core/issues/936)) ([99c0013](https://github.com/googleapis/java-core/commit/99c001309e1f72b84c41b7df55ff26c9f182863a)) -* Update dependency google-cloud-storage to v2.5.0 ([#949](https://github.com/googleapis/java-core/issues/949)) ([cd6cbfb](https://github.com/googleapis/java-core/commit/cd6cbfb3b1c45e2f55d51edee74621a7dbe06401)) -* Update dependency google-crc32c to v1.5.0 ([#950](https://github.com/googleapis/java-core/issues/950)) ([abd5ff9](https://github.com/googleapis/java-core/commit/abd5ff9321304b1238f4dd6fa0b4dd57665b46cc)) -* Update dependency googleapis-common-protos to v1.56.4 ([#937](https://github.com/googleapis/java-core/issues/937)) ([bd7d676](https://github.com/googleapis/java-core/commit/bd7d676c3f221b59768815ccca000c7763aeb7f9)) -* Update dependency importlib-metadata to v4.12.0 ([#951](https://github.com/googleapis/java-core/issues/951)) ([f0d1fe8](https://github.com/googleapis/java-core/commit/f0d1fe8cc2079216b95d8fd24a46de5161801b35)) -* Update dependency jeepney to v0.8.0 ([#952](https://github.com/googleapis/java-core/issues/952)) ([342614b](https://github.com/googleapis/java-core/commit/342614b1275877fb41e8241f0c6061286989df13)) -* Update dependency jinja2 to v3.1.2 ([#953](https://github.com/googleapis/java-core/issues/953)) ([a1542bf](https://github.com/googleapis/java-core/commit/a1542bf8938a72c85b20f97e642dde3666ea0b04)) -* Update dependency keyring to v23.9.3 ([#954](https://github.com/googleapis/java-core/issues/954)) ([34bbdae](https://github.com/googleapis/java-core/commit/34bbdaeb312cce804d92d6b041e3098b8a6c04bc)) -* Update dependency markupsafe to v2.1.1 ([#955](https://github.com/googleapis/java-core/issues/955)) ([cb444b0](https://github.com/googleapis/java-core/commit/cb444b0d274af29ffa3076bd89c42acedf514749)) -* Update dependency protobuf to v3.20.2 ([#956](https://github.com/googleapis/java-core/issues/956)) ([949b4fe](https://github.com/googleapis/java-core/commit/949b4feab38e8b0f0b32ae80067dc07da5a2a383)) -* Update dependency protobuf to v4 ([#944](https://github.com/googleapis/java-core/issues/944)) ([9d379e2](https://github.com/googleapis/java-core/commit/9d379e202dd8bedf0c3bbaab3d3ba593813285d9)) -* Update dependency pyjwt to v2.5.0 ([#939](https://github.com/googleapis/java-core/issues/939)) ([bd4896e](https://github.com/googleapis/java-core/commit/bd4896ed5d0413472ae100b60e5f632506214a97)) -* Update dependency requests to v2.28.1 ([#940](https://github.com/googleapis/java-core/issues/940)) ([f64fef9](https://github.com/googleapis/java-core/commit/f64fef9ef365b43e1ec195db312862000db18627)) -* Update dependency typing-extensions to v4.3.0 ([#941](https://github.com/googleapis/java-core/issues/941)) ([3b8f163](https://github.com/googleapis/java-core/commit/3b8f163789f5cb11a4b461411cb7c1e132439449)) -* Update dependency zipp to v3.8.1 ([#942](https://github.com/googleapis/java-core/issues/942)) ([96ccc51](https://github.com/googleapis/java-core/commit/96ccc51c7107fbbcea6564cdf71fcedb05364761)) - -## [2.8.16](https://github.com/googleapis/java-core/compare/v2.8.15...v2.8.16) (2022-09-26) - - -### Dependencies - -* Update dependency org.threeten:threetenbp to v1.6.2 ([#929](https://github.com/googleapis/java-core/issues/929)) ([2f797f9](https://github.com/googleapis/java-core/commit/2f797f990eacc112dd982e7a8f9155bc229b7bf3)) - -## [2.8.15](https://github.com/googleapis/java-core/compare/v2.8.14...v2.8.15) (2022-09-23) - - -### Dependencies - -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.0 ([#925](https://github.com/googleapis/java-core/issues/925)) ([a5475c5](https://github.com/googleapis/java-core/commit/a5475c5333ca97392c9e64a883826ea1bd976a01)) -* Update dependency com.google.api.grpc:proto-google-iam-v1 to v1.6.1 ([#926](https://github.com/googleapis/java-core/issues/926)) ([3bc96fb](https://github.com/googleapis/java-core/commit/3bc96fbba4907d4ac3d24915870132fed596c0d3)) - -## [2.8.14](https://github.com/googleapis/java-core/compare/v2.8.13...v2.8.14) (2022-09-20) - - -### Dependencies - -* Update dependency com.google.api.grpc:proto-google-common-protos to v2.9.3 ([#922](https://github.com/googleapis/java-core/issues/922)) ([96b5b4e](https://github.com/googleapis/java-core/commit/96b5b4e00004c28cd2d726c2161e94778f6a1c01)) - -## [2.8.13](https://github.com/googleapis/java-core/compare/v2.8.12...v2.8.13) (2022-09-20) - - -### Dependencies - -* Update dependency io.grpc:grpc-bom to v1.49.1 ([#919](https://github.com/googleapis/java-core/issues/919)) ([2d481ba](https://github.com/googleapis/java-core/commit/2d481ba500e247d8fee49abe30a9eb84bdcc8d07)) - -## [2.8.12](https://github.com/googleapis/java-core/compare/v2.8.11...v2.8.12) (2022-09-14) - - -### Dependencies - -* Update dependency com.google.api:gax-bom to v2.19.1 ([#915](https://github.com/googleapis/java-core/issues/915)) ([2647fde](https://github.com/googleapis/java-core/commit/2647fdee8e2b168f3364af8e76abfe2903578b29)) -* Update dependency com.google.protobuf:protobuf-bom to v3.21.6 ([#916](https://github.com/googleapis/java-core/issues/916)) ([a7db234](https://github.com/googleapis/java-core/commit/a7db234800481ffba71d3222542971dbcd212d8e)) - -## [2.8.11](https://github.com/googleapis/java-core/compare/v2.8.10...v2.8.11) (2022-09-08) - - -### Dependencies - -* Update dependency com.google.auth:google-auth-library-bom to v1.11.0 ([#911](https://github.com/googleapis/java-core/issues/911)) ([4656905](https://github.com/googleapis/java-core/commit/4656905956504e4bc4fe224d1f8cd70bbab614d8)) - -## [2.8.10](https://github.com/googleapis/java-core/compare/v2.8.9...v2.8.10) (2022-08-24) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.19.0 ([#907](https://github.com/googleapis/java-core/issues/907)) ([51b824c](https://github.com/googleapis/java-core/commit/51b824c225fd7095138e1ec2b6d47af4e2a34352)) -* update dependency io.grpc:grpc-bom to v1.49.0 ([#908](https://github.com/googleapis/java-core/issues/908)) ([fbccd2d](https://github.com/googleapis/java-core/commit/fbccd2daceb0984c7cb95f84f89a116e54bf4ddc)) - -## [2.8.9](https://github.com/googleapis/java-core/compare/v2.8.8...v2.8.9) (2022-08-16) - - -### Dependencies - -* update dependency com.google.auth:google-auth-library-bom to v1.10.0 ([#900](https://github.com/googleapis/java-core/issues/900)) ([c01b47a](https://github.com/googleapis/java-core/commit/c01b47a122a9036f8c594cb583dab3512a257597)) -* update dependency com.google.protobuf:protobuf-bom to v3.21.5 ([#901](https://github.com/googleapis/java-core/issues/901)) ([13e2fd6](https://github.com/googleapis/java-core/commit/13e2fd6fbae1d34385ec500aaf4a2b38e19dd6de)) -* update dependency org.threeten:threetenbp to v1.6.1 ([#902](https://github.com/googleapis/java-core/issues/902)) ([02dac62](https://github.com/googleapis/java-core/commit/02dac62784a6614291836917b022a32745312157)) - -## [2.8.8](https://github.com/googleapis/java-core/compare/v2.8.7...v2.8.8) (2022-08-04) - - -### Dependencies - -* update dependency com.google.errorprone:error_prone_annotations to v2.15.0 ([#897](https://github.com/googleapis/java-core/issues/897)) ([29e4fc9](https://github.com/googleapis/java-core/commit/29e4fc93d5d4d50f7de85eae7a8150314cca6f43)) - -## [2.8.7](https://github.com/googleapis/java-core/compare/v2.8.6...v2.8.7) (2022-08-03) - - -### Dependencies - -* update dependency com.google.auth:google-auth-library-bom to v1.9.0 ([#894](https://github.com/googleapis/java-core/issues/894)) ([82aaa16](https://github.com/googleapis/java-core/commit/82aaa16cd9813984a0c92d944eb1ad956759a8e5)) -* update dependency io.grpc:grpc-bom to v1.48.1 ([#891](https://github.com/googleapis/java-core/issues/891)) ([0b0f9b8](https://github.com/googleapis/java-core/commit/0b0f9b89757b801e8334c764644d7b66032d36d1)) - -## [2.8.6](https://github.com/googleapis/java-core/compare/v2.8.5...v2.8.6) (2022-08-02) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.18.7 ([#890](https://github.com/googleapis/java-core/issues/890)) ([c67bed5](https://github.com/googleapis/java-core/commit/c67bed5281b458e78780cdd918235b5d073917c7)) -* update dependency com.google.code.gson:gson to v2.9.1 ([#888](https://github.com/googleapis/java-core/issues/888)) ([7b799c6](https://github.com/googleapis/java-core/commit/7b799c66f4aaf057242e9a231b920e49a7c964e9)) - -## [2.8.5](https://github.com/googleapis/java-core/compare/v2.8.4...v2.8.5) (2022-07-29) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.18.6 ([#885](https://github.com/googleapis/java-core/issues/885)) ([7fa028c](https://github.com/googleapis/java-core/commit/7fa028c0e78bd21583c8687582da24834bd54449)) - -## [2.8.4](https://github.com/googleapis/java-core/compare/v2.8.3...v2.8.4) (2022-07-27) - - -### Documentation - -* update javadocs for ReadChannel#limit to be more clear ([#880](https://github.com/googleapis/java-core/issues/880)) ([c7de4e2](https://github.com/googleapis/java-core/commit/c7de4e2871d6a32cacc7aab69d826f3afd6301ef)) - - -### Dependencies - -* Update google-cloud-shared-config to v1.5.3 ([#882](https://github.com/googleapis/java-core/issues/882)) ([aabb0b4](https://github.com/googleapis/java-core/commit/aabb0b42076f8a02e7b31d604add567fa909df6c)) - -## [2.8.3](https://github.com/googleapis/java-core/compare/v2.8.2...v2.8.3) (2022-07-26) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v2 ([#868](https://github.com/googleapis/java-core/issues/868)) ([e117c40](https://github.com/googleapis/java-core/commit/e117c40f31acf16a45bdbeeb727ba26d80eb6a51)) -* update dependency com.google.api:gax-bom to v2.18.4 ([#864](https://github.com/googleapis/java-core/issues/864)) ([bd40b1d](https://github.com/googleapis/java-core/commit/bd40b1d1b36cdcfa833047609e2488594b112be1)) -* update dependency com.google.api:gax-bom to v2.18.5 ([#876](https://github.com/googleapis/java-core/issues/876)) ([d8dc7fb](https://github.com/googleapis/java-core/commit/d8dc7fbdb0d65e493ca4154658c63e80d89ab600)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.9.2 ([#870](https://github.com/googleapis/java-core/issues/870)) ([7e961e9](https://github.com/googleapis/java-core/commit/7e961e945d5e049a1a1bb2592e9c155b5937e33b)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.5.2 ([#865](https://github.com/googleapis/java-core/issues/865)) ([fe7b974](https://github.com/googleapis/java-core/commit/fe7b974a0eae82711ca96edf412944309d5d6202)) -* update dependency com.google.auth:google-auth-library-bom to v1.8.1 ([#856](https://github.com/googleapis/java-core/issues/856)) ([92df5d3](https://github.com/googleapis/java-core/commit/92df5d3c248214970d38432e8c264d151298d1e6)) -* update dependency com.google.http-client:google-http-client-bom to v1.42.2 ([#871](https://github.com/googleapis/java-core/issues/871)) ([1972e8e](https://github.com/googleapis/java-core/commit/1972e8e45e11597e56609aa5fcd44e61958d5857)) -* update dependency com.google.protobuf:protobuf-bom to v3.21.3 ([#874](https://github.com/googleapis/java-core/issues/874)) ([1e18977](https://github.com/googleapis/java-core/commit/1e18977820ac766157156fb6246bd318d207971c)) -* update dependency com.google.protobuf:protobuf-bom to v3.21.4 ([#877](https://github.com/googleapis/java-core/issues/877)) ([d12fb5e](https://github.com/googleapis/java-core/commit/d12fb5e4eb8aa42015df84abf31f56408c8b64d8)) -* update dependency io.grpc:grpc-bom to v1.48.0 ([#873](https://github.com/googleapis/java-core/issues/873)) ([a45b075](https://github.com/googleapis/java-core/commit/a45b075e414049550c51ff0097337e45128fc499)) - -## [2.8.2](https://github.com/googleapis/java-core/compare/v2.8.1...v2.8.2) (2022-07-13) - - -### Bug Fixes - -* enable longpaths support for windows test ([#1485](https://github.com/googleapis/java-core/issues/1485)) ([#866](https://github.com/googleapis/java-core/issues/866)) ([3add981](https://github.com/googleapis/java-core/commit/3add98191ecfc00f324ef214b98d02cfb143d08e)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.35.2 ([#859](https://github.com/googleapis/java-core/issues/859)) ([c26a33d](https://github.com/googleapis/java-core/commit/c26a33d44df2405653ee5161f5335b423d334c93)) -* update dependency com.google.api:gax-bom to v2.18.3 ([#860](https://github.com/googleapis/java-core/issues/860)) ([f16395e](https://github.com/googleapis/java-core/commit/f16395e005b253a1cccadcd77b6403617cf72467)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.9.1 ([#855](https://github.com/googleapis/java-core/issues/855)) ([f7fc1cc](https://github.com/googleapis/java-core/commit/f7fc1cca6e79a17313c1d9c522dc93ea6df44645)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.5.0 ([#862](https://github.com/googleapis/java-core/issues/862)) ([fc82590](https://github.com/googleapis/java-core/commit/fc82590ca3022449300f18bb6d0109521aa73cbc)) -* update dependency com.google.http-client:google-http-client-bom to v1.42.1 ([#861](https://github.com/googleapis/java-core/issues/861)) ([3849fdf](https://github.com/googleapis/java-core/commit/3849fdf14e863d23b097b0d625e3a11b47f5d99b)) - -## [2.8.1](https://github.com/googleapis/java-core/compare/v2.8.0...v2.8.1) (2022-06-27) - - -### Dependencies - -* update dependency com.google.protobuf:protobuf-bom to v3.21.2 ([#851](https://github.com/googleapis/java-core/issues/851)) ([c0f09f0](https://github.com/googleapis/java-core/commit/c0f09f0fcd57a2d90e0a99b17c9e346df8651d65)) - -## [2.8.0](https://github.com/googleapis/java-core/compare/v2.7.1...v2.8.0) (2022-06-21) - - -### Features - -* add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-core/issues/1440)) ([#836](https://github.com/googleapis/java-core/issues/836)) ([8826d9b](https://github.com/googleapis/java-core/commit/8826d9bc05eb9e4a54c40e8578de85ed79c50e99)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.35.1 ([#843](https://github.com/googleapis/java-core/issues/843)) ([9ffe0c5](https://github.com/googleapis/java-core/commit/9ffe0c5b25761abf7ff1bea091aa1db057dff2d0)) -* update dependency com.google.api:api-common to v2.2.1 ([#844](https://github.com/googleapis/java-core/issues/844)) ([69dde56](https://github.com/googleapis/java-core/commit/69dde5641546b678a385b1ed3a2c7a020f81d285)) -* update dependency com.google.api:gax-bom to v2.18.2 ([#849](https://github.com/googleapis/java-core/issues/849)) ([11764b0](https://github.com/googleapis/java-core/commit/11764b04629c5bfbc9b0d68174782cc126dc1646)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.9.0 ([#846](https://github.com/googleapis/java-core/issues/846)) ([5dced6d](https://github.com/googleapis/java-core/commit/5dced6d25ce0f3e7587d7ac1f6f3713f3b2a18c2)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.4.0 ([#838](https://github.com/googleapis/java-core/issues/838)) ([b0a7afe](https://github.com/googleapis/java-core/commit/b0a7afe342a5e15436d439b9cc1e3c58f894ab66)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.4.1 ([#848](https://github.com/googleapis/java-core/issues/848)) ([8260997](https://github.com/googleapis/java-core/commit/826099767b0aabe0db26eff2f612f0847b451366)) -* update dependency com.google.errorprone:error_prone_annotations to v2.14.0 ([#839](https://github.com/googleapis/java-core/issues/839)) ([3459fb6](https://github.com/googleapis/java-core/commit/3459fb668557b982cef5682ce47d3c978b83d69c)) -* update dependency com.google.http-client:google-http-client-bom to v1.42.0 ([#845](https://github.com/googleapis/java-core/issues/845)) ([2d2c873](https://github.com/googleapis/java-core/commit/2d2c873e274b26f4687d569cc3b8ae58c3c5ed54)) -* update dependency com.google.protobuf:protobuf-bom to v3.21.0 ([#840](https://github.com/googleapis/java-core/issues/840)) ([037da15](https://github.com/googleapis/java-core/commit/037da15b2aed1719e768ba5b4e001caf25952adc)) -* update dependency com.google.protobuf:protobuf-bom to v3.21.1 ([#841](https://github.com/googleapis/java-core/issues/841)) ([04b8862](https://github.com/googleapis/java-core/commit/04b886224128f1525ad8398815dc62dac87680af)) -* update dependency io.grpc:grpc-bom to v1.47.0 ([#842](https://github.com/googleapis/java-core/issues/842)) ([40984e2](https://github.com/googleapis/java-core/commit/40984e23242ba954b6ca741ca3f02ec89e92ae57)) - -### [2.7.1](https://github.com/googleapis/java-core/compare/v2.7.0...v2.7.1) (2022-05-19) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.18.1 ([#833](https://github.com/googleapis/java-core/issues/833)) ([7541115](https://github.com/googleapis/java-core/commit/7541115095e0ae28d938a4c9621fd0f82892fe55)) - -## [2.7.0](https://github.com/googleapis/java-core/compare/v2.6.1...v2.7.0) (2022-05-18) - - -### Features - -* **java:** remove native-image-support module ([#820](https://github.com/googleapis/java-core/issues/820)) ([a53ef6d](https://github.com/googleapis/java-core/commit/a53ef6d7ba05eeba82998378455f0aea58f24381)) -* next release from main branch is 2.7.0 ([#807](https://github.com/googleapis/java-core/issues/807)) ([5a2c608](https://github.com/googleapis/java-core/commit/5a2c608e375d15ec83ca71232627bce1f167e750)) - - -### Bug Fixes - -* remove native-image-support module from version.txt ([#822](https://github.com/googleapis/java-core/issues/822)) ([92e7efc](https://github.com/googleapis/java-core/commit/92e7efc4974911f7ce30021a280c9002a44dab47)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.34.1 ([#823](https://github.com/googleapis/java-core/issues/823)) ([71105c6](https://github.com/googleapis/java-core/commit/71105c64918d6444e321fa3de5fc402e577ebc7d)) -* update dependency com.google.api:api-common to v2.2.0 ([#827](https://github.com/googleapis/java-core/issues/827)) ([05a02d6](https://github.com/googleapis/java-core/commit/05a02d6b16cb06b9f1dea0814912e5a32913fca8)) -* update dependency com.google.api:gax-bom to v2.17.0 ([#826](https://github.com/googleapis/java-core/issues/826)) ([c90188e](https://github.com/googleapis/java-core/commit/c90188e9a94ae71d71105d908173f1bd7e77c1cb)) -* update dependency com.google.api:gax-bom to v2.18.0 ([#829](https://github.com/googleapis/java-core/issues/829)) ([5537e7f](https://github.com/googleapis/java-core/commit/5537e7f80d5db94038b24a393e310120fab62e8c)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.2 ([#805](https://github.com/googleapis/java-core/issues/805)) ([493ac03](https://github.com/googleapis/java-core/commit/493ac038d3ca9f603cd47969fde0da68a1f9bfd0)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.3 ([#814](https://github.com/googleapis/java-core/issues/814)) ([e809baa](https://github.com/googleapis/java-core/commit/e809baa69672d3eca2dc348f55615dc072a8fbe3)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.4 ([#825](https://github.com/googleapis/java-core/issues/825)) ([5ce12ee](https://github.com/googleapis/java-core/commit/5ce12ee0c10e2bdb5981e6ca02966d7eb802ca6c)) -* update dependency com.google.auth:google-auth-library-bom to v1.7.0 ([#828](https://github.com/googleapis/java-core/issues/828)) ([2abca2c](https://github.com/googleapis/java-core/commit/2abca2c135ba2337d546d5c97bcdd5901e91301a)) -* update dependency com.google.cloud:native-image-support to v0.14.0 ([#824](https://github.com/googleapis/java-core/issues/824)) ([997a34a](https://github.com/googleapis/java-core/commit/997a34a15a59bb1818fff3d1fbce195a05d12da3)) -* update dependency com.google.errorprone:error_prone_annotations to v2.13.1 ([#806](https://github.com/googleapis/java-core/issues/806)) ([9fc5811](https://github.com/googleapis/java-core/commit/9fc5811eae52288acd9fb0b967e5737848fe7c5e)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.8 ([#821](https://github.com/googleapis/java-core/issues/821)) ([c7e3d6e](https://github.com/googleapis/java-core/commit/c7e3d6ef437d9f85dab450b54d63f7218b89788b)) -* update dependency com.google.protobuf:protobuf-bom to v3.20.1 ([#813](https://github.com/googleapis/java-core/issues/813)) ([a9c8c92](https://github.com/googleapis/java-core/commit/a9c8c92086c0266e14f86a957944c0cc4ab26ee6)) -* update dependency io.grpc:grpc-bom to v1.46.0 ([#815](https://github.com/googleapis/java-core/issues/815)) ([03c9bfe](https://github.com/googleapis/java-core/commit/03c9bfe4210a6c3995adf89be28b7c8aab402fb3)) -* update opencensus.version to v0.31.1 ([#819](https://github.com/googleapis/java-core/issues/819)) ([1800d3a](https://github.com/googleapis/java-core/commit/1800d3aa3ff7315947681b648f822f2cf9656a3b)) - -### [2.6.1](https://github.com/googleapis/java-core/compare/v2.6.0...v2.6.1) (2022-04-14) - - -### Dependencies - -* update dependency com.google.errorprone:error_prone_annotations to v2.13.0 ([#802](https://github.com/googleapis/java-core/issues/802)) ([042b08e](https://github.com/googleapis/java-core/commit/042b08e3cf05dba7e006f802dbc60f95b6da99ef)) - -## [2.6.0](https://github.com/googleapis/java-core/compare/v2.5.11...v2.6.0) (2022-04-14) - - -### Features - -* **java:** remove GoogleJsonClentFeature and OpenCensusFeature after relocation ([#793](https://github.com/googleapis/java-core/issues/793)) ([2880112](https://github.com/googleapis/java-core/commit/28801121a50583118286419ac91332a201285c4c)) -* **java:** remove Netty Native Image configuration after relocation to gax ([#771](https://github.com/googleapis/java-core/issues/771)) ([9ba04f9](https://github.com/googleapis/java-core/commit/9ba04f9f135e1ff7344bb45eeb5796154616ef20)) -* **java:** remove protobuf Native Image configuration ([#784](https://github.com/googleapis/java-core/issues/784)) ([0bc8549](https://github.com/googleapis/java-core/commit/0bc8549d3364ac169f21cc00c00497cd59998106)) -* remove native-image.properties settings after relocation ([#794](https://github.com/googleapis/java-core/issues/794)) ([e24bfdd](https://github.com/googleapis/java-core/commit/e24bfddbb9f588fbf69cdc0022cdf67f2c628278)) -* remove resource-config after relocation ([#795](https://github.com/googleapis/java-core/issues/795)) ([87e2973](https://github.com/googleapis/java-core/commit/87e29733c3714b39000e5fa3d232c35ce69955a2)) -* remove substitutions after relocation to gax ([#789](https://github.com/googleapis/java-core/issues/789)) ([29291e9](https://github.com/googleapis/java-core/commit/29291e9f50e4500ef5d5c1fe30098d025b216f9a)) - - -### Bug Fixes - -* **java:** register test class for reflection to fix native image test ([#766](https://github.com/googleapis/java-core/issues/766)) ([6fe52c3](https://github.com/googleapis/java-core/commit/6fe52c3424546cad7b8158668d3f8a655b56af41)) - - -### Dependencies - -* revert protobuf to 3.19 and common-protos 2.8.3 ([#798](https://github.com/googleapis/java-core/issues/798)) ([0f36a84](https://github.com/googleapis/java-core/commit/0f36a848a03c50d5d0187241bccd66fdb0cea862)) -* update dependency com.google.api-client:google-api-client-bom to v1.34.0 ([#800](https://github.com/googleapis/java-core/issues/800)) ([8430aee](https://github.com/googleapis/java-core/commit/8430aee231100ef13296f22f09265589b2aa0252)) -* update dependency com.google.api:gax-bom to v2.16.0 ([#785](https://github.com/googleapis/java-core/issues/785)) ([fd435b0](https://github.com/googleapis/java-core/commit/fd435b00f01fac1dc96b5f401b403d67809fa1eb)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.1 ([#792](https://github.com/googleapis/java-core/issues/792)) ([4d201ac](https://github.com/googleapis/java-core/commit/4d201ac5dc694c9e4a4f06c5580a0c707ea68b87)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.2 ([#796](https://github.com/googleapis/java-core/issues/796)) ([dc28a0f](https://github.com/googleapis/java-core/commit/dc28a0f2d58bcf4eb3c9b9f129ce8d88470e94e6)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.0 ([#783](https://github.com/googleapis/java-core/issues/783)) ([4ed5ba4](https://github.com/googleapis/java-core/commit/4ed5ba4d096cb19f60186cbcfc789f5b058b07f8)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.3.1 ([#799](https://github.com/googleapis/java-core/issues/799)) ([fce5315](https://github.com/googleapis/java-core/commit/fce531519184225e103a8faad54e81ae9232210a)) -* update dependency com.google.errorprone:error_prone_annotations to v2.12.1 ([#788](https://github.com/googleapis/java-core/issues/788)) ([4e71f68](https://github.com/googleapis/java-core/commit/4e71f680142bf8cffaa519dcb0fd2916458674e2)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.6 ([#791](https://github.com/googleapis/java-core/issues/791)) ([fe006c6](https://github.com/googleapis/java-core/commit/fe006c60e6cbaff8127a9f6f6792c6a6ce9ff26b)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.7 ([#797](https://github.com/googleapis/java-core/issues/797)) ([570f8d5](https://github.com/googleapis/java-core/commit/570f8d5870044d1f3026b4aec49a6800d904f1be)) -* update dependency com.google.protobuf:protobuf-bom to v3.20.0 ([#787](https://github.com/googleapis/java-core/issues/787)) ([19202bc](https://github.com/googleapis/java-core/commit/19202bcb76e28977e0f2c9b02c75c83644bfb438)) -* update dependency io.grpc:grpc-bom to v1.45.1 ([#780](https://github.com/googleapis/java-core/issues/780)) ([6e3bf35](https://github.com/googleapis/java-core/commit/6e3bf35c501028ac293a401f55c14f1d97fa3953)) - -### [2.5.11](https://github.com/googleapis/java-core/compare/v2.5.10...v2.5.11) (2022-03-28) - - -### Bug Fixes - -* **java:** Register Spanner classes for reflection to fix Native Image tests ([#760](https://github.com/googleapis/java-core/issues/760)) ([257de0f](https://github.com/googleapis/java-core/commit/257de0f71963550ce11aca608fdf9a99672ff19a)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.33.4 ([#776](https://github.com/googleapis/java-core/issues/776)) ([1b6fb2a](https://github.com/googleapis/java-core/commit/1b6fb2a5b9602f5ff8375deb15f5121851b09bd1)) -* update dependency com.google.api:api-common to v2.1.5 ([#768](https://github.com/googleapis/java-core/issues/768)) ([c76c332](https://github.com/googleapis/java-core/commit/c76c332b5676bffad2a1e75b094790c9b0488447)) -* update dependency com.google.api:gax-bom to v2.13.0 ([#774](https://github.com/googleapis/java-core/issues/774)) ([8075c54](https://github.com/googleapis/java-core/commit/8075c54a127496a5330671652678b03f5abdd5c9)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.8.0 ([#770](https://github.com/googleapis/java-core/issues/770)) ([6809477](https://github.com/googleapis/java-core/commit/680947779ac9bc58f60c6c18750aac6b756e73b2)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.10 ([#763](https://github.com/googleapis/java-core/issues/763)) ([9f2eb5f](https://github.com/googleapis/java-core/commit/9f2eb5fed5d9dc91ee01068a2c4eec9acef38c86)) -* update dependency com.google.auth:google-auth-library-bom to v1.6.0 ([#765](https://github.com/googleapis/java-core/issues/765)) ([2eb1924](https://github.com/googleapis/java-core/commit/2eb19241f119f39de7d07ee863c9c78a3e7f11a4)) -* update dependency com.google.guava:guava to 31.1-jre ([#772](https://github.com/googleapis/java-core/issues/772)) ([060adf3](https://github.com/googleapis/java-core/commit/060adf35bf6afdd4b31d790e5484f63eac777a11)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.5 ([#769](https://github.com/googleapis/java-core/issues/769)) ([999be7a](https://github.com/googleapis/java-core/commit/999be7ab10459b33ab001b5bd84d650aeb13313f)) -* update dependency org.threeten:threetenbp to v1.6.0 ([#767](https://github.com/googleapis/java-core/issues/767)) ([9a4a438](https://github.com/googleapis/java-core/commit/9a4a438e04acfd0ec15cdfac5da3610223fe0071)) - -### [2.5.10](https://github.com/googleapis/java-core/compare/v2.5.9...v2.5.10) (2022-03-10) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.9 ([#759](https://github.com/googleapis/java-core/issues/759)) ([9585d4e](https://github.com/googleapis/java-core/commit/9585d4ea8377c087b33e63e46672a79d52e04a4b)) - -### [2.5.9](https://github.com/googleapis/java-core/compare/v2.5.8...v2.5.9) (2022-03-09) - - -### Dependencies - -* update dependency io.grpc:grpc-bom to v1.45.0 ([#756](https://github.com/googleapis/java-core/issues/756)) ([403b10a](https://github.com/googleapis/java-core/commit/403b10accfe2694dc2a5fac63a374d00585df5bb)) - -### [2.5.8](https://github.com/googleapis/java-core/compare/v2.5.7...v2.5.8) (2022-03-08) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.8 ([#753](https://github.com/googleapis/java-core/issues/753)) ([6866b84](https://github.com/googleapis/java-core/commit/6866b8407162ecbff7ed5a6eec5e3e4d130fcfa7)) - -### [2.5.7](https://github.com/googleapis/java-core/compare/v2.5.6...v2.5.7) (2022-03-08) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.7 ([#748](https://github.com/googleapis/java-core/issues/748)) ([91cc595](https://github.com/googleapis/java-core/commit/91cc595c7df73af8e71e4feeb663c973e6bcc8e5)) - -### [2.5.6](https://github.com/googleapis/java-core/compare/v2.5.5...v2.5.6) (2022-03-01) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.6 ([#742](https://github.com/googleapis/java-core/issues/742)) ([474e56c](https://github.com/googleapis/java-core/commit/474e56cca19f9d7b61f62585ee06f1fbdba0ae46)) - -### [2.5.5](https://github.com/googleapis/java-core/compare/v2.5.4...v2.5.5) (2022-02-28) - - -### Bug Fixes - -* **java:** initialize spanner test environment class at build-time ([#734](https://github.com/googleapis/java-core/issues/734)) ([684934e](https://github.com/googleapis/java-core/commit/684934efb28e4ed5f5f975aab91adad25bf1ab52)) -* **java:** initialize TestTag at build time ([#732](https://github.com/googleapis/java-core/issues/732)) ([a5f1dc2](https://github.com/googleapis/java-core/commit/a5f1dc2ed3d71404d699830ba4bea8824e67d0e8)) - - -### Dependencies - -* update actions/setup-java action to v3 ([#739](https://github.com/googleapis/java-core/issues/739)) ([46322e3](https://github.com/googleapis/java-core/commit/46322e3a9929195c223fc6399860c1cab4d81eb5)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.7.4 ([#728](https://github.com/googleapis/java-core/issues/728)) ([3b83bd7](https://github.com/googleapis/java-core/commit/3b83bd7dce6a369c6668f0967572ae08df1b77d8)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.4 ([#729](https://github.com/googleapis/java-core/issues/729)) ([0759c2b](https://github.com/googleapis/java-core/commit/0759c2b8163d45bf87692e2f131df76dac5f178e)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.5 ([#735](https://github.com/googleapis/java-core/issues/735)) ([cefbf97](https://github.com/googleapis/java-core/commit/cefbf978ac21f00b3c4558ebc40ef1f6355ea156)) -* update dependency com.google.auth:google-auth-library-bom to v1.5.3 ([#737](https://github.com/googleapis/java-core/issues/737)) ([a1cb8d8](https://github.com/googleapis/java-core/commit/a1cb8d81db34142937c85be5c4502036a4b7939d)) -* update dependency com.google.code.gson:gson to v2.9.0 ([#727](https://github.com/googleapis/java-core/issues/727)) ([faf8a44](https://github.com/googleapis/java-core/commit/faf8a44e8823ecae44d543e6f5c2a9d8598f04fe)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.4 ([#730](https://github.com/googleapis/java-core/issues/730)) ([1975b61](https://github.com/googleapis/java-core/commit/1975b617e23f7dd0b263e9acb4010b3126e5d7e7)) -* update dependency io.grpc:grpc-bom to v1.44.1 ([#736](https://github.com/googleapis/java-core/issues/736)) ([4ca315c](https://github.com/googleapis/java-core/commit/4ca315ca400e020badbdf27bb92d1b67680a2e73)) - -### [2.5.4](https://github.com/googleapis/java-core/compare/v2.5.3...v2.5.4) (2022-02-11) - - -### Dependencies - -* update actions/github-script action to v6 ([#724](https://github.com/googleapis/java-core/issues/724)) ([b8673d3](https://github.com/googleapis/java-core/commit/b8673d3b3ae08cbfed135cd7ff9d891c04e90611)) - -### [2.5.3](https://github.com/googleapis/java-core/compare/v2.5.2...v2.5.3) (2022-02-10) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.12.2 ([#719](https://github.com/googleapis/java-core/issues/719)) ([4de90d0](https://github.com/googleapis/java-core/commit/4de90d05c152c21a1ebb98f6cbff0f9b9c39e5d2)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.3 ([#720](https://github.com/googleapis/java-core/issues/720)) ([d2a5b4f](https://github.com/googleapis/java-core/commit/d2a5b4ffa598f232b84655a7ac146bfa2e1f24c9)) - -### [2.5.2](https://github.com/googleapis/java-core/compare/v2.5.1...v2.5.2) (2022-02-09) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.3 ([#716](https://github.com/googleapis/java-core/issues/716)) ([100e41e](https://github.com/googleapis/java-core/commit/100e41e092f35f6e6d187de45bb6dc3e4e760052)) - -### [2.5.1](https://github.com/googleapis/java-core/compare/v2.5.0...v2.5.1) (2022-02-08) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.33.2 ([#709](https://github.com/googleapis/java-core/issues/709)) ([de08f4e](https://github.com/googleapis/java-core/commit/de08f4eea6cf4e7813c8da1f6adb28e1e56fd1cd)) -* update dependency com.google.api:api-common to v2.1.4 ([#712](https://github.com/googleapis/java-core/issues/712)) ([9cc49de](https://github.com/googleapis/java-core/commit/9cc49de654d57e8efdb97c8e3c7f9d8723e79eb9)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.7.3 ([#710](https://github.com/googleapis/java-core/issues/710)) ([a5f1991](https://github.com/googleapis/java-core/commit/a5f199157319dfb82cbb24d1b4249d924118de84)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.2 ([#705](https://github.com/googleapis/java-core/issues/705)) ([b8722b9](https://github.com/googleapis/java-core/commit/b8722b998966b21cd2d9e6208627c34ff046accf)) - -## [2.5.0](https://github.com/googleapis/java-core/compare/v2.4.0...v2.5.0) (2022-02-02) - - -### Features - -* add limit support to ReadChannel ([#688](https://github.com/googleapis/java-core/issues/688)) ([476109e](https://github.com/googleapis/java-core/commit/476109e1943c1a9561cc636ffc64ab8cdd1888f9)) - - -### Bug Fixes - -* **java:** Initialize AsyncSSLPrivateKeyMethod (a grpc netty class) at run-time ([#702](https://github.com/googleapis/java-core/issues/702)) ([24146a3](https://github.com/googleapis/java-core/commit/24146a35a10ae06238de9556c24dab5dbd3bcaff)) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.12.0 ([#698](https://github.com/googleapis/java-core/issues/698)) ([c10aab8](https://github.com/googleapis/java-core/commit/c10aab8a57ff0aad07a700540085e2ed7521b1a1)) -* update dependency com.google.protobuf:protobuf-bom to v3.19.4 ([#699](https://github.com/googleapis/java-core/issues/699)) ([5d163f5](https://github.com/googleapis/java-core/commit/5d163f591547cd8e0e508b9c824a17da2074b264)) - -## [2.4.0](https://github.com/googleapis/java-core/compare/v2.3.5...v2.4.0) (2022-01-28) - - -### Features - -* **java:** Add native-image support classes to java-core module ([#637](https://github.com/googleapis/java-core/issues/637)) ([154bc18](https://github.com/googleapis/java-core/commit/154bc18ba86328d29665c502db1d35e265c92bbf)) - - -### Bug Fixes - -* **java:** initialize LoggerFactory at build time ([#685](https://github.com/googleapis/java-core/issues/685)) ([eb3aba2](https://github.com/googleapis/java-core/commit/eb3aba2455a0ab6ffec2c6beb3f3cbb4bcb6008d)) - - -### Dependencies - -* **java:** update actions/github-script action to v5 ([#1339](https://github.com/googleapis/java-core/issues/1339)) ([#689](https://github.com/googleapis/java-core/issues/689)) ([eb462c7](https://github.com/googleapis/java-core/commit/eb462c7b1a005ce37d1be58900a244f6b807e5d5)) -* update dependency com.google.api-client:google-api-client-bom to v1.33.1 ([#684](https://github.com/googleapis/java-core/issues/684)) ([9ff47e6](https://github.com/googleapis/java-core/commit/9ff47e68d0c435d7636d89b03369aabbdfe3663b)) -* update dependency com.google.api:api-common to v2.1.3 ([#694](https://github.com/googleapis/java-core/issues/694)) ([684ae80](https://github.com/googleapis/java-core/commit/684ae805b8d25747830ce9266fd51a287c018cc9)) -* update dependency com.google.api:gax-bom to v2.11.0 ([#677](https://github.com/googleapis/java-core/issues/677)) ([1a578bd](https://github.com/googleapis/java-core/commit/1a578bdee2fa229ffbdd8fdde3d66d7e29dedf98)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.7.2 ([#695](https://github.com/googleapis/java-core/issues/695)) ([1085d2c](https://github.com/googleapis/java-core/commit/1085d2cb1d7e8391f981d1f4b97c7724b0107e94)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.1 ([#667](https://github.com/googleapis/java-core/issues/667)) ([b57ec04](https://github.com/googleapis/java-core/commit/b57ec047234a1a044458980a8cf7de6a3156bf41)) -* update dependency com.google.auth:google-auth-library-bom to v1.4.0 ([#681](https://github.com/googleapis/java-core/issues/681)) ([3273b1e](https://github.com/googleapis/java-core/commit/3273b1ed0b1db610790e7832a6c92797a341cc7d)) -* update dependency com.google.errorprone:error_prone_annotations to v2.11.0 ([#687](https://github.com/googleapis/java-core/issues/687)) ([dc4d18d](https://github.com/googleapis/java-core/commit/dc4d18de86695fddbcb9d221cc53fdca3faf09f5)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.1 ([#683](https://github.com/googleapis/java-core/issues/683)) ([45cb753](https://github.com/googleapis/java-core/commit/45cb7535151cfcffa282b4c8d9cd56265cca2ece)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.2 ([#696](https://github.com/googleapis/java-core/issues/696)) ([f4875c0](https://github.com/googleapis/java-core/commit/f4875c0deecfea3728925e5ee0ef95ee90852301)) -* update dependency com.google.protobuf:protobuf-bom to v3.19.3 ([#674](https://github.com/googleapis/java-core/issues/674)) ([c54f997](https://github.com/googleapis/java-core/commit/c54f9973b71c91c1fde0a1d128957cd022a27902)) -* update dependency io.grpc:grpc-bom to v1.43.2 ([#665](https://github.com/googleapis/java-core/issues/665)) ([752ba6e](https://github.com/googleapis/java-core/commit/752ba6e384c382d0e39d8335640eaaea2beee9e1)) -* update dependency io.grpc:grpc-bom to v1.44.0 ([#693](https://github.com/googleapis/java-core/issues/693)) ([ed85045](https://github.com/googleapis/java-core/commit/ed850455995fc5b5c2dae3595116721316f63698)) -* update dependency org.easymock:easymock to v4 ([#668](https://github.com/googleapis/java-core/issues/668)) ([c36e976](https://github.com/googleapis/java-core/commit/c36e976c0379c1119dfe643dc3131f2e52130c5c)) -* update dependency org.graalvm.sdk:graal-sdk to v22 ([#680](https://github.com/googleapis/java-core/issues/680)) ([0f535f8](https://github.com/googleapis/java-core/commit/0f535f869f7ce68192f821d0f3361634676dddf7)) -* update graalvm.version to v21.3.1 ([#679](https://github.com/googleapis/java-core/issues/679)) ([dfb305a](https://github.com/googleapis/java-core/commit/dfb305acaf9d6db91727e42509fc6b043f07a5ce)) -* update graalvm.version to v22.0.0.2 ([#691](https://github.com/googleapis/java-core/issues/691)) ([780b734](https://github.com/googleapis/java-core/commit/780b734bb4f26fab49065f303d102033b2c3a3d0)) -* update opencensus.version to v0.30.0 ([#646](https://github.com/googleapis/java-core/issues/646)) ([c2caaa7](https://github.com/googleapis/java-core/commit/c2caaa7cb2c094318e611ba2c082a8a31fee21ea)) -* update opencensus.version to v0.31.0 ([#692](https://github.com/googleapis/java-core/issues/692)) ([bdf7d4e](https://github.com/googleapis/java-core/commit/bdf7d4ec05c5314e5f2667287ed3e7cb83667c35)) - -### [2.3.5](https://www.github.com/googleapis/java-core/compare/v2.3.4...v2.3.5) (2022-01-06) - - -### Dependencies - -* update dependency com.google.api:api-common to v2.1.2 ([#661](https://www.github.com/googleapis/java-core/issues/661)) ([0a136d8](https://www.github.com/googleapis/java-core/commit/0a136d8122f6c5042808cbfee9e58dc53e368da6)) -* update gax.version to v2.8.1 ([#663](https://www.github.com/googleapis/java-core/issues/663)) ([7c09aa5](https://www.github.com/googleapis/java-core/commit/7c09aa5729408a395f1a8fae94744f9d33638b1a)) - -### [2.3.4](https://www.github.com/googleapis/java-core/compare/v2.3.3...v2.3.4) (2022-01-06) - - -### Bug Fixes - -* fixed compilation warnings from error prone ([e6e7040](https://www.github.com/googleapis/java-core/commit/e6e7040305b19ec9d5468f4cd44d7a29d0d5e470)) -* **java:** add -ntp flag to native image testing command ([#1299](https://www.github.com/googleapis/java-core/issues/1299)) ([#643](https://www.github.com/googleapis/java-core/issues/643)) ([0f4c1db](https://www.github.com/googleapis/java-core/commit/0f4c1dbbd89d82f5cc86c2b684d6645699b835b3)) -* **java:** run Maven in plain console-friendly mode ([#1301](https://www.github.com/googleapis/java-core/issues/1301)) ([#652](https://www.github.com/googleapis/java-core/issues/652)) ([ab2fa93](https://www.github.com/googleapis/java-core/commit/ab2fa93ba0434f593abb063afad44dc923bf462a)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.33.0 ([#658](https://www.github.com/googleapis/java-core/issues/658)) ([d417ebd](https://www.github.com/googleapis/java-core/commit/d417ebd7bedc9d4e983f32c87a8d61163502cf1d)) -* update dependency com.google.api:gax-bom to v2.8.0 ([#659](https://www.github.com/googleapis/java-core/issues/659)) ([91717ab](https://www.github.com/googleapis/java-core/commit/91717ab9361a31976727b26d08837e8b3838bdb4)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.7.1 ([#656](https://www.github.com/googleapis/java-core/issues/656)) ([ecfbdc1](https://www.github.com/googleapis/java-core/commit/ecfbdc181087d37d38f7911b9962953f5d246434)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.2.0 ([#645](https://www.github.com/googleapis/java-core/issues/645)) ([3926b54](https://www.github.com/googleapis/java-core/commit/3926b5423893635dd709b8fc6037fb896396ff13)) -* update dependency com.google.http-client:google-http-client-bom to v1.41.0 ([#657](https://www.github.com/googleapis/java-core/issues/657)) ([41a5120](https://www.github.com/googleapis/java-core/commit/41a51201a3712f71f6cf3be3c29db68360b2405f)) -* update dependency com.google.protobuf:protobuf-bom to v3.19.2 ([#655](https://www.github.com/googleapis/java-core/issues/655)) ([eb6c037](https://www.github.com/googleapis/java-core/commit/eb6c03729af41e6d7bd9db80644b8ddfd22e78ec)) -* update dependency io.grpc:grpc-bom to v1.43.1 ([#647](https://www.github.com/googleapis/java-core/issues/647)) ([275b882](https://www.github.com/googleapis/java-core/commit/275b882918f7625daeb3e98ab26b7b0a2f2cdb7b)) - -### [2.3.3](https://www.github.com/googleapis/java-core/compare/v2.3.2...v2.3.3) (2021-12-02) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.7.1 ([#640](https://www.github.com/googleapis/java-core/issues/640)) ([18e033b](https://www.github.com/googleapis/java-core/commit/18e033bdafe536a42ada9f93b0a2b502caea0bcf)) - -### [2.3.2](https://www.github.com/googleapis/java-core/compare/v2.3.1...v2.3.2) (2021-12-02) - - -### Dependencies - -* update dependency com.google.api:api-common to v2.1.1 ([#632](https://www.github.com/googleapis/java-core/issues/632)) ([b9bb47a](https://www.github.com/googleapis/java-core/commit/b9bb47a0b0a6b132c516361d23750a92a32e53be)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.7.0 ([#638](https://www.github.com/googleapis/java-core/issues/638)) ([74862a8](https://www.github.com/googleapis/java-core/commit/74862a8864eb7bffe6659d1e2a261dd5b934d6ff)) - -### [2.3.1](https://www.github.com/googleapis/java-core/compare/v2.3.0...v2.3.1) (2021-11-15) - - -### Dependencies - -* update dependency io.grpc:grpc-bom to v1.42.1 ([#629](https://www.github.com/googleapis/java-core/issues/629)) ([85fcd99](https://www.github.com/googleapis/java-core/commit/85fcd99237d7526b1b373d07204c4114c49b08b8)) - -## [2.3.0](https://www.github.com/googleapis/java-core/compare/v2.2.0...v2.3.0) (2021-11-11) - - -### Features - -* next release from main branch is 2.3.0 ([#602](https://www.github.com/googleapis/java-core/issues/602)) ([34fa5f1](https://www.github.com/googleapis/java-core/commit/34fa5f1e750629d4431d5f97eb8b09ee65ebc016)) - - -### Bug Fixes - -* **java:** java 17 dependency arguments ([#1266](https://www.github.com/googleapis/java-core/issues/1266)) ([#612](https://www.github.com/googleapis/java-core/issues/612)) ([5be3eff](https://www.github.com/googleapis/java-core/commit/5be3eff4041ca39d513979b948afe99f27bb1d20)) - - -### Dependencies - -* update dependency com.google.api:api-common to v2.1.0 ([#613](https://www.github.com/googleapis/java-core/issues/613)) ([62d6ab8](https://www.github.com/googleapis/java-core/commit/62d6ab8b5a7c5edb4482d7afda5b87f4832226ca)) -* update dependency com.google.api:gax-bom to v2.7.0 ([#626](https://www.github.com/googleapis/java-core/issues/626)) ([4a1e965](https://www.github.com/googleapis/java-core/commit/4a1e96551e16a5abc5d8f71f9e096a284fc59528)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.7 ([#604](https://www.github.com/googleapis/java-core/issues/604)) ([0d36d59](https://www.github.com/googleapis/java-core/commit/0d36d59e4ff8817ba5984579188bfc6d7745348d)) -* update dependency com.google.auth:google-auth-library-bom to v1.2.2 ([#610](https://www.github.com/googleapis/java-core/issues/610)) ([c5e33d8](https://www.github.com/googleapis/java-core/commit/c5e33d87d211c22a93ea2e0de1776e7f2fbf6ef7)) -* update dependency com.google.auth:google-auth-library-bom to v1.3.0 ([#627](https://www.github.com/googleapis/java-core/issues/627)) ([f4403b2](https://www.github.com/googleapis/java-core/commit/f4403b2af856cc6ce45e2aab277d7e78baa6ecfe)) -* update dependency com.google.code.gson:gson to v2.8.9 ([#615](https://www.github.com/googleapis/java-core/issues/615)) ([ec0e387](https://www.github.com/googleapis/java-core/commit/ec0e387d3c96467218406ef4c5da5e59a11e8b7a)) -* update dependency com.google.errorprone:error_prone_annotations to v2.10.0 ([#618](https://www.github.com/googleapis/java-core/issues/618)) ([21139a8](https://www.github.com/googleapis/java-core/commit/21139a83821b12b5312e470c61b45ca76a0b921a)) -* update dependency com.google.protobuf:protobuf-bom to v3.19.1 ([#609](https://www.github.com/googleapis/java-core/issues/609)) ([28e6333](https://www.github.com/googleapis/java-core/commit/28e6333080fbe10ad8ecdfeef12d80af204f71fd)) -* update dependency io.grpc:grpc-bom to v1.42.0 ([#619](https://www.github.com/googleapis/java-core/issues/619)) ([da4cbd5](https://www.github.com/googleapis/java-core/commit/da4cbd5ccc54a81f89635435a2045cfa0de8d722)) -* update dependency org.threeten:threetenbp to v1.5.2 ([#624](https://www.github.com/googleapis/java-core/issues/624)) ([91eec9d](https://www.github.com/googleapis/java-core/commit/91eec9d83285e10cd9ecf3e75cb99b9a9d40cb89)) - -## [2.2.0](https://www.github.com/googleapis/java-core/compare/v2.1.8...v2.2.0) (2021-10-18) - - -### Features - -* next release from main branch is 2.2.0 ([#596](https://www.github.com/googleapis/java-core/issues/596)) ([cca72b8](https://www.github.com/googleapis/java-core/commit/cca72b82b45e01207bd45c6a2b988981c213c6fd)) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.6.1 ([#600](https://www.github.com/googleapis/java-core/issues/600)) ([a0cff6a](https://www.github.com/googleapis/java-core/commit/a0cff6a83506d1da3a8aacd6eafc39ff1ab11583)) - -### [2.1.8](https://www.github.com/googleapis/java-core/compare/v2.1.7...v2.1.8) (2021-10-15) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.32.2 ([#593](https://www.github.com/googleapis/java-core/issues/593)) ([644fc6f](https://www.github.com/googleapis/java-core/commit/644fc6f728b0791c61d85f34c535c09dff862c1d)) -* update dependency com.google.api:api-common to v2.0.4 ([#585](https://www.github.com/googleapis/java-core/issues/585)) ([ad4e4b7](https://www.github.com/googleapis/java-core/commit/ad4e4b7e076d8bd52bf621615301ec810917db43)) -* update dependency com.google.api:api-common to v2.0.5 ([#589](https://www.github.com/googleapis/java-core/issues/589)) ([c30cc40](https://www.github.com/googleapis/java-core/commit/c30cc40cd8687f79c7154503ee1f602089d62f2d)) -* update dependency com.google.api:gax-bom to v2.6.0 ([#594](https://www.github.com/googleapis/java-core/issues/594)) ([710cbe6](https://www.github.com/googleapis/java-core/commit/710cbe6e5121f118a5f4be327e8eeeceddfa04fb)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.6.0 ([#578](https://www.github.com/googleapis/java-core/issues/578)) ([113b686](https://www.github.com/googleapis/java-core/commit/113b6868f98caa64d713f02729c3f16d878252ff)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.3 ([#574](https://www.github.com/googleapis/java-core/issues/574)) ([338444b](https://www.github.com/googleapis/java-core/commit/338444bd4d169bb7fd41242e790c74596948178b)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.4 ([#584](https://www.github.com/googleapis/java-core/issues/584)) ([57211ce](https://www.github.com/googleapis/java-core/commit/57211ce15e9b1a4c1b7468fed217e4ab46ec0a5d)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.5 ([#587](https://www.github.com/googleapis/java-core/issues/587)) ([55f9f4e](https://www.github.com/googleapis/java-core/commit/55f9f4e084defaf8a243bf21afd67302be802b25)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.6 ([#590](https://www.github.com/googleapis/java-core/issues/590)) ([f534c46](https://www.github.com/googleapis/java-core/commit/f534c462fadb479c6fd934c24ac8cd24e06e2698)) -* update dependency com.google.auth:google-auth-library-bom to v1.2.0 ([#581](https://www.github.com/googleapis/java-core/issues/581)) ([c32d2c5](https://www.github.com/googleapis/java-core/commit/c32d2c552dfa04b8e5eab27a115ac10832898473)) -* update dependency com.google.auth:google-auth-library-bom to v1.2.1 ([#591](https://www.github.com/googleapis/java-core/issues/591)) ([046f95d](https://www.github.com/googleapis/java-core/commit/046f95d8ed0811dd278c40fcfeb2c042e6535996)) -* update dependency com.google.guava:guava-bom to v31 ([#577](https://www.github.com/googleapis/java-core/issues/577)) ([4a987fb](https://www.github.com/googleapis/java-core/commit/4a987fbd3f1bd69b0b923fc9a691fc60908ad1cc)) -* update dependency com.google.http-client:google-http-client-bom to v1.40.1 ([#588](https://www.github.com/googleapis/java-core/issues/588)) ([3d36d77](https://www.github.com/googleapis/java-core/commit/3d36d77e6db9856c276d6263036764c60f32b7b3)) -* update dependency com.google.protobuf:protobuf-bom to v3.18.1 ([#583](https://www.github.com/googleapis/java-core/issues/583)) ([47da21c](https://www.github.com/googleapis/java-core/commit/47da21c793be9477323a234f7e3beaf6b705cd7d)) - -### [2.1.7](https://www.github.com/googleapis/java-core/compare/v2.1.6...v2.1.7) (2021-09-23) - - -### Dependencies - -* update dependency io.grpc:grpc-bom to v1.41.0 ([#569](https://www.github.com/googleapis/java-core/issues/569)) ([36703e9](https://www.github.com/googleapis/java-core/commit/36703e9a1f2d97d465a13220027a27f813da14a8)) - -### [2.1.6](https://www.github.com/googleapis/java-core/compare/v2.1.5...v2.1.6) (2021-09-21) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.5.0 ([#565](https://www.github.com/googleapis/java-core/issues/565)) ([3ce8e28](https://www.github.com/googleapis/java-core/commit/3ce8e28813858ea932dc5c54324441f2f0c52d46)) - -### [2.1.5](https://www.github.com/googleapis/java-core/compare/v2.1.4...v2.1.5) (2021-09-21) - - -### Dependencies - -* downgrading protobuf to 3.17.3 ([#562](https://www.github.com/googleapis/java-core/issues/562)) ([5711b83](https://www.github.com/googleapis/java-core/commit/5711b835a19238df1bfa1f2e4dfc115495a55c9b)) - -### [2.1.4](https://www.github.com/googleapis/java-core/compare/v2.1.3...v2.1.4) (2021-09-15) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.1 ([#556](https://www.github.com/googleapis/java-core/issues/556)) ([095efa1](https://www.github.com/googleapis/java-core/commit/095efa1fc1fffde34c6c38a88fee8f91bd495bfc)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.2 ([#559](https://www.github.com/googleapis/java-core/issues/559)) ([3cda672](https://www.github.com/googleapis/java-core/commit/3cda672059727642d1b90f8bcc6bb34546f6893d)) -* update dependency com.google.protobuf:protobuf-bom to v3.18.0 ([#558](https://www.github.com/googleapis/java-core/issues/558)) ([85766e6](https://www.github.com/googleapis/java-core/commit/85766e67f0a9f381593ea2d6e9c8f30fc0ba2993)) - -### [2.1.3](https://www.github.com/googleapis/java-core/compare/v2.1.2...v2.1.3) (2021-09-10) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.4.1 ([#549](https://www.github.com/googleapis/java-core/issues/549)) ([0b4be35](https://www.github.com/googleapis/java-core/commit/0b4be350d47cab58f3bb4e53d34e913e736a522b)) - -### [2.1.2](https://www.github.com/googleapis/java-core/compare/v2.1.1...v2.1.2) (2021-08-31) - - -### Dependencies - -* update dependency com.google.api:api-common to v2.0.2 ([#534](https://www.github.com/googleapis/java-core/issues/534)) ([1883c81](https://www.github.com/googleapis/java-core/commit/1883c81cb0fdf2f4b34a3a3a17987206d8c452aa)) -* update dependency com.google.api:gax-bom to v2.4.0 ([#540](https://www.github.com/googleapis/java-core/issues/540)) ([06b0d6e](https://www.github.com/googleapis/java-core/commit/06b0d6e3ff3c3b6e2aa440a9f893f9b27e0d66d1)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.5.0 ([#539](https://www.github.com/googleapis/java-core/issues/539)) ([9d5a0b0](https://www.github.com/googleapis/java-core/commit/9d5a0b0918f6a1ab264f1ba272dcd8f22b670a7f)) -* update dependency com.google.http-client:google-http-client-bom to v1.40.0 ([#538](https://www.github.com/googleapis/java-core/issues/538)) ([150e07d](https://www.github.com/googleapis/java-core/commit/150e07ddb884d163d0efbcf786f04a713d29ed81)) -* update dependency io.grpc:grpc-bom to v1.40.1 ([#535](https://www.github.com/googleapis/java-core/issues/535)) ([3cd48a9](https://www.github.com/googleapis/java-core/commit/3cd48a902691ddddb9df9f74517648ca35b5bfd7)) - -### [2.1.1](https://www.github.com/googleapis/java-core/compare/v2.1.0...v2.1.1) (2021-08-24) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.0 ([#531](https://www.github.com/googleapis/java-core/issues/531)) ([1b27f8c](https://www.github.com/googleapis/java-core/commit/1b27f8cbfaffcc9b19103b471db237f2448d7cb8)) - -## [2.1.0](https://www.github.com/googleapis/java-core/compare/v2.0.5...v2.1.0) (2021-08-23) - - -### Features - -* support downloading an emulator from an access controlled URL ([#513](https://www.github.com/googleapis/java-core/issues/513)) ([f42a707](https://www.github.com/googleapis/java-core/commit/f42a7078522461018da96196a67657809d28b15b)) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.3.0 ([#523](https://www.github.com/googleapis/java-core/issues/523)) ([6fa1d96](https://www.github.com/googleapis/java-core/commit/6fa1d96d07a7d255e7564407364216436cad6ca3)) -* update dependency com.google.auth:google-auth-library-bom to v1.1.0 ([#526](https://www.github.com/googleapis/java-core/issues/526)) ([0fc1532](https://www.github.com/googleapis/java-core/commit/0fc1532183148d09c3005a68e528c6c438cb6ddd)) -* update dependency com.google.code.gson:gson to v2.8.8 ([#529](https://www.github.com/googleapis/java-core/issues/529)) ([92b7f97](https://www.github.com/googleapis/java-core/commit/92b7f9715eeab0a07b64437a62dd47e5eed006de)) -* update dependency com.google.errorprone:error_prone_annotations to v2.9.0 ([#528](https://www.github.com/googleapis/java-core/issues/528)) ([5ecba07](https://www.github.com/googleapis/java-core/commit/5ecba07336499fc6fddae4cfdc2bc12105ec9b66)) -* update dependency io.grpc:grpc-bom to v1.40.0 ([#525](https://www.github.com/googleapis/java-core/issues/525)) ([a1e81f7](https://www.github.com/googleapis/java-core/commit/a1e81f73a4cc29e7186adf37f1cb718c1a88f41e)) - -### [2.0.5](https://www.github.com/googleapis/java-core/compare/v2.0.4...v2.0.5) (2021-08-11) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2.1.0 ([#519](https://www.github.com/googleapis/java-core/issues/519)) ([266e2f7](https://www.github.com/googleapis/java-core/commit/266e2f75e83fe1fd635a1528deb38131b8bfc742)) - -### [2.0.4](https://www.github.com/googleapis/java-core/compare/v2.0.3...v2.0.4) (2021-08-11) - - -### Dependencies - -* update dependency com.google.api:api-common to v2.0.1 ([#516](https://www.github.com/googleapis/java-core/issues/516)) ([aa6abf3](https://www.github.com/googleapis/java-core/commit/aa6abf3cc458ca117ec009fb29a14fd4f5409ef3)) - -### [2.0.3](https://www.github.com/googleapis/java-core/compare/v2.0.2...v2.0.3) (2021-08-10) - - -### Dependencies - -* update dependency com.google.errorprone:error_prone_annotations to v2.8.1 ([#512](https://www.github.com/googleapis/java-core/issues/512)) ([6127b8f](https://www.github.com/googleapis/java-core/commit/6127b8f23ec267a4cf8daa794b88a5cd97f054e3)) - -### [2.0.2](https://www.github.com/googleapis/java-core/compare/v2.0.1...v2.0.2) (2021-08-03) - - -### Features - -* release 2.0.2 ([#509](https://www.github.com/googleapis/java-core/issues/509)) ([afbb532](https://www.github.com/googleapis/java-core/commit/afbb532965a9ab6f9e3eafbf9d5d8502dd29d1bb)) - -### [2.0.1](https://www.github.com/googleapis/java-core/compare/v2.0.0...v2.0.1) (2021-08-03) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v2 ([#506](https://www.github.com/googleapis/java-core/issues/506)) ([a0c49a2](https://www.github.com/googleapis/java-core/commit/a0c49a2eb2579df78afccc6db021e78c3bd58493)) - -## [2.0.0](https://www.github.com/googleapis/java-core/compare/v1.95.4...v2.0.0) (2021-07-29) - - -### Features - -* promote to 2.0.0 ([#504](https://www.github.com/googleapis/java-core/issues/504)) ([48076ba](https://www.github.com/googleapis/java-core/commit/48076bafa2a89dc6b3ad88a698166da8ebb144f4)) - - -### Bug Fixes - -* Add shopt -s nullglob to dependencies script ([1fa147c](https://www.github.com/googleapis/java-core/commit/1fa147c9cded08f9eea4a717c622c0b33ad239d0)) -* Update dependencies.sh to not break on mac ([#484](https://www.github.com/googleapis/java-core/issues/484)) ([1fa147c](https://www.github.com/googleapis/java-core/commit/1fa147c9cded08f9eea4a717c622c0b33ad239d0)) - - -### Dependencies - -* update dependency com.google.api:api-common to v1.10.6 ([#494](https://www.github.com/googleapis/java-core/issues/494)) ([1353d7b](https://www.github.com/googleapis/java-core/commit/1353d7b42dc98110733d279404f9295067f632cf)) -* update dependency com.google.api:api-common to v2 ([#497](https://www.github.com/googleapis/java-core/issues/497)) ([05edb6e](https://www.github.com/googleapis/java-core/commit/05edb6ec2156978b49e72f16de35a935acd43ca8)) -* update dependency com.google.api:gax-bom to v1.66.0 ([#483](https://www.github.com/googleapis/java-core/issues/483)) ([0698c66](https://www.github.com/googleapis/java-core/commit/0698c6679877e0666c684ea5c5daaf8ebae7c15c)) -* update dependency com.google.api:gax-bom to v1.67.0 ([#491](https://www.github.com/googleapis/java-core/issues/491)) ([65f4a1e](https://www.github.com/googleapis/java-core/commit/65f4a1e4ace1ec70cd2a151233c626d80874beb4)) -* update dependency com.google.auth:google-auth-library-bom to v0.27.0 ([#489](https://www.github.com/googleapis/java-core/issues/489)) ([21b0afe](https://www.github.com/googleapis/java-core/commit/21b0afea717805dfd5c93929d2a72de86f048781)) -* update dependency com.google.auth:google-auth-library-bom to v1 ([#496](https://www.github.com/googleapis/java-core/issues/496)) ([9cddefc](https://www.github.com/googleapis/java-core/commit/9cddefc0fdb0eb400121db0faf18bf1bdfdfc7f5)) -* update dependency com.google.errorprone:error_prone_annotations to v2.8.0 ([#492](https://www.github.com/googleapis/java-core/issues/492)) ([acd03c0](https://www.github.com/googleapis/java-core/commit/acd03c00896a1e8f6ab948823e5a5ebd5b741115)) -* update dependency io.grpc:grpc-bom to v1.39.0 ([#482](https://www.github.com/googleapis/java-core/issues/482)) ([02e69d4](https://www.github.com/googleapis/java-core/commit/02e69d46d3b8a71b6286915e08e987a5fc9ce8a6)) -* update guava 30.1.1-jre ([#503](https://www.github.com/googleapis/java-core/issues/503)) ([cac0c63](https://www.github.com/googleapis/java-core/commit/cac0c6367d42afb8af2dec56b9eec4de2e95978e)) - -### [1.95.4](https://www.github.com/googleapis/java-core/compare/v1.95.3...v1.95.4) (2021-06-25) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.32.1 ([#479](https://www.github.com/googleapis/java-core/issues/479)) ([5f9f732](https://www.github.com/googleapis/java-core/commit/5f9f73212c8073c3b590206f69a2446c8bce2c75)) - -### [1.95.3](https://www.github.com/googleapis/java-core/compare/v1.95.2...v1.95.3) (2021-06-23) - - -### Dependencies - -* update dependency com.google.api:api-common to v1.10.4 ([#475](https://www.github.com/googleapis/java-core/issues/475)) ([5c8223d](https://www.github.com/googleapis/java-core/commit/5c8223df9d4e30b6f2fadd4985c3bcfc5b0ff4ec)) -* update dependency io.grpc:grpc-bom to v1.38.1 ([#476](https://www.github.com/googleapis/java-core/issues/476)) ([b6a7923](https://www.github.com/googleapis/java-core/commit/b6a7923e255f0146e126bad2296e12e9d591c04d)) - -### [1.95.2](https://www.github.com/googleapis/java-core/compare/v1.95.1...v1.95.2) (2021-06-09) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v1.65.1 ([#471](https://www.github.com/googleapis/java-core/issues/471)) ([3814364](https://www.github.com/googleapis/java-core/commit/381436415073b728b4deb3f82fd129c887205c19)) - -### [1.95.1](https://www.github.com/googleapis/java-core/compare/v1.95.0...v1.95.1) (2021-06-09) - - -### Dependencies - -* update dependency com.google.protobuf:protobuf-bom to v3.17.3 ([#468](https://www.github.com/googleapis/java-core/issues/468)) ([d456df2](https://www.github.com/googleapis/java-core/commit/d456df20269cfb531adf7bcc7694d0ffff7b1962)) - -## [1.95.0](https://www.github.com/googleapis/java-core/compare/v1.94.8...v1.95.0) (2021-06-03) - - -### Features - -* add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#453](https://www.github.com/googleapis/java-core/issues/453)) ([33d8edf](https://www.github.com/googleapis/java-core/commit/33d8edf12d20f2bbdaedb1f1cd5a9194357934f1)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.31.5 ([#446](https://www.github.com/googleapis/java-core/issues/446)) ([fa83a61](https://www.github.com/googleapis/java-core/commit/fa83a618050cdac519eadda5e8a72c2f9cbfeac0)) -* update dependency com.google.api:gax-bom to v1.64.0-sp.1 ([#443](https://www.github.com/googleapis/java-core/issues/443)) ([19efb61](https://www.github.com/googleapis/java-core/commit/19efb61af60bb5867ebc4c603ac528f277ef6ed0)) -* update dependency com.google.api:gax-bom to v1.65.0 ([#464](https://www.github.com/googleapis/java-core/issues/464)) ([bb15bf9](https://www.github.com/googleapis/java-core/commit/bb15bf9fb9cf571afc5050e4eaf055e556cb534b)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.2.2 ([#449](https://www.github.com/googleapis/java-core/issues/449)) ([42bf8ea](https://www.github.com/googleapis/java-core/commit/42bf8eae15854e01566bac7e094f9b08f273c24e)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.3.0 ([#458](https://www.github.com/googleapis/java-core/issues/458)) ([eb930c2](https://www.github.com/googleapis/java-core/commit/eb930c2c690e58d0e1c00abe16ee5671a0bb5144)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.3.1 ([#463](https://www.github.com/googleapis/java-core/issues/463)) ([c2b2907](https://www.github.com/googleapis/java-core/commit/c2b29070e5d07b8c7e1d4c76d297d349f6c4d7a3)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.3.2 ([#466](https://www.github.com/googleapis/java-core/issues/466)) ([fd68350](https://www.github.com/googleapis/java-core/commit/fd683505e85dd92f77d4a9723015f610716283f7)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.14 ([#439](https://www.github.com/googleapis/java-core/issues/439)) ([c32bd33](https://www.github.com/googleapis/java-core/commit/c32bd33a9d79bc4388b75842a629c582e1c91526)) -* update dependency com.google.auth:google-auth-library-bom to v0.26.0 ([#456](https://www.github.com/googleapis/java-core/issues/456)) ([97bb7a9](https://www.github.com/googleapis/java-core/commit/97bb7a9c2beb17169de17e2a2d0aa37c051933ee)) -* update dependency com.google.code.gson:gson to v2.8.7 ([#461](https://www.github.com/googleapis/java-core/issues/461)) ([4381e02](https://www.github.com/googleapis/java-core/commit/4381e02d9147440822b2639e59c4d5ca60b4b3c5)) -* update dependency com.google.errorprone:error_prone_annotations to v2.7.1 ([#451](https://www.github.com/googleapis/java-core/issues/451)) ([8bf562f](https://www.github.com/googleapis/java-core/commit/8bf562f42fca37b8d0b14a498f47a2bf8c49277d)) -* update dependency com.google.protobuf:protobuf-bom to v3.17.0 ([#445](https://www.github.com/googleapis/java-core/issues/445)) ([aa9d87c](https://www.github.com/googleapis/java-core/commit/aa9d87ca138714a47c2d4b3e0bca33037a861959)) -* update dependency com.google.protobuf:protobuf-bom to v3.17.1 ([#460](https://www.github.com/googleapis/java-core/issues/460)) ([4edf784](https://www.github.com/googleapis/java-core/commit/4edf7849261c3b427719a434db2c5dc251facc26)) -* update dependency com.google.protobuf:protobuf-bom to v3.17.2 ([#465](https://www.github.com/googleapis/java-core/issues/465)) ([f9b847a](https://www.github.com/googleapis/java-core/commit/f9b847af7d3660de79a2b68abee33842daabddf8)) -* update dependency io.grpc:grpc-bom to v1.38.0 ([#450](https://www.github.com/googleapis/java-core/issues/450)) ([bde03c1](https://www.github.com/googleapis/java-core/commit/bde03c10c2921f8b2bdf47fdaa0a46c277af382a)) - -### [1.94.8](https://www.github.com/googleapis/java-core/compare/v1.94.7...v1.94.8) (2021-04-23) - - -### Bug Fixes - -* release scripts from issuing overlapping phases ([#432](https://www.github.com/googleapis/java-core/issues/432)) ([289bcab](https://www.github.com/googleapis/java-core/commit/289bcab7d8eeffc1671c3cb4c3e8cc4843d90e1a)) -* typo ([#429](https://www.github.com/googleapis/java-core/issues/429)) ([f1ea2f8](https://www.github.com/googleapis/java-core/commit/f1ea2f8568bc7c5ed9b1d495bdd88446aa3c4135)) - - -### Dependencies - -* update dependency com.google.api:api-common to v1.10.3 ([#437](https://www.github.com/googleapis/java-core/issues/437)) ([e853d98](https://www.github.com/googleapis/java-core/commit/e853d98caca3d5f0312a0fb9bbab0ffe4a0ce6e2)) -* update dependency com.google.auth:google-auth-library-bom to v0.25.4 ([#428](https://www.github.com/googleapis/java-core/issues/428)) ([7cc490d](https://www.github.com/googleapis/java-core/commit/7cc490df5e3d24986e7032f5a93a1f844aaa66d5)) -* update dependency com.google.auth:google-auth-library-bom to v0.25.5 ([#435](https://www.github.com/googleapis/java-core/issues/435)) ([7f7f362](https://www.github.com/googleapis/java-core/commit/7f7f3624a3c436c61a366e5e172592838a4078e0)) -* update dependency org.threeten:threetenbp to v1.5.1 ([#433](https://www.github.com/googleapis/java-core/issues/433)) ([af08225](https://www.github.com/googleapis/java-core/commit/af08225277fb436a53a1a65d60a7be80b786da4b)) - -### [1.94.7](https://www.github.com/googleapis/java-core/compare/v1.94.6...v1.94.7) (2021-04-12) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.31.4 ([#424](https://www.github.com/googleapis/java-core/issues/424)) ([6773b81](https://www.github.com/googleapis/java-core/commit/6773b81893ce9f69ce457e3243bd89b49de6e553)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.12 ([#425](https://www.github.com/googleapis/java-core/issues/425)) ([df2ba7a](https://www.github.com/googleapis/java-core/commit/df2ba7a6aa73d2755382d19a4dfd86bdd6fd927a)) - -### [1.94.6](https://www.github.com/googleapis/java-core/compare/v1.94.5...v1.94.6) (2021-04-09) - - -### Dependencies - -* update dependency com.google.http-client:google-http-client-bom to v1.39.2 ([#420](https://www.github.com/googleapis/java-core/issues/420)) ([541355d](https://www.github.com/googleapis/java-core/commit/541355db1e1652bac87ed7ab4f57c3bf2ba5d469)) - -### [1.94.5](https://www.github.com/googleapis/java-core/compare/v1.94.4...v1.94.5) (2021-04-08) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v1.63.0 ([#415](https://www.github.com/googleapis/java-core/issues/415)) ([31d41f3](https://www.github.com/googleapis/java-core/commit/31d41f310db803c5f84e122256850cf3f6722481)) -* update dependency com.google.auth:google-auth-library-bom to v0.25.2 ([#408](https://www.github.com/googleapis/java-core/issues/408)) ([bfb3cae](https://www.github.com/googleapis/java-core/commit/bfb3caee3d056b6fcbc54a83c1eca36cf58ef72a)) -* update dependency com.google.errorprone:error_prone_annotations to v2.6.0 ([#412](https://www.github.com/googleapis/java-core/issues/412)) ([e78e5d9](https://www.github.com/googleapis/java-core/commit/e78e5d9676ebf8bc44af7f81a282c7436878730f)) -* update dependency com.google.http-client:google-http-client-bom to v1.39.1 ([#407](https://www.github.com/googleapis/java-core/issues/407)) ([9ac757f](https://www.github.com/googleapis/java-core/commit/9ac757fa7e121b0db0f66577ed974d6dc24a803a)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.6 ([#405](https://www.github.com/googleapis/java-core/issues/405)) ([a20bce4](https://www.github.com/googleapis/java-core/commit/a20bce416bfa6556bb7c3518afeca5259fdf23f4)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.7 ([#413](https://www.github.com/googleapis/java-core/issues/413)) ([16d2bf5](https://www.github.com/googleapis/java-core/commit/16d2bf54340e78e8ba9765b531d9cd64089d723e)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.8 ([#418](https://www.github.com/googleapis/java-core/issues/418)) ([101910c](https://www.github.com/googleapis/java-core/commit/101910c3edf25ece32fff2408ee09074c2593d18)) -* update dependency io.grpc:grpc-bom to v1.36.1 ([#410](https://www.github.com/googleapis/java-core/issues/410)) ([e31620a](https://www.github.com/googleapis/java-core/commit/e31620a2f7a15853a1acec8c09416953cc4dce09)) -* update dependency io.grpc:grpc-bom to v1.37.0 ([#416](https://www.github.com/googleapis/java-core/issues/416)) ([690fe8f](https://www.github.com/googleapis/java-core/commit/690fe8fe44b99b6b81175cef4797174ee28b7dac)) -* update guava ([#417](https://www.github.com/googleapis/java-core/issues/417)) ([acaa804](https://www.github.com/googleapis/java-core/commit/acaa804a740c1dbf95498db92e0627339f91dc6f)) - -### [1.94.4](https://www.github.com/googleapis/java-core/compare/v1.94.3...v1.94.4) (2021-03-11) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.11 ([#402](https://www.github.com/googleapis/java-core/issues/402)) ([73d893c](https://www.github.com/googleapis/java-core/commit/73d893c76ab1bef3b69bd55040d9f6c5942b36c5)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.5 ([#399](https://www.github.com/googleapis/java-core/issues/399)) ([a9c2e43](https://www.github.com/googleapis/java-core/commit/a9c2e43e06fcf2f15918359db765fb44d5e28a55)) - -### [1.94.3](https://www.github.com/googleapis/java-core/compare/v1.94.2...v1.94.3) (2021-03-02) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.31.3 ([#394](https://www.github.com/googleapis/java-core/issues/394)) ([278cb03](https://www.github.com/googleapis/java-core/commit/278cb032dd201a9729ef6a6e6e3c177bf9b3cd7e)) -* update dependency com.google.auth:google-auth-library-bom to v0.24.1 ([#390](https://www.github.com/googleapis/java-core/issues/390)) ([9948791](https://www.github.com/googleapis/java-core/commit/99487914834709cd97b283c59ac14fb7b945c9e7)) - -### [1.94.2](https://www.github.com/googleapis/java-core/compare/v1.94.1...v1.94.2) (2021-03-01) - - -### Bug Fixes - -* fix gcloud SDK detection on Windows ([#384](https://www.github.com/googleapis/java-core/issues/384)) ([9545442](https://www.github.com/googleapis/java-core/commit/9545442906b21897c5227fecf8efd264d7c2d84c)), closes [#383](https://www.github.com/googleapis/java-core/issues/383) - - -### Dependencies - -* switch from Jackson to GSON ([#368](https://www.github.com/googleapis/java-core/issues/368)) ([220df17](https://www.github.com/googleapis/java-core/commit/220df176826fe154e36dadd19702c307cc232c16)) -* update dependency com.google.api-client:google-api-client-bom to v1.31.2 ([#359](https://www.github.com/googleapis/java-core/issues/359)) ([107a32a](https://www.github.com/googleapis/java-core/commit/107a32aa170eca0f61e14183af1e795a61291d49)) -* update dependency com.google.api:gax-bom to v1.62.0 ([2374ca7](https://www.github.com/googleapis/java-core/commit/2374ca77df96976c3920963e0e97e9fabd07b625)) -* update dependency com.google.api.grpc:proto-google-common-protos to v2.1.0 ([#387](https://www.github.com/googleapis/java-core/issues/387)) ([c55f950](https://www.github.com/googleapis/java-core/commit/c55f95038865d262b58f5b5c9847df75160876d2)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.10 ([#392](https://www.github.com/googleapis/java-core/issues/392)) ([45b5abf](https://www.github.com/googleapis/java-core/commit/45b5abf7692cc0d7f2c03170b7ec47a6408ccfad)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.5 ([#345](https://www.github.com/googleapis/java-core/issues/345)) ([0a5596d](https://www.github.com/googleapis/java-core/commit/0a5596d8fb5a398b56c7dce07e13d534e3b6c208)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.7 ([#357](https://www.github.com/googleapis/java-core/issues/357)) ([3c2b7b4](https://www.github.com/googleapis/java-core/commit/3c2b7b490c64625ecf9846b097aebcc577511696)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.9 ([#372](https://www.github.com/googleapis/java-core/issues/372)) ([82840da](https://www.github.com/googleapis/java-core/commit/82840da9e99f49471c30f2a95f0d06ae17a76507)) -* update dependency com.google.auth:google-auth-library-bom to v0.22.2 ([#343](https://www.github.com/googleapis/java-core/issues/343)) ([3b418f7](https://www.github.com/googleapis/java-core/commit/3b418f7ae6677e9e44546e7108d985dfbbedbfa4)) -* update dependency com.google.auth:google-auth-library-bom to v0.23.0 ([#364](https://www.github.com/googleapis/java-core/issues/364)) ([7d52e06](https://www.github.com/googleapis/java-core/commit/7d52e06e2df4a0c69f018e3f7dadfc166a5754be)) -* update dependency com.google.auth:google-auth-library-bom to v0.24.0 ([#382](https://www.github.com/googleapis/java-core/issues/382)) ([44d8d02](https://www.github.com/googleapis/java-core/commit/44d8d029e7f15efa3dfbf3df49f48f14a8375a6b)) -* update dependency com.google.errorprone:error_prone_annotations to v2.5.1 ([#354](https://www.github.com/googleapis/java-core/issues/354)) ([e7a688c](https://www.github.com/googleapis/java-core/commit/e7a688c3a20f0c17806ab25c528d69bcafd287c8)) -* update dependency com.google.guava:guava-bom to v30.1-android ([#348](https://www.github.com/googleapis/java-core/issues/348)) ([0f2eadd](https://www.github.com/googleapis/java-core/commit/0f2eadd32020b546e71332bf4009e4c9195ee72a)) -* update dependency com.google.http-client:google-http-client-bom to v1.38.1 ([#358](https://www.github.com/googleapis/java-core/issues/358)) ([8fdc254](https://www.github.com/googleapis/java-core/commit/8fdc2549c9ed15e347e282077b9e36159bd32a2e)) -* update dependency com.google.http-client:google-http-client-bom to v1.39.0 ([2374ca7](https://www.github.com/googleapis/java-core/commit/2374ca77df96976c3920963e0e97e9fabd07b625)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.0 ([#378](https://www.github.com/googleapis/java-core/issues/378)) ([4314da9](https://www.github.com/googleapis/java-core/commit/4314da9fc62eb6e57b0265a6ff4663c450e0ad9f)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.1 ([#381](https://www.github.com/googleapis/java-core/issues/381)) ([09fac9d](https://www.github.com/googleapis/java-core/commit/09fac9d078d8d00716500deabfdecfcecab891ea)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.2 ([#385](https://www.github.com/googleapis/java-core/issues/385)) ([8c2c179](https://www.github.com/googleapis/java-core/commit/8c2c1792df60b9e077534328fc5351c63a745b09)) -* update dependency com.google.protobuf:protobuf-bom to v3.15.3 ([#391](https://www.github.com/googleapis/java-core/issues/391)) ([6e03ce5](https://www.github.com/googleapis/java-core/commit/6e03ce5b571464f8f62a4b4665f21efb527b112a)) -* update dependency io.grpc:grpc-bom to v1.34.1 ([#342](https://www.github.com/googleapis/java-core/issues/342)) ([b80c3da](https://www.github.com/googleapis/java-core/commit/b80c3da61e5b158c78358566289800bea0f8997b)) -* update dependency opencensus to v0.28.0 ([2374ca7](https://www.github.com/googleapis/java-core/commit/2374ca77df96976c3920963e0e97e9fabd07b625)) -* update io.grpc:grpc-bom to v1.36.0 ([#389](https://www.github.com/googleapis/java-core/issues/389)) ([2374ca7](https://www.github.com/googleapis/java-core/commit/2374ca77df96976c3920963e0e97e9fabd07b625)) - -### [1.94.1](https://www.github.com/googleapis/java-core/compare/v1.94.0...v1.94.1) (2020-12-11) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.31.1 ([#331](https://www.github.com/googleapis/java-core/issues/331)) ([e01ec17](https://www.github.com/googleapis/java-core/commit/e01ec179163dfc0069ae34680abaef30b00e05e1)) -* update dependency com.google.api:gax-bom to v1.60.1 ([#340](https://www.github.com/googleapis/java-core/issues/340)) ([e3219b4](https://www.github.com/googleapis/java-core/commit/e3219b46a6a83a95795b77516426859959406d3a)) -* update dependency com.google.protobuf:protobuf-bom to v3.14.0 ([#335](https://www.github.com/googleapis/java-core/issues/335)) ([0fc6971](https://www.github.com/googleapis/java-core/commit/0fc6971a23f720102156de3bbcfe38eeff15fd94)) - -## [1.94.0](https://www.github.com/googleapis/java-core/compare/v1.93.10...v1.94.0) (2020-11-10) - - -### Features - -* **test:** add new MultipleAttemptRule, StdOutCaptureRule & StdErrCaptureRule JUnit 4 rules ([#327](https://www.github.com/googleapis/java-core/issues/327)) ([60f4a66](https://www.github.com/googleapis/java-core/commit/60f4a66ad907f4a838536e405326869487468f35)) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-common-protos to v2.0.1 ([#323](https://www.github.com/googleapis/java-core/issues/323)) ([4b989e8](https://www.github.com/googleapis/java-core/commit/4b989e802f773794babd2403253c81d528c6f661)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.3 ([#324](https://www.github.com/googleapis/java-core/issues/324)) ([a40c71a](https://www.github.com/googleapis/java-core/commit/a40c71ab678c3ec267d43b5cb434b7cb302d1b7e)) -* update dependency com.google.http-client:google-http-client-bom to v1.38.0 ([#325](https://www.github.com/googleapis/java-core/issues/325)) ([48f1da7](https://www.github.com/googleapis/java-core/commit/48f1da709dbfbcffd8faad1f2342c85475ec4e93)) -* update dependency io.grpc:grpc-bom to v1.33.1 ([#319](https://www.github.com/googleapis/java-core/issues/319)) ([8a788a6](https://www.github.com/googleapis/java-core/commit/8a788a606c8a397121a4177e1004ddf582e112ae)) - -### [1.93.10](https://www.github.com/googleapis/java-core/compare/v1.93.9...v1.93.10) (2020-10-30) - - -### Dependencies - -* update core dependencies ([#294](https://www.github.com/googleapis/java-core/issues/294)) ([dcb6a67](https://www.github.com/googleapis/java-core/commit/dcb6a6767d245ac134a1985c450c7ce5a2f2ee29)) -* update core transport dependencies ([#295](https://www.github.com/googleapis/java-core/issues/295)) ([341c032](https://www.github.com/googleapis/java-core/commit/341c032e98c8aac1b6f82a2d026374eaa5cc4c3e)) -* update dependency com.google.api:api-common to v1.10.1 ([#302](https://www.github.com/googleapis/java-core/issues/302)) ([34260c0](https://www.github.com/googleapis/java-core/commit/34260c0befd0ff858c075cfd58da022a3d083ea9)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.2 ([#312](https://www.github.com/googleapis/java-core/issues/312)) ([16e375a](https://www.github.com/googleapis/java-core/commit/16e375abfb6d0bd41c42a785a3b7c19a2e71c483)) -* update dependency com.google.guava:guava-bom to v30 ([#310](https://www.github.com/googleapis/java-core/issues/310)) ([17962f8](https://www.github.com/googleapis/java-core/commit/17962f84301f6d630bc6cc85dcb5ebeb24d94561)) -* update dependency io.grpc:grpc-bom to v1.33.0 ([#309](https://www.github.com/googleapis/java-core/issues/309)) ([e9ac780](https://www.github.com/googleapis/java-core/commit/e9ac780d218928d78ba1fc225576dfe47d85bb8d)) -* update dependency org.threeten:threetenbp to v1.4.5 ([#297](https://www.github.com/googleapis/java-core/issues/297)) ([a0b878f](https://www.github.com/googleapis/java-core/commit/a0b878f8eeebb7e06efb6f8fc8e887d3ddb3e467)) -* update dependency org.threeten:threetenbp to v1.5.0 ([#314](https://www.github.com/googleapis/java-core/issues/314)) ([485b30f](https://www.github.com/googleapis/java-core/commit/485b30f47db8e18d153e6b27db9d39080aee285c)) - -### [1.93.9](https://www.github.com/googleapis/java-core/compare/v1.93.8...v1.93.9) (2020-09-23) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.1 ([#282](https://www.github.com/googleapis/java-core/issues/282)) ([933172c](https://www.github.com/googleapis/java-core/commit/933172c835593ad13c4ae85c0c467b2823ca44da)) -* update dependency com.google.protobuf:protobuf-bom to v3.13.0 ([#273](https://www.github.com/googleapis/java-core/issues/273)) ([4476f33](https://www.github.com/googleapis/java-core/commit/4476f33cab440ff2dcc12597f968d9d719d46e5b)) -* update dependency io.grpc:grpc-bom to v1.32.1 ([#270](https://www.github.com/googleapis/java-core/issues/270)) ([df518d3](https://www.github.com/googleapis/java-core/commit/df518d3445df07811d9be9770f120315af0100b1)) - -### [1.93.8](https://www.github.com/googleapis/java-core/compare/v1.93.7...v1.93.8) (2020-08-12) - - -### Bug Fixes - -* docs of com.google.cloud.Timestamp.parseTimestamp ([#258](https://www.github.com/googleapis/java-core/issues/258)) ([964dd14](https://www.github.com/googleapis/java-core/commit/964dd142609ae8923a285e20746ce9ee8c302bd5)) - - -### Dependencies - -* update core dependencies ([#263](https://www.github.com/googleapis/java-core/issues/263)) ([44023c3](https://www.github.com/googleapis/java-core/commit/44023c34d0b5d1990c5028f6e04479b8d7539e77)) -* update dependency com.google.api-client:google-api-client-bom to v1.30.10 ([#253](https://www.github.com/googleapis/java-core/issues/253)) ([0fd53fe](https://www.github.com/googleapis/java-core/commit/0fd53fe522e35fdd09783bb618ff7dcf01d82a95)) -* update dependency com.google.api:api-common to v1.10.0 ([#261](https://www.github.com/googleapis/java-core/issues/261)) ([1414e01](https://www.github.com/googleapis/java-core/commit/1414e01a8154533d53911933eb86fc785760af6c)) -* update dependency com.google.api.grpc:proto-google-common-protos to v1.18.1 ([#268](https://www.github.com/googleapis/java-core/issues/268)) ([b59a83c](https://www.github.com/googleapis/java-core/commit/b59a83c212f862043de0f5f8fa6ae7bb5d2baba4)) -* update dependency com.google.api.grpc:proto-google-iam-v1 to v1 ([#269](https://www.github.com/googleapis/java-core/issues/269)) ([fe3987e](https://www.github.com/googleapis/java-core/commit/fe3987e2dffb2fe7b7bdd0d48266eba7aad7929b)) -* update dependency com.google.protobuf:protobuf-bom to v3.12.4 ([#262](https://www.github.com/googleapis/java-core/issues/262)) ([2ffca65](https://www.github.com/googleapis/java-core/commit/2ffca65399a716a0b929ae3f1ae388481b187ae2)) - -### [1.93.7](https://www.github.com/googleapis/java-core/compare/v1.93.6...v1.93.7) (2020-07-08) - - -### Dependencies - -* update core dependencies ([#241](https://www.github.com/googleapis/java-core/issues/241)) ([60a4a05](https://www.github.com/googleapis/java-core/commit/60a4a054d54119807aa8d0342f76d2925c35f2a6)) -* update dependency com.google.api:api-common to v1.9.3 ([#250](https://www.github.com/googleapis/java-core/issues/250)) ([792cb60](https://www.github.com/googleapis/java-core/commit/792cb6016cf3d509667e3b03b5f25847c0430af8)) -* update dependency com.google.api:gax-bom to v1.57.1 ([#251](https://www.github.com/googleapis/java-core/issues/251)) ([dd1a8a9](https://www.github.com/googleapis/java-core/commit/dd1a8a9814f244b2516283d23938f8f49a92f190)) -* update dependency com.google.auth:google-auth-library-bom to v0.21.1 ([#252](https://www.github.com/googleapis/java-core/issues/252)) ([4844b26](https://www.github.com/googleapis/java-core/commit/4844b268e81b69e409f887272f3bed30709ec33d)) -* update dependency com.google.errorprone:error_prone_annotations to v2.4.0 ([#226](https://www.github.com/googleapis/java-core/issues/226)) ([b2fd33c](https://www.github.com/googleapis/java-core/commit/b2fd33c3a1dfa8269f67986211af5f93bacdfad9)) -* update dependency com.google.http-client:google-http-client-bom to v1.36.0 ([#248](https://www.github.com/googleapis/java-core/issues/248)) ([34deaf9](https://www.github.com/googleapis/java-core/commit/34deaf94190cfa2aa9dee5edabbe6bf5dccb0a90)) - -### [1.93.6](https://www.github.com/googleapis/java-core/compare/v1.93.5...v1.93.6) (2020-06-12) - - -### Dependencies - -* update dependency com.google.api:api-common to v1.9.1 ([#221](https://www.github.com/googleapis/java-core/issues/221)) ([4df33f0](https://www.github.com/googleapis/java-core/commit/4df33f0da02855161562e80a9d50e52dc21f4693)) -* update dependency com.google.api:api-common to v1.9.2 ([#229](https://www.github.com/googleapis/java-core/issues/229)) ([e8c1aa2](https://www.github.com/googleapis/java-core/commit/e8c1aa2ff9c1eaa4030faa86b403a77fc6602bdb)) -* update dependency com.google.api:gax-bom to v1.57.0 ([#236](https://www.github.com/googleapis/java-core/issues/236)) ([3d7d2a6](https://www.github.com/googleapis/java-core/commit/3d7d2a69ea95d7cd93f1175e0cc7f051fd591ad8)) -* update dependency com.google.protobuf:protobuf-bom to v3.12.2 ([#220](https://www.github.com/googleapis/java-core/issues/220)) ([815569d](https://www.github.com/googleapis/java-core/commit/815569d7274cccd12110062e72dc8774f3b1d3de)) -* update dependency io.grpc:grpc-bom to v1.30.0 ([#233](https://www.github.com/googleapis/java-core/issues/233)) ([b41c34f](https://www.github.com/googleapis/java-core/commit/b41c34f28a2cddddafbb872bbd0100a934972042)) - -### [1.93.5](https://www.github.com/googleapis/java-core/compare/v1.93.4...v1.93.5) (2020-05-26) - - -### Dependencies - -* rely on shared-config for auto-value configuration ([#222](https://www.github.com/googleapis/java-core/issues/222)) ([22adbcf](https://www.github.com/googleapis/java-core/commit/22adbcf307cf5ef4819bad9afa91c4c83a9f31bb)) -* update dependency com.google.api.grpc:proto-google-common-protos to v1.18.0 ([#215](https://www.github.com/googleapis/java-core/issues/215)) ([488a351](https://www.github.com/googleapis/java-core/commit/488a351ab41adafb1d969740bfbd3a6d2ddfd36d)) -* update dependency com.google.guava:guava-bom to v29 ([#205](https://www.github.com/googleapis/java-core/issues/205)) ([48d3f97](https://www.github.com/googleapis/java-core/commit/48d3f970bd931ee5f04205ab939c318c69cbcf3f)) -* update dependency com.google.http-client:google-http-client-bom to v1.35.0 ([#211](https://www.github.com/googleapis/java-core/issues/211)) ([e56b3ef](https://www.github.com/googleapis/java-core/commit/e56b3ef0e2ea5c96b36f8aae851fd26efe1337c1)) -* update dependency com.google.protobuf:protobuf-bom to v3.12.0 ([#218](https://www.github.com/googleapis/java-core/issues/218)) ([b2c6f15](https://www.github.com/googleapis/java-core/commit/b2c6f15ae63302dbeea16ecb7d7b89404907516f)) -* update dependency io.grpc:grpc-bom to v1.29.0 ([#209](https://www.github.com/googleapis/java-core/issues/209)) ([e63cb7c](https://www.github.com/googleapis/java-core/commit/e63cb7ca69e49afae50af1f2cf4fe3601984be49)) -* update dependency org.threeten:threetenbp to v1.4.4 ([#210](https://www.github.com/googleapis/java-core/issues/210)) ([a837fa4](https://www.github.com/googleapis/java-core/commit/a837fa441fbbf83494709b1779e0ef35ef13b345)) - -### [1.93.4](https://www.github.com/googleapis/java-core/compare/v1.93.3...v1.93.4) (2020-04-06) - - -### Dependencies - -* update core dependencies ([#198](https://www.github.com/googleapis/java-core/issues/198)) ([129b3f8](https://www.github.com/googleapis/java-core/commit/129b3f8b03e6809bcae9545a6c2484aa8acc2447)) -* update dependency com.google.api:api-common to v1.9.0 ([#195](https://www.github.com/googleapis/java-core/issues/195)) ([ac19258](https://www.github.com/googleapis/java-core/commit/ac192586f086b91f479e85e4677ac2d10f10968a)) -* update dependency com.google.api:gax-bom to v1.56.0 ([#201](https://www.github.com/googleapis/java-core/issues/201)) ([875c4ed](https://www.github.com/googleapis/java-core/commit/875c4ed001193dfe2c301ad7f163395a568bcb10)) -* update dependency org.threeten:threetenbp to v1.4.3 ([#192](https://www.github.com/googleapis/java-core/issues/192)) ([ce6ec17](https://www.github.com/googleapis/java-core/commit/ce6ec179e4024264c0aee09f85f6f60218d46138)) - -### [1.93.3](https://www.github.com/googleapis/java-core/compare/v1.93.2...v1.93.3) (2020-03-16) - - -### Bug Fixes - -* fix Timestamp.of(java.sql.Timestamp) pre-epoch on exact second ([#179](https://www.github.com/googleapis/java-core/issues/179)) ([9bfb54c](https://www.github.com/googleapis/java-core/commit/9bfb54c5a88c906bebcf90f81ed19aeece09befd)) -* retry SSLException ([#183](https://www.github.com/googleapis/java-core/issues/183)) ([775a848](https://www.github.com/googleapis/java-core/commit/775a84877ef69d22ca7a4392edd0d3680df2256e)) - - -### Dependencies - -* revert gRPC updates ([#181](https://www.github.com/googleapis/java-core/issues/181)) ([f5ba782](https://www.github.com/googleapis/java-core/commit/f5ba782fe7078bd2e02d27d8770ad20a459c73f3)) -* update dependency io.grpc:grpc-bom to v1.28.0 ([#178](https://www.github.com/googleapis/java-core/issues/178)) ([6d5632c](https://www.github.com/googleapis/java-core/commit/6d5632c22507d1d3d36a90778291a6fa25b4788b)) - -### [1.93.2](https://www.github.com/googleapis/java-core/compare/v1.93.1...v1.93.2) (2020-03-10) - - -### Bug Fixes - -* verify correctness of map -> list equality ([#174](https://www.github.com/googleapis/java-core/issues/174)) ([f45d913](https://www.github.com/googleapis/java-core/commit/f45d9131d5d2bbb2cc4cec67ebe82054fda58f55)) - -### [1.93.1](https://www.github.com/googleapis/java-core/compare/v1.93.0...v1.93.1) (2020-02-28) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.30.9 ([#171](https://www.github.com/googleapis/java-core/issues/171)) ([1fdcd5e](https://www.github.com/googleapis/java-core/commit/1fdcd5e839049f650ba7ebb003dea62511c8667f)) - -## [1.93.0](https://www.github.com/googleapis/java-core/compare/v1.92.6...v1.93.0) (2020-02-27) - - -### Features - -* support conditional policies ([#110](https://www.github.com/googleapis/java-core/issues/110)) ([61e2d19](https://www.github.com/googleapis/java-core/commit/61e2d19bb4400978681aa018a8dc200214203830)) - - -### Bug Fixes - -* fix conversion for pre-epoch timestamps ([#160](https://www.github.com/googleapis/java-core/issues/160)) ([1f8b6b4](https://www.github.com/googleapis/java-core/commit/1f8b6b4835aaa702ec94bbbde89ed90f519c935a)) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v1.54.0 ([#168](https://www.github.com/googleapis/java-core/issues/168)) ([5b52f9e](https://www.github.com/googleapis/java-core/commit/5b52f9e8d8cdc82b56114d3d1e857d137ae7ca98)) -* update dependency io.grpc:grpc-bom to v1.27.2 ([#166](https://www.github.com/googleapis/java-core/issues/166)) ([28c9859](https://www.github.com/googleapis/java-core/commit/28c98595c9ee96760a063085bd85024177bd6dd2)) - -### [1.92.5](https://www.github.com/googleapis/java-core/compare/v1.92.4...v1.92.5) (2020-02-10) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.30.8 ([#146](https://www.github.com/googleapis/java-core/issues/146)) ([1d9c7db](https://www.github.com/googleapis/java-core/commit/1d9c7db40502eff9723f27c24be31ecc2fac9c5d)) -* update dependency com.google.protobuf:protobuf-bom to v3.11.3 ([#148](https://www.github.com/googleapis/java-core/issues/148)) ([092c69b](https://www.github.com/googleapis/java-core/commit/092c69bef5b10cf27ef6770e90ae8e50ea205dcd)) - -### [1.92.4](https://www.github.com/googleapis/java-core/compare/v1.92.3...v1.92.4) (2020-01-31) - - -### Dependencies - -* update core dependencies ([#143](https://www.github.com/googleapis/java-core/issues/143)) ([454ce1d](https://www.github.com/googleapis/java-core/commit/454ce1dc5a6a41f3333a2a5303315cd9eb66f442)) - -### [1.92.3](https://www.github.com/googleapis/java-core/compare/v1.92.2...v1.92.3) (2020-01-28) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v1.53.0 ([#126](https://www.github.com/googleapis/java-core/issues/126)) ([bdb1bce](https://www.github.com/googleapis/java-core/commit/bdb1bceb63502c828a37dd50fdb3e0e2204fc0aa)) -* update dependency com.google.auth:google-auth-library-bom to v0.20.0 ([#135](https://www.github.com/googleapis/java-core/issues/135)) ([f40c636](https://www.github.com/googleapis/java-core/commit/f40c6365b1b19bc3360b0094599311bc3271f0e5)) -* update dependency com.google.http-client:google-http-client-bom to v1.34.1 ([#137](https://www.github.com/googleapis/java-core/issues/137)) ([9216702](https://www.github.com/googleapis/java-core/commit/92167026d8e4178ebb952490a3322bd685441a60)) -* update dependency org.threeten:threetenbp to v1.4.1 ([82cac64](https://www.github.com/googleapis/java-core/commit/82cac64486352e46ddc6044a72fff6141d9b10ce)) - -### [1.92.2](https://www.github.com/googleapis/java-core/compare/v1.92.1...v1.92.2) (2020-01-09) - - -### Bug Fixes - -* cast to proper interface ([#124](https://www.github.com/googleapis/java-core/issues/124)) ([cd6eabf](https://www.github.com/googleapis/java-core/commit/cd6eabffcdeed485aba088336fa473a6b85c752d)), closes [#123](https://www.github.com/googleapis/java-core/issues/123) - -### [1.92.1](https://www.github.com/googleapis/java-core/compare/v1.92.0...v1.92.1) (2020-01-02) - - -### Dependencies - -* update dependency com.google.errorprone:error_prone_annotations to v2.3.4 ([#105](https://www.github.com/googleapis/java-core/issues/105)) ([52f47c5](https://www.github.com/googleapis/java-core/commit/52f47c5ed84742b4b41417c486bfbb3c817b4a23)) -* update dependency com.google.guava:guava-bom to v28.2-android ([#113](https://www.github.com/googleapis/java-core/issues/113)) ([8b11b1a](https://www.github.com/googleapis/java-core/commit/8b11b1a8d452ab823f35509ae42263c4a69f2a5a)) -* update dependency com.google.http-client:google-http-client-bom to v1.34.0 ([#98](https://www.github.com/googleapis/java-core/issues/98)) ([d8e946d](https://www.github.com/googleapis/java-core/commit/d8e946dfd3866380406b02ad908925c4250cc34a)) -* update dependency com.google.protobuf:protobuf-bom to v3.11.1 ([#106](https://www.github.com/googleapis/java-core/issues/106)) ([6d36434](https://www.github.com/googleapis/java-core/commit/6d364341bc5552e98590f9344b0e2d8cf4e68f0c)) -* update dependency io.grpc:grpc-bom to v1.26.0 ([#107](https://www.github.com/googleapis/java-core/issues/107)) ([fca41a7](https://www.github.com/googleapis/java-core/commit/fca41a73fb6ca42eb4014d3cec6b32cc8e97ded9)) - -## [1.92.0](https://www.github.com/googleapis/java-core/compare/v1.91.3...v1.92.0) (2019-12-13) - - -### Features - -* increase DEFAULT_CHUNK_SIZE to reduce transfer overhead ([#87](https://www.github.com/googleapis/java-core/issues/87)) ([09b327d](https://www.github.com/googleapis/java-core/commit/09b327daf764403b7800180cab79ae3e38815075)) -* support setting ServiceOption for quota project ([#92](https://www.github.com/googleapis/java-core/issues/92)) ([6aa4476](https://www.github.com/googleapis/java-core/commit/6aa4476441fd7636dd116516d3bf4b738cf8a8a9)) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.30.5 ([#68](https://www.github.com/googleapis/java-core/issues/68)) ([e1a4047](https://www.github.com/googleapis/java-core/commit/e1a4047fb470ea4f80459ca0bb399f4ab2c7decf)) -* update dependency com.google.api:gax-bom to v1.50.1 ([#73](https://www.github.com/googleapis/java-core/issues/73)) ([f493b5b](https://www.github.com/googleapis/java-core/commit/f493b5bbe5945202af6a94fe01407f795014b4a1)) -* update dependency com.google.api:gax-bom to v1.51.0 ([#85](https://www.github.com/googleapis/java-core/issues/85)) ([71d0de7](https://www.github.com/googleapis/java-core/commit/71d0de782432814971facb7cbb67acdec5e45f00)) -* update dependency com.google.auth:google-auth-library-bom to v0.19.0 ([#93](https://www.github.com/googleapis/java-core/issues/93)) ([b465630](https://www.github.com/googleapis/java-core/commit/b465630023dc87537a02a34fb957be340aeb6078)) -* update dependency com.google.http-client:google-http-client-bom to v1.33.0 ([#71](https://www.github.com/googleapis/java-core/issues/71)) ([8f1e690](https://www.github.com/googleapis/java-core/commit/8f1e690611e98855d0eed26d7ef75120bccc862e)) -* update dependency io.grpc:grpc-bom to v1.25.0 ([#72](https://www.github.com/googleapis/java-core/issues/72)) ([3a09fc7](https://www.github.com/googleapis/java-core/commit/3a09fc7c4ce73a3c4f144d0cd4da6d29a1664b75)) -* update to threetenbp 1.4.0 ([#89](https://www.github.com/googleapis/java-core/issues/89)) ([5128bd4](https://www.github.com/googleapis/java-core/commit/5128bd45bae8cbb8540eccd683f5bba52783feef)) - -### [1.91.3](https://www.github.com/googleapis/java-core/compare/v1.91.2...v1.91.3) (2019-10-23) - - -### Bug Fixes - -* try to keep autovalue out of the runtime time classpath ([#48](https://www.github.com/googleapis/java-core/issues/48)) ([0988c27](https://www.github.com/googleapis/java-core/commit/0988c27b01461a0b8c02ac0f9def5b409c56980c)) - - -### Dependencies - -* update dependency com.google.api:gax-bom to v1.49.1 ([#65](https://www.github.com/googleapis/java-core/issues/65)) ([131a0fd](https://www.github.com/googleapis/java-core/commit/131a0fd52bebdd217bdcb288374127cef7889692)) -* update dependency com.google.api.grpc:proto-google-common-protos to v1.17.0 ([#50](https://www.github.com/googleapis/java-core/issues/50)) ([3ba5512](https://www.github.com/googleapis/java-core/commit/3ba55124247b82061781c4ae0acb08cec239afe4)) -* update dependency com.google.auth:google-auth-library-bom to v0.18.0 ([#56](https://www.github.com/googleapis/java-core/issues/56)) ([ab25f15](https://www.github.com/googleapis/java-core/commit/ab25f153021f73b5f0ce5cc2cf0b53d42a1871c7)) -* update dependency io.grpc:grpc-bom to v1.24.1 ([07fefbb](https://www.github.com/googleapis/java-core/commit/07fefbb38de93c2b3b5095bc5432bc5161bb7094)) - -### [1.91.2](https://www.github.com/googleapis/java-core/compare/v1.91.1...v1.91.2) (2019-09-30) - - -### Dependencies - -* update dependency com.google.api.grpc:proto-google-iam-v1 to v0.13.0 ([#40](https://www.github.com/googleapis/java-core/issues/40)) ([4f500cc](https://www.github.com/googleapis/java-core/commit/4f500cc)) -* update dependency io.grpc:grpc-bom to v1.24.0 ([#39](https://www.github.com/googleapis/java-core/issues/39)) ([7f6f780](https://www.github.com/googleapis/java-core/commit/7f6f780)) -* update errorprone to 2.3.3 ([#43](https://www.github.com/googleapis/java-core/issues/43)) ([232694c](https://www.github.com/googleapis/java-core/commit/232694c)) - -### [1.91.1](https://www.github.com/googleapis/java-core/compare/v1.91.0...v1.91.1) (2019-09-25) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.30.4 ([#34](https://www.github.com/googleapis/java-core/issues/34)) ([886eda3](https://www.github.com/googleapis/java-core/commit/886eda3)) -* update dependency com.google.auth:google-auth-library-bom to v0.17.2 ([#35](https://www.github.com/googleapis/java-core/issues/35)) ([ae44c72](https://www.github.com/googleapis/java-core/commit/ae44c72)) -* update dependency com.google.http-client:google-http-client-bom to v1.32.1 ([#31](https://www.github.com/googleapis/java-core/issues/31)) ([4bdf09b](https://www.github.com/googleapis/java-core/commit/4bdf09b)) -* update dependency com.google.protobuf:protobuf-bom to v3.10.0 ([#27](https://www.github.com/googleapis/java-core/issues/27)) ([23e4c26](https://www.github.com/googleapis/java-core/commit/23e4c26)) -* update guava to 28.1-android ([#32](https://www.github.com/googleapis/java-core/issues/32)) ([0279479](https://www.github.com/googleapis/java-core/commit/0279479)) - -## [1.91.0](https://www.github.com/googleapis/java-core/compare/v1.90.0...v1.91.0) (2019-09-18) - - -### Dependencies - -* update dependency com.google.api-client:google-api-client-bom to v1.30.3 ([#21](https://www.github.com/googleapis/java-core/issues/21)) ([fcd67f8](https://www.github.com/googleapis/java-core/commit/fcd67f8)) -* update opencensus packages to v0.24.0 ([#22](https://www.github.com/googleapis/java-core/issues/22)) ([4b21afa](https://www.github.com/googleapis/java-core/commit/4b21afa)) - - -### Documentation - -* fix Kokoro badge link ([19d79d6](https://www.github.com/googleapis/java-core/commit/19d79d6)) -* fix README versions and CI Status table ([6e3ccf3](https://www.github.com/googleapis/java-core/commit/6e3ccf3)) -* update README with a better project description ([#17](https://www.github.com/googleapis/java-core/issues/17)) ([018d4d5](https://www.github.com/googleapis/java-core/commit/018d4d5)) - - -### Features - -* add google-cloud-core-bom artifact ([#13](https://www.github.com/googleapis/java-core/issues/13)) ([3cb19a0](https://www.github.com/googleapis/java-core/commit/3cb19a0)) diff --git a/codecov.yaml b/codecov.yaml deleted file mode 100644 index 5724ea9478..0000000000 --- a/codecov.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -codecov: - ci: - - source.cloud.google.com diff --git a/google-cloud-core-bom/pom.xml b/google-cloud-core-bom/pom.xml deleted file mode 100644 index 1eaece9ecf..0000000000 --- a/google-cloud-core-bom/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-core-bom - 2.9.5-SNAPSHOT - pom - - com.google.cloud - google-cloud-shared-config - 1.5.5 - - - Google Cloud Core - https://github.com/googleapis/java-core - - BOM for Google Cloud Core - - - - Google LLC - - - - - chingor13 - Jeff Ching - chingor@google.com - Google LLC - - Developer - - - - - - scm:git:https://github.com/googleapis/java-core.git - scm:git:git@github.com:googleapis/java-core.git - https://github.com/googleapis/java-core - - - - - sonatype-nexus-snapshots - https://google.oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://google.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - - com.google.cloud - google-cloud-core - 2.9.5-SNAPSHOT - - - com.google.cloud - google-cloud-core-grpc - 2.9.5-SNAPSHOT - - - com.google.cloud - google-cloud-core-http - 2.9.5-SNAPSHOT - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - - diff --git a/google-cloud-core-grpc/pom.xml b/google-cloud-core-grpc/pom.xml deleted file mode 100644 index 3a1ac27eb4..0000000000 --- a/google-cloud-core-grpc/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-core-grpc - 2.9.5-SNAPSHOT - jar - Google Cloud Core gRPC - https://github.com/googleapis/java-core - - Core gRPC module for the google-cloud. - - - com.google.cloud - google-cloud-core-parent - 2.9.5-SNAPSHOT - - - google-cloud-core-grpc - - - - com.google.auth - google-auth-library-credentials - - - com.google.cloud - google-cloud-core - - - com.google.guava - guava - - - com.google.api - gax - - - com.google.api - gax-grpc - - - com.google.api - api-common - - - io.grpc - grpc-api - - - com.google.http-client - google-http-client - - - junit - junit - test - - - org.easymock - easymock - test - - - diff --git a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/BaseGrpcServiceException.java b/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/BaseGrpcServiceException.java deleted file mode 100644 index dffa4d37ee..0000000000 --- a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/BaseGrpcServiceException.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2017 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.grpc; - -import com.google.api.client.http.HttpResponseException; -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.rpc.ApiException; -import com.google.cloud.BaseServiceException; -import com.google.common.base.MoreObjects; -import java.io.IOException; -import java.util.Collections; - -/** Base class for all exceptions from grpc-based services. */ -public class BaseGrpcServiceException extends BaseServiceException { - - private static final long serialVersionUID = -2685197215731335549L; - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseGrpcServiceException(String message, Throwable cause, int code, boolean retryable) { - super( - ExceptionData.newBuilder() - .setMessage(message) - .setCause(cause) - .setCode(code) - .setRetryable(retryable) - .build()); - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseGrpcServiceException(IOException exception, boolean idempotent) { - super(makeExceptionData(exception, idempotent)); - } - - private static ExceptionData makeExceptionData(IOException exception, boolean idempotent) { - int code = UNKNOWN_CODE; - Boolean retryable = null; - if (exception instanceof HttpResponseException) { - // In cases where an exception is an instance of HttpResponseException, - // check the status code to determine whether it's retryable - code = ((HttpResponseException) exception).getStatusCode(); - retryable = - BaseServiceException.isRetryable(code, null, idempotent, Collections.emptySet()); - } - return ExceptionData.newBuilder() - .setMessage(exception.getMessage()) - .setCause(exception) - .setRetryable( - MoreObjects.firstNonNull( - retryable, BaseServiceException.isRetryable(idempotent, exception))) - .setCode(code) - .setReason(null) - .setLocation(null) - .setDebugInfo(null) - .build(); - } - - @BetaApi - public BaseGrpcServiceException(ApiException apiException) { - super( - ExceptionData.newBuilder() - .setMessage(apiException.getMessage()) - .setCause(apiException) - .setRetryable(apiException.isRetryable()) - .setCode(apiException.getStatusCode().getCode().getHttpStatusCode()) - .setReason(apiException.getStatusCode().getCode().name()) - .setLocation(null) - .setDebugInfo(null) - .build()); - } -} diff --git a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/GrpcTransportOptions.java b/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/GrpcTransportOptions.java deleted file mode 100644 index 4db83253a3..0000000000 --- a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/GrpcTransportOptions.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2016 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.grpc; - -import static com.google.common.base.MoreObjects.firstNonNull; - -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.CredentialsProvider; -import com.google.api.gax.core.FixedCredentialsProvider; -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.auth.Credentials; -import com.google.cloud.NoCredentials; -import com.google.cloud.ServiceOptions; -import com.google.cloud.TransportOptions; -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Objects; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** Class representing service options for those services that use gRPC as the transport layer. */ -public class GrpcTransportOptions implements TransportOptions { - - private static final long serialVersionUID = -9049538465533951165L; - private final String executorFactoryClassName; - - private transient ExecutorFactory executorFactory; - - /** Shared thread pool executor. */ - private static final SharedResourceHolder.Resource EXECUTOR = - new SharedResourceHolder.Resource() { - @Override - public ScheduledExecutorService create() { - ScheduledThreadPoolExecutor service = - new ScheduledThreadPoolExecutor( - 8, - new ThreadFactoryBuilder() - .setDaemon(true) - .setNameFormat("grpc-transport-%d") - .build()); - service.setKeepAliveTime(5, TimeUnit.SECONDS); - service.allowCoreThreadTimeOut(true); - service.setRemoveOnCancelPolicy(true); - return service; - } - - @Override - public void close(ScheduledExecutorService instance) { - instance.shutdown(); - } - }; - - /** - * An interface for {@link ExecutorService} factories. Implementations of this interface can be - * used to provide an user-defined executor to execute requests. Any implementation of this - * interface must override the {@code get()} method to return the desired executor. The {@code - * release(executor)} method should be overriden to free resources used by the executor (if - * needed) according to application's logic. - * - *

Implementation must provide a public no-arg constructor. Loading of a factory implementation - * is done via {@link java.util.ServiceLoader}. - * - * @param the {@link ExecutorService} subclass created by this factory - */ - public interface ExecutorFactory { - - /** Gets an executor service instance. */ - T get(); - - /** Releases resources used by the executor and possibly shuts it down. */ - void release(T executor); - } - - @InternalApi - public static class DefaultExecutorFactory implements ExecutorFactory { - - private static final DefaultExecutorFactory INSTANCE = new DefaultExecutorFactory(); - - @Override - public ScheduledExecutorService get() { - return SharedResourceHolder.get(EXECUTOR); - } - - @Override - public synchronized void release(ScheduledExecutorService executor) { - SharedResourceHolder.release(EXECUTOR, executor); - } - } - - /** Builder for {@code GrpcTransportOptions}. */ - public static class Builder { - - private ExecutorFactory executorFactory; - - private Builder() {} - - private Builder(GrpcTransportOptions options) { - executorFactory = options.executorFactory; - } - - public GrpcTransportOptions build() { - return new GrpcTransportOptions(this); - } - - /** - * Sets the scheduled executor factory. This method can be used to provide an user-defined - * scheduled executor to execute requests. - * - * @return the builder - */ - public Builder setExecutorFactory(ExecutorFactory executorFactory) { - this.executorFactory = executorFactory; - return this; - } - } - - @SuppressWarnings("unchecked") - private GrpcTransportOptions(Builder builder) { - executorFactory = - firstNonNull( - builder.executorFactory, - ServiceOptions.getFromServiceLoader( - ExecutorFactory.class, DefaultExecutorFactory.INSTANCE)); - executorFactoryClassName = executorFactory.getClass().getName(); - } - - /** Returns a scheduled executor service provider. */ - public ExecutorFactory getExecutorFactory() { - return executorFactory; - } - - /** Returns a builder for API call settings. */ - @Deprecated - public UnaryCallSettings.Builder getApiCallSettings(RetrySettings retrySettings) { - return UnaryCallSettings.newUnaryCallSettingsBuilder().setRetrySettings(retrySettings); - } - - /** Returns a channel provider from the given default provider. */ - @BetaApi - public static TransportChannelProvider setUpChannelProvider( - InstantiatingGrpcChannelProvider.Builder providerBuilder, - ServiceOptions serviceOptions) { - providerBuilder.setEndpoint(serviceOptions.getHost()); - return providerBuilder.build(); - } - - public static CredentialsProvider setUpCredentialsProvider(ServiceOptions serviceOptions) { - Credentials scopedCredentials = serviceOptions.getScopedCredentials(); - if (scopedCredentials != null && scopedCredentials != NoCredentials.getInstance()) { - return FixedCredentialsProvider.create(scopedCredentials); - } - return NoCredentialsProvider.create(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - @Override - public int hashCode() { - return Objects.hash(executorFactoryClassName); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - GrpcTransportOptions other = (GrpcTransportOptions) obj; - return Objects.equals(executorFactoryClassName, other.executorFactoryClassName); - } - - private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException { - input.defaultReadObject(); - executorFactory = ServiceOptions.newInstance(executorFactoryClassName); - } - - public static Builder newBuilder() { - return new Builder(); - } -} diff --git a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/LogExceptionRunnable.java b/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/LogExceptionRunnable.java deleted file mode 100644 index 40fd6884c1..0000000000 --- a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/LogExceptionRunnable.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.grpc; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.Throwables; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * This class was copied from grpc-core to prevent dependence on an unstable API that may be subject - * to changes - * (https://github.com/grpc/grpc-java/blob/d07ecbe037d2705a1c9f4b6345581f860e505b56/core/src/main/java/io/grpc/internal/LogExceptionRunnable.java) - * - *

A simple wrapper for a {@link Runnable} that logs any exception thrown by it, before - * re-throwing it. - */ -final class LogExceptionRunnable implements Runnable { - - private static final Logger log = Logger.getLogger(LogExceptionRunnable.class.getName()); - - private final Runnable task; - - public LogExceptionRunnable(Runnable task) { - this.task = checkNotNull(task, "task"); - } - - @Override - public void run() { - try { - task.run(); - } catch (Throwable t) { - log.log(Level.SEVERE, "Exception while executing runnable " + task, t); - Throwables.throwIfUnchecked(t); - throw new AssertionError(t); - } - } - - @Override - public String toString() { - return "LogExceptionRunnable(" + task + ")"; - } -} diff --git a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/SharedResourceHolder.java b/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/SharedResourceHolder.java deleted file mode 100644 index c8fc6a886b..0000000000 --- a/google-cloud-core-grpc/src/main/java/com/google/cloud/grpc/SharedResourceHolder.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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.grpc; - -import com.google.common.base.Preconditions; -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import java.util.IdentityHashMap; -import java.util.concurrent.*; - -/** - * This class was copied from grpc-core to prevent dependence on an unstable API that may be subject - * to changes - * (https://github.com/grpc/grpc-java/blob/d07ecbe037d2705a1c9f4b6345581f860e505b56/core/src/main/java/io/grpc/internal/SharedResourceHolder.java) - * - *

A holder for shared resource singletons. - * - *

Components like client channels and servers need certain resources, e.g. a thread pool, to - * run. If the user has not provided such resources, these components will use a default one, which - * is shared as a static resource. This class holds these default resources and manages their - * life-cycles. - * - *

A resource is identified by the reference of a {@link Resource} object, which is typically a - * singleton, provided to the get() and release() methods. Each Resource object (not its class) maps - * to an object cached in the holder. - * - *

Resources are ref-counted and shut down after a delay when the ref-count reaches zero. - */ -final class SharedResourceHolder { - static final long DESTROY_DELAY_SECONDS = 1; - - // The sole holder instance. - private static final SharedResourceHolder holder = - new SharedResourceHolder( - new ScheduledExecutorFactory() { - @Override - public ScheduledExecutorService createScheduledExecutor() { - return Executors.newSingleThreadScheduledExecutor( - getThreadFactory("grpc-shared-destroyer-%d", true)); - } - }); - - private final IdentityHashMap, Instance> instances = new IdentityHashMap<>(); - - private final ScheduledExecutorFactory destroyerFactory; - - private ScheduledExecutorService destroyer; - - // Visible to tests that would need to create instances of the holder. - SharedResourceHolder(ScheduledExecutorFactory destroyerFactory) { - this.destroyerFactory = destroyerFactory; - } - - private static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) { - return new ThreadFactoryBuilder().setDaemon(daemon).setNameFormat(nameFormat).build(); - } - - /** - * Try to get an existing instance of the given resource. If an instance does not exist, create a - * new one with the given factory. - * - * @param resource the singleton object that identifies the requested static resource - */ - public static T get(Resource resource) { - return holder.getInternal(resource); - } - - /** - * Releases an instance of the given resource. - * - *

The instance must have been obtained from {@link #get(Resource)}. Otherwise will throw - * IllegalArgumentException. - * - *

Caller must not release a reference more than once. It's advisory that you clear the - * reference to the instance with the null returned by this method. - * - * @param resource the singleton Resource object that identifies the released static resource - * @param instance the released static resource - * @return a null which the caller can use to clear the reference to that instance. - */ - public static T release(final Resource resource, final T instance) { - return holder.releaseInternal(resource, instance); - } - - /** - * Visible to unit tests. - * - * @see #get(Resource) - */ - @SuppressWarnings("unchecked") - synchronized T getInternal(Resource resource) { - Instance instance = instances.get(resource); - if (instance == null) { - instance = new Instance(resource.create()); - instances.put(resource, instance); - } - if (instance.destroyTask != null) { - instance.destroyTask.cancel(false); - instance.destroyTask = null; - } - instance.refcount++; - return (T) instance.payload; - } - - /** Visible to unit tests. */ - synchronized T releaseInternal(final Resource resource, final T instance) { - final Instance cached = instances.get(resource); - if (cached == null) { - throw new IllegalArgumentException("No cached instance found for " + resource); - } - Preconditions.checkArgument(instance == cached.payload, "Releasing the wrong instance"); - Preconditions.checkState(cached.refcount > 0, "Refcount has already reached zero"); - cached.refcount--; - if (cached.refcount == 0) { - Preconditions.checkState(cached.destroyTask == null, "Destroy task already scheduled"); - // Schedule a delayed task to destroy the resource. - if (destroyer == null) { - destroyer = destroyerFactory.createScheduledExecutor(); - } - cached.destroyTask = - destroyer.schedule( - new LogExceptionRunnable( - new Runnable() { - @Override - public void run() { - synchronized (SharedResourceHolder.this) { - // Refcount may have gone up since the task was scheduled. Re-check it. - if (cached.refcount == 0) { - try { - resource.close(instance); - } finally { - instances.remove(resource); - if (instances.isEmpty()) { - destroyer.shutdown(); - destroyer = null; - } - } - } - } - } - }), - DESTROY_DELAY_SECONDS, - TimeUnit.SECONDS); - } - // Always returning null - return null; - } - - /** Defines a resource, and the way to create and destroy instances of it. */ - public interface Resource { - /** Create a new instance of the resource. */ - T create(); - - /** Destroy the given instance. */ - void close(T instance); - } - - interface ScheduledExecutorFactory { - ScheduledExecutorService createScheduledExecutor(); - } - - private static class Instance { - final Object payload; - int refcount; - ScheduledFuture destroyTask; - - Instance(Object payload) { - this.payload = payload; - } - } -} diff --git a/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/BaseGrpcServiceExceptionTest.java b/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/BaseGrpcServiceExceptionTest.java deleted file mode 100644 index 696de60c55..0000000000 --- a/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/BaseGrpcServiceExceptionTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2017 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.grpc; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import com.google.api.gax.grpc.GrpcStatusCode; -import com.google.api.gax.rpc.InternalException; -import com.google.cloud.BaseServiceException; -import com.google.cloud.RetryHelper; -import io.grpc.Status.Code; -import java.io.IOException; -import java.net.SocketException; -import java.net.SocketTimeoutException; -import org.junit.Test; - -public class BaseGrpcServiceExceptionTest { - - private static final String MESSAGE = "some message"; - private static final boolean NOT_RETRYABLE = false; - private static final boolean IDEMPOTENT = true; - - @Test - public void testBaseServiceException() { - BaseGrpcServiceException serviceException = null; - - IOException exception = new SocketTimeoutException(); - serviceException = new BaseGrpcServiceException(exception, IDEMPOTENT); - assertTrue(serviceException.isRetryable()); - assertNull(serviceException.getMessage()); - assertEquals(exception, serviceException.getCause()); - assertNull(serviceException.getReason()); - assertNull(serviceException.getLocation()); - assertNull(serviceException.getDebugInfo()); - - exception = new SocketException(); - serviceException = new BaseGrpcServiceException(exception, IDEMPOTENT); - assertTrue(serviceException.isRetryable()); - assertNull(serviceException.getMessage()); - assertEquals(exception, serviceException.getCause()); - assertNull(serviceException.getReason()); - assertNull(serviceException.getLocation()); - assertNull(serviceException.getDebugInfo()); - - exception = new IOException("insufficient data written"); - serviceException = new BaseGrpcServiceException(exception, IDEMPOTENT); - assertTrue(serviceException.isRetryable()); - assertEquals("insufficient data written", serviceException.getMessage()); - assertEquals(exception, serviceException.getCause()); - assertNull(serviceException.getReason()); - assertNull(serviceException.getLocation()); - assertNull(serviceException.getDebugInfo()); - - Exception cause = new IllegalArgumentException("bad arg"); - InternalException apiException = - new InternalException(MESSAGE, cause, GrpcStatusCode.of(Code.INTERNAL), NOT_RETRYABLE); - serviceException = new BaseGrpcServiceException(apiException); - assertFalse(serviceException.isRetryable()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(apiException, serviceException.getCause()); - assertEquals(500, serviceException.getCode()); - assertEquals(Code.INTERNAL.name(), serviceException.getReason()); - assertNull(serviceException.getLocation()); - assertNull(serviceException.getDebugInfo()); - } - - @Test - public void testTranslateAndThrow() throws Exception { - IOException exception = new SocketTimeoutException(); - BaseGrpcServiceException cause = new BaseGrpcServiceException(exception, IDEMPOTENT); - RetryHelper.RetryHelperException exceptionMock = - createMock(RetryHelper.RetryHelperException.class); - expect(exceptionMock.getCause()).andReturn(cause).times(2); - replay(exceptionMock); - try { - BaseServiceException.translate(exceptionMock); - } catch (BaseServiceException ex) { - assertEquals(0, ex.getCode()); - assertNull(ex.getMessage()); - assertTrue(ex.isRetryable()); - } finally { - verify(exceptionMock); - } - } -} diff --git a/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/GrpcTransportOptionsTest.java b/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/GrpcTransportOptionsTest.java deleted file mode 100644 index b51eab96ce..0000000000 --- a/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/GrpcTransportOptionsTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2016 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.grpc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import com.google.cloud.grpc.GrpcTransportOptions.DefaultExecutorFactory; -import com.google.cloud.grpc.GrpcTransportOptions.ExecutorFactory; -import java.util.concurrent.ScheduledExecutorService; -import org.easymock.EasyMock; -import org.junit.Test; - -public class GrpcTransportOptionsTest { - - private static final ExecutorFactory MOCK_EXECUTOR_FACTORY = - EasyMock.createMock(ExecutorFactory.class); - private static final GrpcTransportOptions OPTIONS = - GrpcTransportOptions.newBuilder().setExecutorFactory(MOCK_EXECUTOR_FACTORY).build(); - private static final GrpcTransportOptions DEFAULT_OPTIONS = - GrpcTransportOptions.newBuilder().build(); - private static final GrpcTransportOptions OPTIONS_COPY = OPTIONS.toBuilder().build(); - - @Test - public void testBuilder() { - assertSame(MOCK_EXECUTOR_FACTORY, OPTIONS.getExecutorFactory()); - assertTrue(DEFAULT_OPTIONS.getExecutorFactory() instanceof DefaultExecutorFactory); - } - - @Test - public void testBaseEquals() { - assertEquals(OPTIONS, OPTIONS_COPY); - assertNotEquals(DEFAULT_OPTIONS, OPTIONS); - GrpcTransportOptions options = - OPTIONS.toBuilder().setExecutorFactory(new DefaultExecutorFactory()).build(); - assertNotEquals(OPTIONS, options); - } - - @Test - public void testBaseHashCode() { - assertEquals(OPTIONS.hashCode(), OPTIONS_COPY.hashCode()); - assertNotEquals(DEFAULT_OPTIONS.hashCode(), OPTIONS.hashCode()); - GrpcTransportOptions options = - OPTIONS.toBuilder().setExecutorFactory(new DefaultExecutorFactory()).build(); - assertNotEquals(OPTIONS.hashCode(), options.hashCode()); - } - - @Test - public void testDefaultExecutorFactory() { - ExecutorFactory executorFactory = new DefaultExecutorFactory(); - ScheduledExecutorService executorService = executorFactory.get(); - assertSame(executorService, executorFactory.get()); - } -} diff --git a/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/SharedResourceHolderTest.java b/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/SharedResourceHolderTest.java deleted file mode 100644 index ba70a0de55..0000000000 --- a/google-cloud-core-grpc/src/test/java/com/google/cloud/grpc/SharedResourceHolderTest.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * 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.grpc; - -import static org.easymock.EasyMock.*; -import static org.junit.Assert.*; - -import java.util.LinkedList; -import java.util.concurrent.Delayed; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import org.easymock.EasyMock; -import org.easymock.IAnswer; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * This class was copied from grpc-core to prevent dependence on an unstable API that may be subject - * to changes - * (https://github.com/grpc/grpc-java/blob/d07ecbe037d2705a1c9f4b6345581f860e505b56/core/src/test/java/io/grpc/internal/SharedResourceHolderTest.java) - * - *

Unit tests for {@link SharedResourceHolder}. - */ -@RunWith(JUnit4.class) -public class SharedResourceHolderTest { - - private final LinkedList> scheduledDestroyTasks = new LinkedList<>(); - - private SharedResourceHolder holder; - - private static class ResourceInstance { - volatile boolean closed; - } - - private static class ResourceFactory implements SharedResourceHolder.Resource { - @Override - public ResourceInstance create() { - return new ResourceInstance(); - } - - @Override - public void close(ResourceInstance instance) { - instance.closed = true; - } - } - - // Defines two kinds of resources - private static final SharedResourceHolder.Resource SHARED_FOO = - new ResourceFactory(); - private static final SharedResourceHolder.Resource SHARED_BAR = - new ResourceFactory(); - - @Before - public void setUp() { - holder = new SharedResourceHolder(new MockExecutorFactory()); - } - - @Test - public void destroyResourceWhenRefCountReachesZero() { - ResourceInstance foo1 = holder.getInternal(SHARED_FOO); - ResourceInstance sharedFoo = foo1; - ResourceInstance foo2 = holder.getInternal(SHARED_FOO); - assertSame(sharedFoo, foo2); - - ResourceInstance bar1 = holder.getInternal(SHARED_BAR); - ResourceInstance sharedBar = bar1; - - foo2 = holder.releaseInternal(SHARED_FOO, foo2); - // foo refcount not reached 0, thus shared foo is not closed - assertTrue(scheduledDestroyTasks.isEmpty()); - assertFalse(sharedFoo.closed); - assertNull(foo2); - - foo1 = holder.releaseInternal(SHARED_FOO, foo1); - assertNull(foo1); - - // foo refcount has reached 0, a destroying task is scheduled - assertEquals(1, scheduledDestroyTasks.size()); - MockScheduledFuture scheduledDestroyTask = scheduledDestroyTasks.poll(); - assertEquals( - SharedResourceHolder.DESTROY_DELAY_SECONDS, - scheduledDestroyTask.getDelay(TimeUnit.SECONDS)); - - // Simluate that the destroyer executes the foo destroying task - scheduledDestroyTask.runTask(); - assertTrue(sharedFoo.closed); - - // After the destroying, obtaining a foo will get a different instance - ResourceInstance foo3 = holder.getInternal(SHARED_FOO); - assertNotSame(sharedFoo, foo3); - - holder.releaseInternal(SHARED_BAR, bar1); - - // bar refcount has reached 0, a destroying task is scheduled - assertEquals(1, scheduledDestroyTasks.size()); - scheduledDestroyTask = scheduledDestroyTasks.poll(); - assertEquals( - SharedResourceHolder.DESTROY_DELAY_SECONDS, - scheduledDestroyTask.getDelay(TimeUnit.SECONDS)); - - // Simulate that the destroyer executes the bar destroying task - scheduledDestroyTask.runTask(); - assertTrue(sharedBar.closed); - } - - @Test - public void cancelDestroyTask() { - ResourceInstance foo1 = holder.getInternal(SHARED_FOO); - ResourceInstance sharedFoo = foo1; - holder.releaseInternal(SHARED_FOO, foo1); - // A destroying task for foo is scheduled - MockScheduledFuture scheduledDestroyTask = scheduledDestroyTasks.poll(); - assertFalse(scheduledDestroyTask.cancelled); - - // obtaining a foo before the destroying task is executed will cancel the destroy - ResourceInstance foo2 = holder.getInternal(SHARED_FOO); - assertTrue(scheduledDestroyTask.cancelled); - assertTrue(scheduledDestroyTasks.isEmpty()); - assertFalse(sharedFoo.closed); - - // And it will be the same foo instance - assertSame(sharedFoo, foo2); - - // Release it and the destroying task is scheduled again - holder.releaseInternal(SHARED_FOO, foo2); - scheduledDestroyTask = scheduledDestroyTasks.poll(); - assertNotNull(scheduledDestroyTask); - assertFalse(scheduledDestroyTask.cancelled); - scheduledDestroyTask.runTask(); - assertTrue(sharedFoo.closed); - } - - @Test - public void releaseWrongInstance() { - ResourceInstance uncached = new ResourceInstance(); - try { - holder.releaseInternal(SHARED_FOO, uncached); - fail("Should throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - ResourceInstance cached = holder.getInternal(SHARED_FOO); - try { - holder.releaseInternal(SHARED_FOO, uncached); - fail("Should throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - holder.releaseInternal(SHARED_FOO, cached); - } - - @Test - public void overreleaseInstance() { - ResourceInstance foo1 = holder.getInternal(SHARED_FOO); - holder.releaseInternal(SHARED_FOO, foo1); - try { - holder.releaseInternal(SHARED_FOO, foo1); - fail("Should throw IllegalStateException"); - } catch (IllegalStateException e) { - // expected - } - } - - @Test - public void handleInstanceCloseError() { - class ExceptionOnCloseResource implements SharedResourceHolder.Resource { - @Override - public ResourceInstance create() { - return new ResourceInstance(); - } - - @Override - public void close(ResourceInstance instance) { - throw new RuntimeException(); - } - } - - SharedResourceHolder.Resource resource = new ExceptionOnCloseResource(); - ResourceInstance instance = holder.getInternal(resource); - holder.releaseInternal(resource, instance); - MockScheduledFuture scheduledDestroyTask = scheduledDestroyTasks.poll(); - try { - scheduledDestroyTask.runTask(); - fail("Should throw RuntimeException"); - } catch (RuntimeException e) { - // expected - } - - // Future resource fetches should not get the partially-closed one. - assertNotSame(instance, holder.getInternal(resource)); - } - - private class MockExecutorFactory implements SharedResourceHolder.ScheduledExecutorFactory { - @Override - public ScheduledExecutorService createScheduledExecutor() { - ScheduledExecutorService mockExecutor = createNiceMock(ScheduledExecutorService.class); - expect(mockExecutor.schedule(anyObject(Runnable.class), anyLong(), anyObject(TimeUnit.class))) - .andAnswer( - new IAnswer() { - @Override - public ScheduledFuture answer() throws Throwable { - Object[] args = EasyMock.getCurrentArguments(); - Runnable command = (Runnable) args[0]; - long delay = (Long) args[1]; - TimeUnit unit = (TimeUnit) args[2]; - MockScheduledFuture future = - new MockScheduledFuture<>(command, delay, unit); - scheduledDestroyTasks.add(future); - return future; - } - }) - .anyTimes(); - replay(mockExecutor); - return mockExecutor; - } - } - - protected static class MockScheduledFuture implements java.util.concurrent.ScheduledFuture { - private boolean cancelled; - private boolean finished; - final Runnable command; - final long delay; - final TimeUnit unit; - - MockScheduledFuture(Runnable command, long delay, TimeUnit unit) { - this.command = command; - this.delay = delay; - this.unit = unit; - } - - void runTask() { - command.run(); - finished = true; - } - - @Override - public boolean cancel(boolean interrupt) { - if (cancelled || finished) { - return false; - } - cancelled = true; - return true; - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public long getDelay(TimeUnit targetUnit) { - return targetUnit.convert(this.delay, this.unit); - } - - @Override - public int compareTo(Delayed o) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean isDone() { - return cancelled || finished; - } - - @Override - public V get() { - throw new UnsupportedOperationException(); - } - - @Override - public V get(long timeout, TimeUnit unit) { - throw new UnsupportedOperationException(); - } - } -} diff --git a/google-cloud-core-http/pom.xml b/google-cloud-core-http/pom.xml deleted file mode 100644 index 9949bf5dcc..0000000000 --- a/google-cloud-core-http/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-core-http - 2.9.5-SNAPSHOT - jar - Google Cloud Core HTTP - https://github.com/googleapis/java-core - - Core http module for the google-cloud. - - - com.google.cloud - google-cloud-core-parent - 2.9.5-SNAPSHOT - - - google-cloud-core-http - - - - com.google.cloud - google-cloud-core - - - com.google.auth - google-auth-library-credentials - - - com.google.auth - google-auth-library-oauth2-http - - - com.google.http-client - google-http-client - - - com.google.guava - guava - - - com.google.api-client - google-api-client - - - com.google.http-client - google-http-client-appengine - - - com.google.api - gax - - - com.google.api - gax-httpjson - - - com.google.code.findbugs - jsr305 - - - io.opencensus - opencensus-api - - - io.opencensus - opencensus-contrib-http-util - - - com.google.api - api-common - - - - - junit - junit - test - - - org.easymock - easymock - test - - - com.google.truth - truth - test - - - diff --git a/google-cloud-core-http/src/main/java/com/google/cloud/http/BaseHttpServiceException.java b/google-cloud-core-http/src/main/java/com/google/cloud/http/BaseHttpServiceException.java deleted file mode 100644 index 26f43b276f..0000000000 --- a/google-cloud-core-http/src/main/java/com/google/cloud/http/BaseHttpServiceException.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2017 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.http; - -import com.google.api.client.googleapis.json.GoogleJsonError; -import com.google.api.client.googleapis.json.GoogleJsonResponseException; -import com.google.api.client.http.HttpResponseException; -import com.google.api.core.InternalApi; -import com.google.cloud.BaseServiceException; -import com.google.common.base.MoreObjects; -import java.io.IOException; -import java.util.Set; - -/** Base class for all exceptions from http-based services. */ -public class BaseHttpServiceException extends BaseServiceException { - - private static final long serialVersionUID = -5793034110344127954L; - public static final int UNKNOWN_CODE = 0; - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseHttpServiceException( - IOException exception, boolean idempotent, Set retryableErrors) { - super(makeExceptionData(exception, idempotent, retryableErrors)); - } - - private static ExceptionData makeExceptionData( - IOException exception, boolean idempotent, Set retryableErrors) { - int code = UNKNOWN_CODE; - String reason = null; - String location = null; - String debugInfo = null; - Boolean retryable = null; - if (exception instanceof HttpResponseException) { - if (exception instanceof GoogleJsonResponseException) { - GoogleJsonError jsonError = ((GoogleJsonResponseException) exception).getDetails(); - if (jsonError != null) { - BaseServiceException.Error error = - new BaseServiceException.Error(jsonError.getCode(), reason(jsonError)); - code = error.getCode(); - reason = error.getReason(); - retryable = error.isRetryable(idempotent, retryableErrors); - if (reason != null) { - GoogleJsonError.ErrorInfo errorInfo = jsonError.getErrors().get(0); - location = errorInfo.getLocation(); - debugInfo = (String) errorInfo.get("debugInfo"); - } - } else { - code = ((GoogleJsonResponseException) exception).getStatusCode(); - retryable = BaseServiceException.isRetryable(code, null, idempotent, retryableErrors); - } - } else { - // In cases where an exception is an instance of HttpResponseException but not - // an instance of GoogleJsonResponseException, check the status code to determine whether - // it's retryable - code = ((HttpResponseException) exception).getStatusCode(); - retryable = BaseServiceException.isRetryable(code, null, idempotent, retryableErrors); - } - } - return ExceptionData.newBuilder() - .setMessage(message(exception)) - .setCause(exception) - .setRetryable( - MoreObjects.firstNonNull( - retryable, BaseServiceException.isRetryable(idempotent, exception))) - .setCode(code) - .setReason(reason) - .setLocation(location) - .setDebugInfo(debugInfo) - .build(); - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseHttpServiceException( - GoogleJsonError googleJsonError, - boolean idempotent, - Set retryableErrors) { - super(makeExceptionData(googleJsonError, idempotent, retryableErrors)); - } - - private static ExceptionData makeExceptionData( - GoogleJsonError googleJsonError, - boolean idempotent, - Set retryableErrors) { - int code = googleJsonError.getCode(); - String reason = reason(googleJsonError); - - ExceptionData.Builder exceptionData = ExceptionData.newBuilder(); - exceptionData - .setMessage(googleJsonError.getMessage()) - .setCause(null) - .setRetryable(BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors)) - .setCode(code) - .setReason(reason); - if (reason != null) { - GoogleJsonError.ErrorInfo errorInfo = googleJsonError.getErrors().get(0); - exceptionData.setLocation(errorInfo.getLocation()); - exceptionData.setDebugInfo((String) errorInfo.get("debugInfo")); - } else { - exceptionData.setLocation(null); - exceptionData.setDebugInfo(null); - } - return exceptionData.build(); - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseHttpServiceException( - int code, - String message, - String reason, - boolean idempotent, - Set retryableErrors) { - this(code, message, reason, idempotent, retryableErrors, null); - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseHttpServiceException( - int code, - String message, - String reason, - boolean idempotent, - Set retryableErrors, - Throwable cause) { - super( - ExceptionData.newBuilder() - .setMessage(message) - .setCause(cause) - .setRetryable( - BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors)) - .setCode(code) - .setReason(reason) - .setLocation(null) - .setDebugInfo(null) - .build()); - } - - private static String reason(GoogleJsonError error) { - if (error.getErrors() != null && !error.getErrors().isEmpty()) { - return error.getErrors().get(0).getReason(); - } - return null; - } - - private static String message(IOException exception) { - if (exception instanceof GoogleJsonResponseException) { - GoogleJsonError details = ((GoogleJsonResponseException) exception).getDetails(); - if (details != null) { - return details.getMessage(); - } - } - return exception.getMessage(); - } -} diff --git a/google-cloud-core-http/src/main/java/com/google/cloud/http/CensusHttpModule.java b/google-cloud-core-http/src/main/java/com/google/cloud/http/CensusHttpModule.java deleted file mode 100644 index d141507cc0..0000000000 --- a/google-cloud-core-http/src/main/java/com/google/cloud/http/CensusHttpModule.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2018 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.http; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.client.http.HttpExecuteInterceptor; -import com.google.api.client.http.HttpHeaders; -import com.google.api.client.http.HttpRequest; -import com.google.api.client.http.HttpRequestInitializer; -import com.google.common.annotations.VisibleForTesting; -import io.opencensus.contrib.http.util.HttpPropagationUtil; -import io.opencensus.trace.SpanContext; -import io.opencensus.trace.Tracer; -import io.opencensus.trace.propagation.TextFormat; -import java.io.IOException; -import javax.annotation.Nullable; - -/** - * Provides utilities for Open Census to record http stats/trace information and propagate tracing - * context. - */ -public final class CensusHttpModule { - - /** - * OpenCensus tracing component. When no OpenCensus implementation is provided, it will return a - * no-op tracer. - */ - private final Tracer tracer; - - /** {@link TextFormat} used in tracing context propagation. */ - @Nullable private final TextFormat propagationTextFormat; - - /** {@link TextFormat.Setter} for {@link #propagationTextFormat}. */ - @Nullable private final TextFormat.Setter propagationTextFormatSetter; - - /** Whether spans are stored locally. */ - private final boolean isRecordEvents; - - /** Default HTTP propagation text formatter. */ - @VisibleForTesting - static final class DefaultPropagationTextFormatSetter extends TextFormat.Setter { - static final TextFormat.Setter INSTANCE = new DefaultPropagationTextFormatSetter(); - - @Override - public void put(HttpHeaders carrier, String key, String value) { - carrier.set(key, value); - } - } - - /** - * An {@link HttpExecuteInterceptor} implementation to inject HTTP request and add getContext - * information before it is executed. - */ - @VisibleForTesting - final class CensusHttpExecuteInterceptor implements HttpExecuteInterceptor { - @Nullable HttpExecuteInterceptor interceptor; - - CensusHttpExecuteInterceptor(HttpExecuteInterceptor interceptor) { - this.interceptor = interceptor; - } - - @Override - public void intercept(HttpRequest request) throws IOException { - checkNotNull(request); - if (this.interceptor != null) { - this.interceptor.intercept(request); - } - if (propagationTextFormat != null && propagationTextFormatSetter != null) { - SpanContext spanContext = tracer.getCurrentSpan().getContext(); - if (!SpanContext.INVALID.equals(spanContext)) { - propagationTextFormat.inject( - spanContext, request.getHeaders(), propagationTextFormatSetter); - } - } - } - } - - /** - * An {@link HttpRequestInitializer} implementation to set {@link CensusHttpExecuteInterceptor} as - * interceptor. - */ - @VisibleForTesting - final class CensusHttpRequestInitializer implements HttpRequestInitializer { - @Nullable HttpRequestInitializer initializer; - - CensusHttpRequestInitializer(HttpRequestInitializer initializer) { - this.initializer = initializer; - } - - @Override - public void initialize(HttpRequest request) throws IOException { - checkNotNull(request); - if (this.initializer != null) { - this.initializer.initialize(request); - } - request.setInterceptor(new CensusHttpExecuteInterceptor(request.getInterceptor())); - } - } - - /** - * Creates a {@link CensusHttpModule} with given parameters. - * - * @param tracer the OpenCensus {@code Tracer}. - * @param isRecordEvents whether spans are stored locally. - */ - public CensusHttpModule(Tracer tracer, boolean isRecordEvents) { - checkNotNull(tracer, "tracer"); - this.tracer = tracer; - this.isRecordEvents = isRecordEvents; - this.propagationTextFormat = HttpPropagationUtil.getCloudTraceFormat(); - this.propagationTextFormatSetter = DefaultPropagationTextFormatSetter.INSTANCE; - } - - /** - * Returns the tracing component of OpenCensus. - * - * @return the tracing component of OpenCensus. - */ - public Tracer getTracer() { - return tracer; - } - - /** - * Returns whether spans are stored locally. - * - * @return whether spans are stored locally. - */ - public boolean isRecordEvents() { - return isRecordEvents; - } - - /** - * Returns the {@link HttpExecuteInterceptor} used when initializing the {@link HttpRequest}. - * - * @param initializer the original initializer which will be executed before this initializer. - * @return the {@code HttpExecuteInterceptor}. - */ - public HttpRequestInitializer getHttpRequestInitializer(HttpRequestInitializer initializer) { - return new CensusHttpRequestInitializer(initializer); - } -} diff --git a/google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java b/google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java deleted file mode 100644 index 4bdfee3cca..0000000000 --- a/google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2016 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.http; - -import static com.google.common.base.MoreObjects.firstNonNull; - -import com.google.api.client.extensions.appengine.http.UrlFetchTransport; -import com.google.api.client.http.HttpRequest; -import com.google.api.client.http.HttpRequestInitializer; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.gax.core.GaxProperties; -import com.google.api.gax.httpjson.HttpHeadersUtils; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.HeaderProvider; -import com.google.auth.Credentials; -import com.google.auth.http.HttpCredentialsAdapter; -import com.google.auth.http.HttpTransportFactory; -import com.google.cloud.NoCredentials; -import com.google.cloud.PlatformInformation; -import com.google.cloud.ServiceOptions; -import com.google.cloud.TransportOptions; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Objects; - -/** Class representing service options for those services that use HTTP as the transport layer. */ -public class HttpTransportOptions implements TransportOptions { - - private static final long serialVersionUID = 7890117765045419810L; - private final int connectTimeout; - private final int readTimeout; - private final String httpTransportFactoryClassName; - - private transient HttpTransportFactory httpTransportFactory; - - public static class DefaultHttpTransportFactory implements HttpTransportFactory { - - private static final HttpTransportFactory INSTANCE = new DefaultHttpTransportFactory(); - - @Override - public HttpTransport create() { - // Consider App Engine Standard - if (PlatformInformation.isOnGAEStandard7()) { - try { - return new UrlFetchTransport(); - } catch (Exception ignore) { - // Maybe not on App Engine - } - } - return new NetHttpTransport(); - } - } - - /** Builder for {@code HttpTransportOptions}. */ - public static class Builder { - - private HttpTransportFactory httpTransportFactory; - private int connectTimeout = -1; - private int readTimeout = -1; - - private Builder() {} - - private Builder(HttpTransportOptions options) { - httpTransportFactory = options.httpTransportFactory; - connectTimeout = options.connectTimeout; - readTimeout = options.readTimeout; - } - - public HttpTransportOptions build() { - return new HttpTransportOptions(this); - } - - /** - * Sets the HTTP transport factory. - * - * @return the builder - */ - public Builder setHttpTransportFactory(HttpTransportFactory httpTransportFactory) { - this.httpTransportFactory = httpTransportFactory; - return this; - } - - /** - * Sets the timeout in milliseconds to establish a connection. - * - * @param connectTimeout connection timeout in milliseconds. 0 for an infinite timeout, a - * negative number for the default value (20000). - * @return the builder - */ - public Builder setConnectTimeout(int connectTimeout) { - this.connectTimeout = connectTimeout; - return this; - } - - /** - * Sets the timeout in milliseconds to read data from an established connection. - * - * @param readTimeout read timeout in milliseconds. 0 for an infinite timeout, a negative number - * for the default value (20000). - * @return the builder - */ - public Builder setReadTimeout(int readTimeout) { - this.readTimeout = readTimeout; - return this; - } - } - - public HttpTransportOptions(Builder builder) { - httpTransportFactory = - firstNonNull( - builder.httpTransportFactory, - ServiceOptions.getFromServiceLoader( - HttpTransportFactory.class, DefaultHttpTransportFactory.INSTANCE)); - httpTransportFactoryClassName = httpTransportFactory.getClass().getName(); - connectTimeout = builder.connectTimeout; - readTimeout = builder.readTimeout; - } - - /** Returns the HTTP transport factory. */ - public HttpTransportFactory getHttpTransportFactory() { - return httpTransportFactory; - } - - /** - * Returns a request initializer responsible for initializing requests according to service - * options. - */ - public HttpRequestInitializer getHttpRequestInitializer( - final ServiceOptions serviceOptions) { - Credentials scopedCredentials = serviceOptions.getScopedCredentials(); - final HttpRequestInitializer delegate = - scopedCredentials != null && scopedCredentials != NoCredentials.getInstance() - ? new HttpCredentialsAdapter(scopedCredentials) - : null; - HeaderProvider internalHeaderProvider = - getInternalHeaderProviderBuilder(serviceOptions).build(); - final HeaderProvider headerProvider = - serviceOptions.getMergedHeaderProvider(internalHeaderProvider); - - return new HttpRequestInitializer() { - @Override - public void initialize(HttpRequest httpRequest) throws IOException { - if (delegate != null) { - delegate.initialize(httpRequest); - } - if (connectTimeout >= 0) { - httpRequest.setConnectTimeout(connectTimeout); - } - if (readTimeout >= 0) { - httpRequest.setReadTimeout(readTimeout); - } - - HttpHeadersUtils.setHeaders(httpRequest.getHeaders(), headerProvider.getHeaders()); - } - }; - } - - ApiClientHeaderProvider.Builder getInternalHeaderProviderBuilder( - ServiceOptions serviceOptions) { - ApiClientHeaderProvider.Builder builder = ApiClientHeaderProvider.newBuilder(); - builder.setClientLibToken( - ServiceOptions.getGoogApiClientLibName(), - GaxProperties.getLibraryVersion(serviceOptions.getClass())); - builder.setQuotaProjectIdToken(serviceOptions.getQuotaProjectId()); - return builder; - } - - /** - * Returns the timeout in milliseconds to establish a connection. 0 is an infinite timeout, a - * negative number is the default value (20000). - */ - public int getConnectTimeout() { - return connectTimeout; - } - - /** - * Returns the timeout in milliseconds to read from an established connection. 0 is an infinite - * timeout, a negative number is the default value (20000). - */ - public int getReadTimeout() { - return readTimeout; - } - - public Builder toBuilder() { - return new Builder(this); - } - - @Override - public int hashCode() { - return Objects.hash(httpTransportFactoryClassName, connectTimeout, readTimeout); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - HttpTransportOptions other = (HttpTransportOptions) obj; - return Objects.equals(httpTransportFactoryClassName, other.httpTransportFactoryClassName) - && Objects.equals(connectTimeout, other.connectTimeout) - && Objects.equals(readTimeout, other.readTimeout); - } - - private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException { - input.defaultReadObject(); - httpTransportFactory = ServiceOptions.newInstance(httpTransportFactoryClassName); - } - - public static Builder newBuilder() { - return new Builder(); - } -} diff --git a/google-cloud-core-http/src/test/java/com/google/cloud/http/BaseHttpServiceExceptionTest.java b/google-cloud-core-http/src/test/java/com/google/cloud/http/BaseHttpServiceExceptionTest.java deleted file mode 100644 index e88a32a9af..0000000000 --- a/google-cloud-core-http/src/test/java/com/google/cloud/http/BaseHttpServiceExceptionTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2017 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.http; - -import static com.google.cloud.BaseServiceException.UNKNOWN_CODE; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import com.google.api.client.googleapis.json.GoogleJsonError; -import com.google.cloud.BaseServiceException; -import com.google.cloud.RetryHelper; -import com.google.common.collect.ImmutableSet; -import java.io.IOException; -import java.net.SocketException; -import java.net.SocketTimeoutException; -import java.util.Collections; -import java.util.Set; -import org.junit.Test; - -public class BaseHttpServiceExceptionTest { - - private static final int CODE = 1; - private static final int CODE_NO_REASON = 2; - private static final String MESSAGE = "some message"; - private static final String REASON = "some reason"; - private static final boolean RETRYABLE = true; - private static final boolean IDEMPOTENT = true; - private static final boolean NOT_IDEMPOTENT = false; - private static final Set EMPTY_RETRYABLE_ERRORS = - Collections.emptySet(); - - private static class CustomServiceException extends BaseHttpServiceException { - - private static final long serialVersionUID = -195251309124875103L; - - public CustomServiceException(int code, String message, String reason, boolean idempotent) { - super(code, message, reason, idempotent, RETRYABLE_ERRORS); - } - - private static final Set RETRYABLE_ERRORS = - ImmutableSet.of( - new Error(CODE, REASON), new Error(null, REASON), new Error(CODE_NO_REASON, null)); - } - - @Test - public void testBaseServiceException() { - BaseServiceException serviceException = - new BaseHttpServiceException(CODE, MESSAGE, REASON, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertFalse(serviceException.isRetryable()); - assertNull(serviceException.getCause()); - - serviceException = - new BaseHttpServiceException(CODE, MESSAGE, REASON, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertFalse(serviceException.isRetryable()); - assertNull(serviceException.getCause()); - - Exception cause = new RuntimeException(); - serviceException = - new BaseHttpServiceException( - CODE, MESSAGE, REASON, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS, cause); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertFalse(serviceException.isRetryable()); - assertEquals(cause, serviceException.getCause()); - - serviceException = - new BaseHttpServiceException( - CODE, MESSAGE, REASON, NOT_IDEMPOTENT, EMPTY_RETRYABLE_ERRORS, cause); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertFalse(serviceException.isRetryable()); - assertEquals(cause, serviceException.getCause()); - - IOException exception = new SocketTimeoutException(); - serviceException = new BaseHttpServiceException(exception, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - assertTrue(serviceException.isRetryable()); - assertNull(serviceException.getMessage()); - assertEquals(exception, serviceException.getCause()); - - exception = new SocketException(); - serviceException = new BaseHttpServiceException(exception, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - assertTrue(serviceException.isRetryable()); - assertNull(serviceException.getMessage()); - assertEquals(exception, serviceException.getCause()); - - exception = new IOException("insufficient data written"); - serviceException = new BaseHttpServiceException(exception, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - assertTrue(serviceException.isRetryable()); - assertEquals("insufficient data written", serviceException.getMessage()); - assertEquals(exception, serviceException.getCause()); - - GoogleJsonError error = new GoogleJsonError(); - error.setCode(CODE); - error.setMessage(MESSAGE); - serviceException = new BaseHttpServiceException(error, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertFalse(serviceException.isRetryable()); - - serviceException = new CustomServiceException(CODE, MESSAGE, REASON, IDEMPOTENT); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertEquals(RETRYABLE, serviceException.isRetryable()); - - serviceException = new CustomServiceException(CODE_NO_REASON, MESSAGE, null, IDEMPOTENT); - assertEquals(CODE_NO_REASON, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertNull(serviceException.getReason()); - assertEquals(RETRYABLE, serviceException.isRetryable()); - - serviceException = new CustomServiceException(UNKNOWN_CODE, MESSAGE, REASON, IDEMPOTENT); - assertEquals(UNKNOWN_CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertEquals(RETRYABLE, serviceException.isRetryable()); - } - - @Test - public void testTranslateAndThrow() throws Exception { - BaseServiceException cause = - new BaseHttpServiceException(CODE, MESSAGE, REASON, IDEMPOTENT, EMPTY_RETRYABLE_ERRORS); - RetryHelper.RetryHelperException exceptionMock = - createMock(RetryHelper.RetryHelperException.class); - expect(exceptionMock.getCause()).andReturn(cause).times(2); - replay(exceptionMock); - try { - BaseServiceException.translate(exceptionMock); - } catch (BaseServiceException ex) { - assertEquals(CODE, ex.getCode()); - assertEquals(MESSAGE, ex.getMessage()); - assertFalse(ex.isRetryable()); - } finally { - verify(exceptionMock); - } - } -} diff --git a/google-cloud-core-http/src/test/java/com/google/cloud/http/CensusHttpModuleTest.java b/google-cloud-core-http/src/test/java/com/google/cloud/http/CensusHttpModuleTest.java deleted file mode 100644 index c04d0647fb..0000000000 --- a/google-cloud-core-http/src/test/java/com/google/cloud/http/CensusHttpModuleTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2018 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.http; - -import static com.google.common.truth.Truth.assertThat; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.createMockBuilder; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpExecuteInterceptor; -import com.google.api.client.http.HttpHeaders; -import com.google.api.client.http.HttpRequest; -import com.google.api.client.http.HttpRequestInitializer; -import com.google.api.client.http.javanet.NetHttpTransport; -import io.opencensus.common.Scope; -import io.opencensus.trace.Span; -import io.opencensus.trace.SpanContext; -import io.opencensus.trace.SpanId; -import io.opencensus.trace.TraceId; -import io.opencensus.trace.TraceOptions; -import io.opencensus.trace.Tracer; -import io.opencensus.trace.Tracestate; -import io.opencensus.trace.Tracing; -import io.opencensus.trace.propagation.TextFormat; -import java.io.IOException; -import java.util.EnumSet; -import java.util.Random; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for {@link CensusHttpModule}. */ -@RunWith(JUnit4.class) -public class CensusHttpModuleTest { - - @Rule public final ExpectedException thrown = ExpectedException.none(); - - private final Tracer tracer = Tracing.getTracer(); - private final CensusHttpModule censusHttpModule = new CensusHttpModule(tracer, false); - private HttpRequest httpRequest; - - @Before - public void setUp() throws IOException { - httpRequest = - new NetHttpTransport() - .createRequestFactory() - .buildRequest("GET", new GenericUrl("https://www.google.com"), null); - } - - @Test - public void tracerShouldNotBeNull() { - assertThat(censusHttpModule.getTracer()).isNotNull(); - } - - @Test - public void isRecordEventsShouldBeSet() { - assertThat(censusHttpModule.isRecordEvents()).isEqualTo(false); - } - - @Test - public void getHttpRequestInitializerShouldReturnCorrectClass() { - HttpRequestInitializer initializer = censusHttpModule.getHttpRequestInitializer(null); - assertThat(initializer).isInstanceOf(CensusHttpModule.CensusHttpRequestInitializer.class); - } - - @Test - public void implementationOfDefaultTextFormatSetter() { - String testKey = "testKey"; - String testValue = "testValue"; - TextFormat.Setter setter = - CensusHttpModule.DefaultPropagationTextFormatSetter.INSTANCE; - setter.put(httpRequest.getHeaders(), testKey, testValue); - assertThat(httpRequest.getHeaders().get(testKey)).isEqualTo(testValue); - } - - @Test - public void censusHttpExecuteInterceptorDisallowNullRequest() throws IOException { - HttpExecuteInterceptor interceptor = censusHttpModule.new CensusHttpExecuteInterceptor(null); - thrown.expect(NullPointerException.class); - interceptor.intercept(null); - } - - @Test - public void censusHttpExecuteInterceptorShouldExecuteOriginal() throws IOException { - HttpExecuteInterceptor mockInterceptor = createMock(HttpExecuteInterceptor.class); - HttpExecuteInterceptor censusInterceptor = - censusHttpModule.new CensusHttpExecuteInterceptor(mockInterceptor); - mockInterceptor.intercept(httpRequest); - replay(mockInterceptor); - censusInterceptor.intercept(httpRequest); - verify(mockInterceptor); - } - - @Test - public void censusHttpExecuteInterceptorShouldInjectHeader() throws IOException { - Random random = new Random(); - SpanContext spanContext = - SpanContext.create( - TraceId.generateRandomId(random), - SpanId.generateRandomId(random), - TraceOptions.DEFAULT, - Tracestate.builder().build()); - Span mockSpan = - createMockBuilder(Span.class) - .withConstructor(SpanContext.class, EnumSet.class) - .withArgs(spanContext, null) - .createMock(); - Scope scope = tracer.withSpan(mockSpan); - try { - HttpExecuteInterceptor interceptor = censusHttpModule.new CensusHttpExecuteInterceptor(null); - interceptor.intercept(httpRequest); - assertThat(httpRequest.getHeaders().get("X-Cloud-Trace-Context")).isNotNull(); - } finally { - scope.close(); - } - } - - @Test - public void censusHttpRequestInitializerDisallowNullRequest() throws IOException { - HttpRequestInitializer initializer = censusHttpModule.getHttpRequestInitializer(null); - thrown.expect(NullPointerException.class); - initializer.initialize(null); - } - - @Test - public void censusHttpRequestInitializerShouldExecuteOriginal() throws IOException { - HttpRequestInitializer mockOriginalInitializer = createMock(HttpRequestInitializer.class); - HttpRequestInitializer censusInitializer = - censusHttpModule.getHttpRequestInitializer(mockOriginalInitializer); - mockOriginalInitializer.initialize(httpRequest); - replay(mockOriginalInitializer); - censusInitializer.initialize(httpRequest); - verify(mockOriginalInitializer); - } - - @Test - public void censusHttpRequestInitializerShouldSetInterceptor() throws IOException { - censusHttpModule.getHttpRequestInitializer(null).initialize(httpRequest); - assertThat(httpRequest.getInterceptor()) - .isInstanceOf(CensusHttpModule.CensusHttpExecuteInterceptor.class); - } -} diff --git a/google-cloud-core-http/src/test/java/com/google/cloud/http/HttpTransportOptionsTest.java b/google-cloud-core-http/src/test/java/com/google/cloud/http/HttpTransportOptionsTest.java deleted file mode 100644 index 1ff7871aec..0000000000 --- a/google-cloud-core-http/src/test/java/com/google/cloud/http/HttpTransportOptionsTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2016 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.http; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import com.google.api.gax.rpc.HeaderProvider; -import com.google.auth.http.HttpTransportFactory; -import com.google.cloud.ServiceOptions; -import com.google.cloud.http.HttpTransportOptions.DefaultHttpTransportFactory; -import java.util.regex.Pattern; -import org.easymock.EasyMock; -import org.junit.Test; - -public class HttpTransportOptionsTest { - - private static final HttpTransportFactory MOCK_HTTP_TRANSPORT_FACTORY = - EasyMock.createMock(HttpTransportFactory.class); - private static final HttpTransportOptions OPTIONS = - HttpTransportOptions.newBuilder() - .setConnectTimeout(1234) - .setHttpTransportFactory(MOCK_HTTP_TRANSPORT_FACTORY) - .setReadTimeout(5678) - .build(); - private static final HttpTransportOptions DEFAULT_OPTIONS = - HttpTransportOptions.newBuilder().build(); - private static final HttpTransportOptions OPTIONS_COPY = OPTIONS.toBuilder().build(); - - @Test - public void testBuilder() { - assertEquals(1234, OPTIONS.getConnectTimeout()); - assertSame(MOCK_HTTP_TRANSPORT_FACTORY, OPTIONS.getHttpTransportFactory()); - assertEquals(5678, OPTIONS.getReadTimeout()); - assertEquals(-1, DEFAULT_OPTIONS.getConnectTimeout()); - assertTrue(DEFAULT_OPTIONS.getHttpTransportFactory() instanceof DefaultHttpTransportFactory); - assertEquals(-1, DEFAULT_OPTIONS.getReadTimeout()); - } - - @Test - public void testBaseEquals() { - assertEquals(OPTIONS, OPTIONS_COPY); - assertNotEquals(DEFAULT_OPTIONS, OPTIONS); - } - - @Test - public void testBaseHashCode() { - assertEquals(OPTIONS.hashCode(), OPTIONS_COPY.hashCode()); - assertNotEquals(DEFAULT_OPTIONS.hashCode(), OPTIONS.hashCode()); - } - - @Test - public void testHeader() { - String expectedHeaderPattern = "^gl-java/.+ gccl/.* gax/.+"; - ServiceOptions serviceOptions = EasyMock.createMock(ServiceOptions.class); - HeaderProvider headerProvider = - OPTIONS.getInternalHeaderProviderBuilder(serviceOptions).build(); - - assertEquals(1, headerProvider.getHeaders().size()); - assertTrue( - Pattern.compile(expectedHeaderPattern) - .matcher(headerProvider.getHeaders().values().iterator().next()) - .find()); - } -} diff --git a/google-cloud-core/EnableAutoValue.txt b/google-cloud-core/EnableAutoValue.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/google-cloud-core/clirr-ignored-differences.xml b/google-cloud-core/clirr-ignored-differences.xml deleted file mode 100644 index 0f7f80a7b4..0000000000 --- a/google-cloud-core/clirr-ignored-differences.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - 7012 - com/google/cloud/ReadChannel - * limit(long) - - - 7012 - com/google/cloud/ReadChannel - long limit() - - diff --git a/google-cloud-core/pom.xml b/google-cloud-core/pom.xml deleted file mode 100644 index e1bac6e4d3..0000000000 --- a/google-cloud-core/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-core - 2.9.5-SNAPSHOT - jar - Google Cloud Core - https://github.com/googleapis/java-core - - Core module for the google-cloud. - - - com.google.cloud - google-cloud-core-parent - 2.9.5-SNAPSHOT - - - google-cloud-core - - - - com.google.guava - guava - - - com.google.api - gax - - - com.google.auto.value - auto-value-annotations - - - com.google.protobuf - protobuf-java-util - - - com.google.api.grpc - proto-google-common-protos - - - com.google.api.grpc - proto-google-iam-v1 - - - org.threeten - threetenbp - - - com.google.api - api-common - - - com.google.auth - google-auth-library-credentials - - - com.google.auth - google-auth-library-oauth2-http - - - com.google.http-client - google-http-client - - - com.google.http-client - google-http-client-gson - - - com.google.protobuf - protobuf-java - - - - junit - junit - test - - - org.easymock - easymock - test - - - com.google.code.findbugs - jsr305 - - - com.google.truth - truth - test - - - com.google.guava - guava-testlib - test - - - diff --git a/google-cloud-core/src/main/java/com/google/cloud/AsyncPageImpl.java b/google-cloud-core/src/main/java/com/google/cloud/AsyncPageImpl.java deleted file mode 100644 index 25cae6f7c8..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/AsyncPageImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2016 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; - -import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; -import com.google.api.core.InternalApi; -import com.google.api.gax.paging.AsyncPage; -import com.google.api.gax.paging.Page; -import com.google.common.base.Throwables; -import com.google.common.util.concurrent.Uninterruptibles; -import java.io.Serializable; -import java.util.concurrent.ExecutionException; - -/** - * Base implementation for asynchronously consuming Google Cloud paginated results. - * - * @param the value type that the page holds - */ -@InternalApi -public class AsyncPageImpl extends PageImpl implements AsyncPage { - - private static final long serialVersionUID = -6009473188630364906L; - - private final NextPageFetcher asyncPageFetcher; - - /** - * Interface for asynchronously fetching the next page of results from the service. - * - * @param the value type that the page holds - */ - public interface NextPageFetcher extends Serializable { - - ApiFuture> getNextPage(); - } - - private static class SyncNextPageFetcher implements PageImpl.NextPageFetcher { - - private static final long serialVersionUID = -4124568632363525351L; - - private final NextPageFetcher asyncPageFetcher; - - private SyncNextPageFetcher(NextPageFetcher asyncPageFetcher) { - this.asyncPageFetcher = asyncPageFetcher; - } - - @Override - public Page getNextPage() { - try { - return asyncPageFetcher != null - ? Uninterruptibles.getUninterruptibly(asyncPageFetcher.getNextPage()) - : null; - } catch (ExecutionException ex) { - Throwables.throwIfUnchecked(ex.getCause()); - throw new RuntimeException(ex); - } - } - } - - /** Creates an {@code AsyncPageImpl} object. */ - public AsyncPageImpl(NextPageFetcher asyncPageFetcher, String cursor, Iterable results) { - super(new SyncNextPageFetcher(asyncPageFetcher), cursor, results); - this.asyncPageFetcher = asyncPageFetcher; - } - - @Override - public ApiFuture> getNextPageAsync() { - if (getNextPageToken() == null || asyncPageFetcher == null) { - return ApiFutures.immediateFuture(null); - } - return asyncPageFetcher.getNextPage(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/BaseService.java b/google-cloud-core/src/main/java/com/google/cloud/BaseService.java deleted file mode 100644 index 781f29b421..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/BaseService.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2015 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; - -import com.google.api.core.InternalApi; -import com.google.cloud.ExceptionHandler.Interceptor; - -/** - * Base class for service objects. - * - * @param the {@code ServiceOptions} subclass corresponding to the service - */ -public abstract class BaseService> - implements Service { - - public static final Interceptor EXCEPTION_HANDLER_INTERCEPTOR = - new Interceptor() { - - private static final long serialVersionUID = -8429573486870467828L; - - @Override - public RetryResult afterEval(Exception exception, RetryResult retryResult) { - return Interceptor.RetryResult.CONTINUE_EVALUATION; - } - - @Override - public RetryResult beforeEval(Exception exception) { - if (exception instanceof BaseServiceException) { - boolean retriable = ((BaseServiceException) exception).isRetryable(); - return retriable - ? Interceptor.RetryResult.RETRY - : Interceptor.RetryResult.CONTINUE_EVALUATION; - } - return Interceptor.RetryResult.CONTINUE_EVALUATION; - } - }; - public static final ExceptionHandler EXCEPTION_HANDLER = - ExceptionHandler.newBuilder() - .abortOn(RuntimeException.class) - .addInterceptors(EXCEPTION_HANDLER_INTERCEPTOR) - .build(); - - private final OptionsT options; - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseService(OptionsT options) { - this.options = options; - } - - @Override - public OptionsT getOptions() { - return options; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java b/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java deleted file mode 100644 index 29396d6d58..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright 2015 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; - -import com.google.api.core.InternalApi; -import com.google.common.base.MoreObjects; -import java.io.IOException; -import java.io.Serializable; -import java.net.SocketException; -import java.net.SocketTimeoutException; -import java.security.cert.CertificateException; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import javax.net.ssl.SSLException; -import javax.net.ssl.SSLHandshakeException; - -/** Base class for all service exceptions. */ -public class BaseServiceException extends RuntimeException { - - private static final long serialVersionUID = 759921776378760835L; - public static final int UNKNOWN_CODE = 0; - - private final int code; - private final boolean retryable; - private final String reason; - private final String location; - private final String debugInfo; - - @InternalApi - public static final class ExceptionData implements Serializable { - private static final long serialVersionUID = 2222230861338426753L; - - private final String message; - private final Throwable cause; - private final int code; - private final boolean retryable; - private final String reason; - private final String location; - private final String debugInfo; - - private ExceptionData( - String message, - Throwable cause, - int code, - boolean retryable, - String reason, - String location, - String debugInfo) { - this.message = message; - this.cause = cause; - this.code = code; - this.retryable = retryable; - this.reason = reason; - this.location = location; - this.debugInfo = debugInfo; - } - - public String getMessage() { - return message; - } - - public Throwable getCause() { - return cause; - } - - public int getCode() { - return code; - } - - public boolean isRetryable() { - return retryable; - } - - public String getReason() { - return reason; - } - - public String getLocation() { - return location; - } - - public String getDebugInfo() { - return debugInfo; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public static ExceptionData from(int code, String message, String reason, boolean retryable) { - return from(code, message, reason, retryable, null); - } - - public static ExceptionData from( - int code, String message, String reason, boolean retryable, Throwable cause) { - return newBuilder() - .setCode(code) - .setMessage(message) - .setReason(reason) - .setRetryable(retryable) - .setCause(cause) - .build(); - } - - @InternalApi - public static final class Builder { - - private String message; - private Throwable cause; - private int code; - private boolean retryable; - private String reason; - private String location; - private String debugInfo; - - private Builder() {} - - public Builder setMessage(String message) { - this.message = message; - return this; - } - - public Builder setCause(Throwable cause) { - this.cause = cause; - return this; - } - - public Builder setCode(int code) { - this.code = code; - return this; - } - - public Builder setRetryable(boolean retryable) { - this.retryable = retryable; - return this; - } - - public Builder setReason(String reason) { - this.reason = reason; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setDebugInfo(String debugInfo) { - this.debugInfo = debugInfo; - return this; - } - - public ExceptionData build() { - return new ExceptionData(message, cause, code, retryable, reason, location, debugInfo); - } - } - } - - @InternalApi - public static final class Error implements Serializable { - - private static final long serialVersionUID = -4019600198652965721L; - - private final Integer code; - private final String reason; - private final boolean rejected; - - public Error(Integer code, String reason) { - this(code, reason, false); - } - - public Error(Integer code, String reason, boolean rejected) { - this.code = code; - this.reason = reason; - this.rejected = rejected; - } - - /** Returns the code associated with this exception. */ - public Integer getCode() { - return code; - } - - /** - * Returns true if the error indicates that the API call was certainly not accepted by the - * server. For instance, if the server returns a rate limit exceeded error, it certainly did not - * process the request and this method will return {@code true}. - */ - public boolean isRejected() { - return rejected; - } - - /** Returns the reason that caused the exception. */ - public String getReason() { - return reason; - } - - @InternalApi - public boolean isRetryable(boolean idempotent, Set retryableErrors) { - return BaseServiceException.isRetryable(code, reason, idempotent, retryableErrors); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("code", code) - .add("reason", reason) - .add("rejected", rejected) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hash(code, reason, rejected); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Error)) { - return false; - } - Error o = (Error) obj; - return Objects.equals(code, o.code) - && Objects.equals(reason, o.reason) - && Objects.equals(rejected, o.rejected); - } - } - - @InternalApi - public static boolean isRetryable( - Integer code, String reason, boolean idempotent, Set retryableErrors) { - for (Error retryableError : retryableErrors) { - if ((retryableError.getCode() == null || retryableError.getCode().equals(code)) - && (retryableError.getReason() == null || retryableError.getReason().equals(reason))) { - return idempotent || retryableError.isRejected(); - } - } - return false; - } - - @InternalApi - public static boolean isRetryable(boolean idempotent, IOException exception) { - boolean exceptionIsRetryable = - exception instanceof SocketTimeoutException - || exception instanceof SocketException - || (exception instanceof SSLException - && exception.getMessage().contains("Connection has been shutdown: ")) - || (exception instanceof SSLHandshakeException - && !(exception.getCause() instanceof CertificateException)) - || "insufficient data written".equals(exception.getMessage()) - || "Error writing request body to server".equals(exception.getMessage()); - return idempotent && exceptionIsRetryable; - } - - @InternalApi - public static void translate(RetryHelper.RetryHelperException ex) { - if (ex.getCause() instanceof BaseServiceException) { - throw (BaseServiceException) ex.getCause(); - } - } - - @InternalApi - public static void translate(ExecutionException ex) { - if (ex.getCause() instanceof BaseServiceException) { - throw (BaseServiceException) ex.getCause(); - } - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseServiceException(ExceptionData exceptionData) { - super(exceptionData.getMessage(), exceptionData.getCause()); - this.code = exceptionData.getCode(); - this.reason = exceptionData.getReason(); - this.retryable = exceptionData.isRetryable(); - this.location = exceptionData.getLocation(); - this.debugInfo = exceptionData.getDebugInfo(); - } - - /** Returns the code associated with this exception. */ - public int getCode() { - return code; - } - - /** Returns the reason that caused the exception. */ - public String getReason() { - return reason; - } - - /** Returns {@code true} when it is safe to retry the operation that caused this exception. */ - public boolean isRetryable() { - return retryable; - } - - /** - * Returns the service location where the error causing the exception occurred. Returns {@code - * null} if not available. - */ - public String getLocation() { - return location; - } - - @InternalApi - public String getDebugInfo() { - return debugInfo; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof BaseServiceException)) { - return false; - } - BaseServiceException other = (BaseServiceException) obj; - return Objects.equals(getCause(), other.getCause()) - && Objects.equals(getMessage(), other.getMessage()) - && code == other.code - && retryable == other.retryable - && Objects.equals(reason, other.reason) - && Objects.equals(location, other.location) - && Objects.equals(debugInfo, other.debugInfo); - } - - @Override - public int hashCode() { - return Objects.hash(getCause(), getMessage(), code, retryable, reason, location, debugInfo); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java b/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java deleted file mode 100644 index e45a5aead1..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright 2015 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; - -import com.google.api.core.InternalApi; -import java.io.IOException; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.nio.channels.ClosedChannelException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -/** - * Base implementation for a {@link WriteChannel}. - * - * @param the service options used by the channel to issue RPC requests - * @param the entity this channel writes data to. Possibly with additional configuration - */ -public abstract class BaseWriteChannel< - ServiceOptionsT extends ServiceOptions, EntityT extends Serializable> - implements WriteChannel { - - private static final int MIN_CHUNK_SIZE = 256 * 1024; // 256 KiB - private static final int DEFAULT_CHUNK_SIZE = 60 * MIN_CHUNK_SIZE; // 15MiB - - private final ServiceOptionsT options; - private final EntityT entity; - private final String uploadId; - private long position; - private byte[] buffer = new byte[0]; - private int limit; - private boolean isOpen = true; - private int chunkSize = getDefaultChunkSize(); - - protected int getMinChunkSize() { - return MIN_CHUNK_SIZE; - } - - protected int getDefaultChunkSize() { - return DEFAULT_CHUNK_SIZE; - } - - /** - * Writes {@code length} bytes of {@link #getBuffer()} to the {@link #getUploadId()} URL. - * - * @param length the number of bytes to write from {@link #getBuffer()} - * @param last if {@code true} the resumable session is closed - */ - protected abstract void flushBuffer(int length, boolean last); - - protected ServiceOptionsT getOptions() { - return options; - } - - protected EntityT getEntity() { - return entity; - } - - protected String getUploadId() { - return uploadId; - } - - protected long getPosition() { - return position; - } - - protected byte[] getBuffer() { - return buffer; - } - - protected int getLimit() { - return limit; - } - - protected int getChunkSize() { - return chunkSize; - } - - @Override - public final void setChunkSize(int chunkSize) { - int minSize = getMinChunkSize(); - - this.chunkSize = Math.max(minSize, (chunkSize + minSize - 1) / minSize * minSize); - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseWriteChannel(ServiceOptionsT options, EntityT entity, String uploadId) { - this.options = options; - this.entity = entity; - this.uploadId = uploadId; - } - - private void flush() { - if (limit >= chunkSize) { - final int length = limit - limit % getMinChunkSize(); - flushBuffer(length, false); - position += length; - limit -= length; - byte[] temp = new byte[chunkSize]; - System.arraycopy(buffer, length, temp, 0, limit); - buffer = temp; - } - } - - private void validateOpen() throws ClosedChannelException { - if (!isOpen) { - throw new ClosedChannelException(); - } - } - - @Override - public final int write(ByteBuffer byteBuffer) throws IOException { - validateOpen(); - int toWrite = byteBuffer.remaining(); - int spaceInBuffer = buffer.length - limit; - if (spaceInBuffer >= toWrite) { - byteBuffer.get(buffer, limit, toWrite); - } else { - buffer = Arrays.copyOf(buffer, Math.max(chunkSize, buffer.length + toWrite - spaceInBuffer)); - byteBuffer.get(buffer, limit, toWrite); - } - limit += toWrite; - flush(); - return toWrite; - } - - @Override - public boolean isOpen() { - return isOpen; - } - - @Override - public final void close() throws IOException { - if (isOpen) { - flushBuffer(limit, true); - position += buffer.length; - isOpen = false; - buffer = null; - } - } - - /** Creates a {@link BaseState.Builder} for the current write channel. */ - protected abstract BaseState.Builder stateBuilder(); - - @Override - public RestorableState capture() { - byte[] bufferToSave = null; - if (isOpen) { - bufferToSave = Arrays.copyOf(buffer, limit); - } - return stateBuilder() - .setPosition(position) - .setBuffer(bufferToSave) - .setIsOpen(isOpen) - .setChunkSize(chunkSize) - .build(); - } - - /** Restores the state of the current write channel given a {@link BaseState} object. */ - protected void restore(BaseState state) { - if (state.buffer != null) { - this.buffer = state.buffer.clone(); - this.limit = state.buffer.length; - } - this.position = state.position; - this.isOpen = state.isOpen; - this.chunkSize = state.chunkSize; - } - - protected abstract static class BaseState< - ServiceOptionsT extends ServiceOptions, EntityT extends Serializable> - implements RestorableState, Serializable { - - private static final long serialVersionUID = 8541062465055125619L; - - protected final ServiceOptionsT serviceOptions; - protected final EntityT entity; - protected final String uploadId; - protected final long position; - protected final byte[] buffer; - protected final boolean isOpen; - protected final int chunkSize; - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseState(Builder builder) { - this.serviceOptions = builder.serviceOptions; - this.entity = builder.entity; - this.uploadId = builder.uploadId; - this.position = builder.position; - this.buffer = builder.buffer; - this.isOpen = builder.isOpen; - this.chunkSize = builder.chunkSize; - } - - /** - * Base builder for a write channel's state. Users are not supposed to access this class - * directly. - * - * @param the service options used by the channel to issue RPC requests - * @param the entity this channel writes data to. Possibly with additional - * configuration - */ - public abstract static class Builder< - ServiceOptionsT extends ServiceOptions, EntityT extends Serializable> { - private final ServiceOptionsT serviceOptions; - private final EntityT entity; - private final String uploadId; - private long position; - private byte[] buffer; - private boolean isOpen; - private int chunkSize; - - @InternalApi("This class should only be extended within google-cloud-java") - protected Builder(ServiceOptionsT options, EntityT entity, String uploadId) { - this.serviceOptions = options; - this.entity = entity; - this.uploadId = uploadId; - } - - public Builder setPosition(long position) { - this.position = position; - return this; - } - - public Builder setBuffer(byte[] buffer) { - this.buffer = buffer; - return this; - } - - public Builder setIsOpen(boolean isOpen) { - this.isOpen = isOpen; - return this; - } - - public Builder setChunkSize(int chunkSize) { - this.chunkSize = chunkSize; - return this; - } - - public abstract RestorableState build(); - } - - @Override - public int hashCode() { - return Objects.hash( - serviceOptions, entity, uploadId, position, isOpen, chunkSize, Arrays.hashCode(buffer)); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (!(obj instanceof BaseState)) { - return false; - } - final BaseState other = (BaseState) obj; - return Objects.equals(this.serviceOptions, other.serviceOptions) - && Objects.equals(this.entity, other.entity) - && Objects.equals(this.uploadId, other.uploadId) - && Objects.deepEquals(this.buffer, other.buffer) - && this.position == other.position - && this.isOpen == other.isOpen - && this.chunkSize == other.chunkSize; - } - - protected static final class ValueHolder { - final String name; - final Object value; - - private ValueHolder(String name, Object value) { - this.name = name; - this.value = value; - } - - public static ValueHolder create(String name, Object value) { - return new ValueHolder(name, value); - } - - @Override - public String toString() { - String result = name + "="; - if (value != null && value.getClass().isArray()) { - Object[] objectArray = new Object[] {value}; - String arrayString = Arrays.deepToString(objectArray); - result += arrayString.substring(1, arrayString.length() - 1); - } else { - result += value; - } - return result; - } - } - - protected List toStringHelper() { - List valueList = new ArrayList<>(); - valueList.add(ValueHolder.create("entity", entity)); - valueList.add(ValueHolder.create("uploadId", uploadId)); - valueList.add(ValueHolder.create("position", String.valueOf(position))); - valueList.add(ValueHolder.create("isOpen", String.valueOf(isOpen))); - return valueList; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(getClass().getSimpleName()).append('{'); - String nextSeparator = ""; - for (ValueHolder valueHolder : toStringHelper()) { - builder.append(nextSeparator).append(valueHolder); - nextSeparator = ", "; - } - builder.append('}'); - return builder.toString(); - } - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/BatchResult.java b/google-cloud-core/src/main/java/com/google/cloud/BatchResult.java deleted file mode 100644 index 7281571f91..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/BatchResult.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -import com.google.api.core.InternalApi; -import java.util.LinkedList; -import java.util.List; - -/** - * This class holds a single result of a batch call. The class is not thread-safe. - * - * @param the type of the result - * @param the type of the service-dependent exception thrown when a processing error occurs - */ -public abstract class BatchResult { - - private T result; - private boolean completed = false; - private E error; - private final List> toBeNotified = new LinkedList<>(); - - @InternalApi("This class should only be extended within google-cloud-java") - protected BatchResult() {} - - /** - * Returns {@code true} if the batch has been completed and the result is available; {@code false} - * otherwise. - */ - public boolean completed() { - return completed; - } - - /** - * Returns the result of this call. - * - * @throws IllegalStateException if the batch has not been completed yet - * @throws E if an error occurred when processing the batch request - */ - public T get() throws E { - checkState(completed(), "Batch has not been completed yet"); - if (error != null) { - throw error; - } - return result; - } - - /** - * Adds a callback for the batch operation. - * - * @throws IllegalStateException if the batch has been completed already - */ - public void notify(Callback callback) { - checkState( - !completed, - "The batch has been completed. All the calls to the notify()" - + " method should be done prior to submitting the batch."); - toBeNotified.add(callback); - } - - /** Sets an error and status as completed. Notifies all callbacks. */ - protected void error(E error) { - this.error = checkNotNull(error); - this.completed = true; - for (Callback callback : toBeNotified) { - callback.error(error); - } - } - - /** Sets a result and status as completed. Notifies all callbacks. */ - protected void success(T result) { - this.result = result; - this.completed = true; - for (Callback callback : toBeNotified) { - callback.success(result); - } - } - - /** An interface for the batch callbacks. */ - public interface Callback { - /** The method to be called when the batched operation succeeds. */ - void success(T result); - - /** The method to be called when the batched operation fails. */ - void error(E exception); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Binding.java b/google-cloud-core/src/main/java/com/google/cloud/Binding.java deleted file mode 100644 index be16f87421..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Binding.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud; - -import static com.google.common.base.Predicates.in; -import static com.google.common.base.Predicates.not; - -import com.google.api.core.BetaApi; -import com.google.auto.value.AutoValue; -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import javax.annotation.Nullable; - -/** - * Class for Identity and Access Management (IAM) policies. IAM policies are used to specify access - * settings for Cloud Platform resources. A policy is a list of bindings. A binding assigns a set of - * identities to a role, where the identities can be user accounts, Google groups, Google domains, - * and service accounts. A role is a named list of permissions defined by IAM. - * - * @see Policy - */ -@BetaApi("This is a Beta API is not stable yet and may change in the future.") -@AutoValue -public abstract class Binding { - /** Get IAM Policy Binding Role */ - public abstract String getRole(); - - /** Get IAM Policy Binding Members */ - public abstract ImmutableList getMembers(); - - /** Get IAM Policy Binding Condition */ - @Nullable - public abstract Condition getCondition(); - - /** Create a Binding.Builder from an existing Binding */ - public abstract Builder toBuilder(); - - /** Create a new Binding.Builder */ - public static Builder newBuilder() { - List emptyMembers = ImmutableList.of(); - return new AutoValue_Binding.Builder().setMembers(emptyMembers); - } - - @AutoValue.Builder - public abstract static class Builder { - /** - * Set IAM Role for Policy Binding - * - * @throws NullPointerException if the role is null. - */ - public abstract Builder setRole(String role); - - /** - * Set IAM Members for Policy Binding - * - * @throws NullPointerException if a member is null. - */ - public abstract Builder setMembers(Iterable members); - - /** Set IAM Condition for Policy Binding */ - public abstract Builder setCondition(Condition condition); - - /** Internal use to getMembers() in addMembers() and removeMembers() */ - abstract ImmutableList getMembers(); - - /** - * Add members to Policy Binding. - * - * @throws NullPointerException if a member is null. - */ - public Builder addMembers(String member, String... moreMembers) { - ImmutableList.Builder membersBuilder = ImmutableList.builder(); - membersBuilder.addAll(getMembers()); - membersBuilder.addAll(Lists.asList(member, moreMembers)); - setMembers(membersBuilder.build()); - return this; - } - - /** - * Remove members to Policy Binding. - * - * @throws NullPointerException if a member is null. - */ - public Builder removeMembers(String... members) { - Predicate selectMembersNotInList = not(in(Arrays.asList(members))); - Collection filter = Collections2.filter(getMembers(), selectMembersNotInList); - setMembers(filter); - return this; - } - - public abstract Binding build(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ByteArray.java b/google-cloud-core/src/main/java/com/google/cloud/ByteArray.java deleted file mode 100644 index 5841c541c4..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ByteArray.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2016 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; - -import com.google.api.core.BetaApi; -import com.google.common.base.MoreObjects; -import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.io.BaseEncoding; -import com.google.protobuf.ByteString; -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.Iterator; - -/** An immutable byte array holder. */ -@BetaApi -public class ByteArray implements Iterable, Serializable { - - private static final long serialVersionUID = -1908809133893782840L; - private static final BaseEncoding encoder = BaseEncoding.base64(); - - private final ByteString byteString; - - ByteArray(ByteString byteString) { - this.byteString = byteString; - } - - @Override - public final Iterator iterator() { - return byteString.iterator(); - } - - @Override - public String toString() { - ToStringHelper toStringHelper = MoreObjects.toStringHelper(this); - StringBuilder stBuilder = new StringBuilder(); - for (int i = 0; i < Math.min(256, byteString.size()); i++) { - stBuilder.append(String.format("%02x", byteString.byteAt(i))); - } - if (byteString.size() > 256) { - stBuilder.append("..."); - } - return toStringHelper.add("bytes", stBuilder.toString()).toString(); - } - - @Override - public final int hashCode() { - return byteString.hashCode(); - } - - @Override - public final boolean equals(Object obj) { - return obj == this - || obj instanceof ByteArray && byteString.equals(((ByteArray) obj).byteString); - } - - /** Returns the number of bytes in this {@code ByteArray}. */ - public final int length() { - return byteString.size(); - } - - /** Returns a copy of this {@code ByteArray} as an array of bytes. */ - public final byte[] toByteArray() { - return byteString.toByteArray(); - } - - /** Returns a copy of this {@code ByteArray} as an {@code UTF-8} string. */ - public final String toStringUtf8() { - return byteString.toStringUtf8(); - } - - /** Converts this byte array to its base64 representation. */ - public final String toBase64() { - return encoder.encode(toByteArray()); - } - - /** Returns the content of this {@code ByteArray} as a read-only {@link ByteBuffer}. */ - public final ByteBuffer asReadOnlyByteBuffer() { - return byteString.asReadOnlyByteBuffer(); - } - - /** Returns an {@link InputStream} for this {@code ByteArray} content. */ - public final InputStream asInputStream() { - return byteString.newInput(); - } - - /** - * Copies the content of this {@code ByteArray} into an existing {@code ByteBuffer}. - * - * @throws java.nio.ReadOnlyBufferException if the target is read-only - * @throws java.nio.BufferOverflowException if the target's {@link ByteBuffer#remaining()} space - * is not large enough to hold the data - */ - public final void copyTo(ByteBuffer target) { - byteString.copyTo(target); - } - - /** - * Copies the content of this {@code ByteArray} into an array of bytes. - * - * @throws IndexOutOfBoundsException if the target is not large enough to hold the data - */ - public final void copyTo(byte[] target) { - byteString.copyTo(target, 0); - } - - /** Creates a {@code ByteArray} object given an array of bytes. The bytes are copied. */ - public static final ByteArray copyFrom(byte[] bytes) { - return new ByteArray(ByteString.copyFrom(bytes)); - } - - /** - * Creates a {@code ByteArray} object given a string. The string is encoded in {@code UTF-8}. The - * bytes are copied. - */ - public static final ByteArray copyFrom(String string) { - return new ByteArray(ByteString.copyFrom(string, StandardCharsets.UTF_8)); - } - - /** Creates a {@code ByteArray} object given a {@link ByteBuffer}. The bytes are copied. */ - public static final ByteArray copyFrom(ByteBuffer bytes) { - return new ByteArray(ByteString.copyFrom(bytes)); - } - - /** - * Creates a {@code ByteArray} object given an {@link InputStream}. The stream is read into the - * created object. - */ - public static final ByteArray copyFrom(InputStream input) throws IOException { - return new ByteArray(ByteString.readFrom(input)); - } - - /** Creates a {@code ByteArray} from a base64 representation. */ - public static ByteArray fromBase64(String data) { - return ByteArray.copyFrom(encoder.decode(data)); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Condition.java b/google-cloud-core/src/main/java/com/google/cloud/Condition.java deleted file mode 100644 index c3c4c83fb9..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Condition.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud; - -import com.google.api.core.BetaApi; -import com.google.auto.value.AutoValue; -import javax.annotation.Nullable; - -/** - * Class for Identity and Access Management (IAM) policies. IAM policies are used to specify access - * settings for Cloud Platform resources. A policy is a list of bindings. A binding assigns a set of - * identities to a role, where the identities can be user accounts, Google groups, Google domains, - * and service accounts. A role is a named list of permissions defined by IAM. - * - * @see Policy - * @see IAM Conditions - */ -@BetaApi("This is a Beta API is not stable yet and may change in the future.") -@AutoValue -public abstract class Condition { - /** Get IAM Policy Binding Condition Title */ - @Nullable - public abstract String getTitle(); - - /** Get IAM Policy Binding Condition Description */ - @Nullable - public abstract String getDescription(); - - /** Get IAM Policy Binding Condition Expression */ - public abstract String getExpression(); - - /** Create a new Condition.Builder from an existing Condition */ - public abstract Builder toBuilder(); - - /** Create a new Condition.Builder */ - public static Builder newBuilder() { - return new AutoValue_Condition.Builder(); - } - - @AutoValue.Builder - public abstract static class Builder { - /** Set IAM Policy Binding Condition Title */ - public abstract Builder setTitle(@Nullable String title); - - /** Set IAM Policy Binding Condition Description */ - public abstract Builder setDescription(@Nullable String description); - - /** Set IAM Policy Binding Condition Expression */ - public abstract Builder setExpression(String expression); - - /** Build Builder which creates a Condition instance */ - public abstract Condition build(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Date.java b/google-cloud-core/src/main/java/com/google/cloud/Date.java deleted file mode 100644 index d7f3b71275..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Date.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2017 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; - -import com.google.api.core.BetaApi; -import com.google.common.base.Preconditions; -import java.io.Serializable; -import java.util.Calendar; -import java.util.Objects; - -/** Represents a Date without time, such as 2017-03-17. Date is timezone independent. */ -@BetaApi("This is going to be replaced with LocalDate from threetenbp") -public final class Date implements Comparable, Serializable { - - // Date format "yyyy-mm-dd" - private static final long serialVersionUID = 8067099123096783929L; - private final int year; - private final int month; - private final int dayOfMonth; - - private Date(int year, int month, int dayOfMonth) { - Preconditions.checkArgument(year > 0, "Invalid year: " + year); - Preconditions.checkArgument(month > 0 && month <= 12, "Invalid month: " + month); - Preconditions.checkArgument(dayOfMonth > 0 && dayOfMonth <= 31, "Invalid day: " + dayOfMonth); - this.year = year; - this.month = month; - this.dayOfMonth = dayOfMonth; - } - - /** - * Constructs a new Date instance. - * - * @param year must be greater than 0 - * @param month must be between [1,12] - * @param dayOfMonth must be between [1,31] - */ - public static Date fromYearMonthDay(int year, int month, int dayOfMonth) { - return new Date(year, month, dayOfMonth); - } - - /** @param date Data in RFC 3339 date format (yyyy-mm-dd). */ - public static Date parseDate(String date) { - Preconditions.checkNotNull(date); - final String invalidDate = "Invalid date: " + date; - Preconditions.checkArgument(date.length() == 10, invalidDate); - Preconditions.checkArgument(date.charAt(4) == '-', invalidDate); - Preconditions.checkArgument(date.charAt(7) == '-', invalidDate); - try { - int year = Integer.parseInt(date.substring(0, 4)); - int month = Integer.parseInt(date.substring(5, 7)); - int dayOfMonth = Integer.parseInt(date.substring(8, 10)); - return new Date(year, month, dayOfMonth); - } catch (NumberFormatException e) { - throw new IllegalArgumentException(invalidDate, e); - } - } - - /** - * Convert a Google Date to a Java Util Date. - * - * @param date the date of the Google Date. - * @return java.util.Date - */ - public static java.util.Date toJavaUtilDate(Date date) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - // Calender.MONTH starts from 0 while G C date starts from 1 - cal.set(date.year, date.month - 1, date.dayOfMonth); - return cal.getTime(); - } - - /** - * Convert a Java Util Date to a Google Date. - * - * @param date the date of the java.util.Date - * @return Google Java Date - */ - public static Date fromJavaUtilDate(java.util.Date date) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - // Calender.MONTH starts from 0 while G C date starts from 1 - return new Date( - cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH)); - } - - /** Returns the year. */ - public int getYear() { - return year; - } - - /** Returns the month between 1 and 12 inclusive. */ - public int getMonth() { - return month; - } - - /** Returns day of month between 1 and 31 inclusive. */ - public int getDayOfMonth() { - return dayOfMonth; - } - - @Override - public String toString() { - return String.format("%04d-%02d-%02d", year, month, dayOfMonth); - } - - StringBuilder toString(StringBuilder b) { - return b.append(toString()); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Date that = (Date) o; - return year == that.year && month == that.month && dayOfMonth == that.dayOfMonth; - } - - @Override - public int hashCode() { - return Objects.hash(year, month, dayOfMonth); - } - - @Override - public int compareTo(Date other) { - int r = Integer.compare(year, other.year); - if (r == 0) { - r = Integer.compare(month, other.month); - if (r == 0) { - r = Integer.compare(dayOfMonth, other.dayOfMonth); - } - } - return r; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ExceptionHandler.java b/google-cloud-core/src/main/java/com/google/cloud/ExceptionHandler.java deleted file mode 100644 index d243de1807..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ExceptionHandler.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright 2015 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; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.core.BetaApi; -import com.google.api.gax.retrying.ResultRetryAlgorithm; -import com.google.api.gax.retrying.TimedAttemptSettings; -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.Callable; - -/** Exception retry algorithm implementation used by {@link RetryHelper}. */ -@BetaApi -public final class ExceptionHandler implements ResultRetryAlgorithm, Serializable { - - private static final long serialVersionUID = -2460707015779532919L; - - private static final ExceptionHandler DEFAULT_INSTANCE = - newBuilder().retryOn(Exception.class).abortOn(RuntimeException.class).build(); - - private final ImmutableList interceptors; - private final ImmutableSet> retriableExceptions; - private final ImmutableSet> nonRetriableExceptions; - private final Set retryInfo = Sets.newHashSet(); - - public interface Interceptor extends Serializable { - - enum RetryResult { - NO_RETRY, - RETRY, - CONTINUE_EVALUATION; - } - - /** - * This method is called before exception evaluation and could short-circuit the process. - * - * @param exception the exception that is being evaluated - * @return {@link RetryResult} to indicate if the exception should be ignored ( {@link - * RetryResult#RETRY}), propagated ({@link RetryResult#NO_RETRY}), or evaluation should - * proceed ({@link RetryResult#CONTINUE_EVALUATION}). - */ - RetryResult beforeEval(Exception exception); - - /** - * This method is called after the evaluation and could alter its result. - * - * @param exception the exception that is being evaluated - * @param retryResult the result of the evaluation so far - * @return {@link RetryResult} to indicate if the exception should be ignored ( {@link - * RetryResult#RETRY}), propagated ({@link RetryResult#NO_RETRY}), or evaluation should - * proceed ({@link RetryResult#CONTINUE_EVALUATION}). - */ - RetryResult afterEval(Exception exception, RetryResult retryResult); - } - - /** ExceptionHandler builder. */ - public static class Builder { - - private final ImmutableList.Builder interceptors = ImmutableList.builder(); - private final ImmutableSet.Builder> retriableExceptions = - ImmutableSet.builder(); - private final ImmutableSet.Builder> nonRetriableExceptions = - ImmutableSet.builder(); - - private Builder() {} - - /** - * Adds the exception handler interceptors. Call order will be maintained. - * - * @param interceptors the interceptors for this exception handler - * @return the Builder for chaining - */ - public Builder addInterceptors(Interceptor... interceptors) { - for (Interceptor interceptor : interceptors) { - this.interceptors.add(interceptor); - } - return this; - } - - /** - * Add the exceptions to ignore/retry-on. - * - * @param exceptions retry should continue when such exceptions are thrown - * @return the Builder for chaining - */ - @SafeVarargs - public final Builder retryOn(Class... exceptions) { - for (Class exception : exceptions) { - retriableExceptions.add(checkNotNull(exception)); - } - return this; - } - - /** - * Adds the exceptions to abort on. - * - * @param exceptions retry should abort when such exceptions are thrown - * @return the Builder for chaining - */ - @SafeVarargs - public final Builder abortOn(Class... exceptions) { - for (Class exception : exceptions) { - nonRetriableExceptions.add(checkNotNull(exception)); - } - return this; - } - - /** Returns a new ExceptionHandler instance. */ - public ExceptionHandler build() { - return new ExceptionHandler(this); - } - } - - @VisibleForTesting - static final class RetryInfo implements Serializable { - - private static final long serialVersionUID = -4264634837841455974L; - private final Class exception; - private final Interceptor.RetryResult retry; - private final Set children = Sets.newHashSet(); - - RetryInfo(Class exception, Interceptor.RetryResult retry) { - this.exception = checkNotNull(exception); - this.retry = checkNotNull(retry); - } - - @Override - public int hashCode() { - return exception.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof RetryInfo)) { - return false; - } - // We only care about exception in equality as we allow only one instance per exception - return ((RetryInfo) obj).exception.equals(exception); - } - } - - private ExceptionHandler(Builder builder) { - interceptors = builder.interceptors.build(); - retriableExceptions = builder.retriableExceptions.build(); - nonRetriableExceptions = builder.nonRetriableExceptions.build(); - Preconditions.checkArgument( - Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(), - "Same exception was found in both retryable and non-retryable sets"); - for (Class exception : retriableExceptions) { - addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.RETRY), retryInfo); - } - for (Class exception : nonRetriableExceptions) { - addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.NO_RETRY), retryInfo); - } - } - - private static void addRetryInfo(RetryInfo retryInfo, Set dest) { - for (RetryInfo current : dest) { - if (current.exception.isAssignableFrom(retryInfo.exception)) { - addRetryInfo(retryInfo, current.children); - return; - } - if (retryInfo.exception.isAssignableFrom(current.exception)) { - retryInfo.children.add(current); - } - } - dest.removeAll(retryInfo.children); - dest.add(retryInfo); - } - - private static RetryInfo findMostSpecificRetryInfo( - Set retryInfo, Class exception) { - for (RetryInfo current : retryInfo) { - if (current.exception.isAssignableFrom(exception)) { - RetryInfo match = findMostSpecificRetryInfo(current.children, exception); - return match == null ? current : match; - } - } - return null; - } - - // called for Class, therefore a "call" method must be found. - private static Method getCallableMethod(Class clazz) { - try { - return clazz.getDeclaredMethod("call"); - } catch (NoSuchMethodException e) { - // check parent - return getCallableMethod(clazz.getSuperclass()); - } catch (SecurityException e) { - // This should never happen - throw new IllegalStateException("Unexpected exception", e); - } - } - - void verifyCaller(Callable callable) { - Method callMethod = getCallableMethod(callable.getClass()); - for (Class exceptionOrError : callMethod.getExceptionTypes()) { - Preconditions.checkArgument( - Exception.class.isAssignableFrom(exceptionOrError), - "Callable method exceptions must be derived from Exception"); - @SuppressWarnings("unchecked") - Class exception = (Class) exceptionOrError; - Preconditions.checkArgument( - findMostSpecificRetryInfo(retryInfo, exception) != null, - "Declared exception '" + exception + "' is not covered by exception handler"); - } - } - - @Override - public boolean shouldRetry(Throwable prevThrowable, Object prevResponse) { - if (!(prevThrowable instanceof Exception)) { - return false; - } - Exception ex = (Exception) prevThrowable; - for (Interceptor interceptor : interceptors) { - Interceptor.RetryResult retryResult = checkNotNull(interceptor.beforeEval(ex)); - if (retryResult != Interceptor.RetryResult.CONTINUE_EVALUATION) { - return retryResult == Interceptor.RetryResult.RETRY; - } - } - RetryInfo retryInfo = findMostSpecificRetryInfo(this.retryInfo, ex.getClass()); - Interceptor.RetryResult retryResult = - retryInfo == null ? Interceptor.RetryResult.NO_RETRY : retryInfo.retry; - for (Interceptor interceptor : interceptors) { - Interceptor.RetryResult interceptorRetry = - checkNotNull(interceptor.afterEval(ex, retryResult)); - if (interceptorRetry != Interceptor.RetryResult.CONTINUE_EVALUATION) { - retryResult = interceptorRetry; - } - } - return retryResult == Interceptor.RetryResult.RETRY; - } - - @Override - public TimedAttemptSettings createNextAttempt( - Throwable prevThrowable, Object prevResponse, TimedAttemptSettings prevSettings) { - // Return null to indicate that this implementation does not provide any specific attempt - // settings, so by default the TimedRetryAlgorithm options can be used instead. - return null; - } - - @Override - public int hashCode() { - return Objects.hash(interceptors, retriableExceptions, nonRetriableExceptions, retryInfo); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof ExceptionHandler)) { - return false; - } - ExceptionHandler other = (ExceptionHandler) obj; - return Objects.equals(interceptors, other.interceptors) - && Objects.equals(retriableExceptions, other.retriableExceptions) - && Objects.equals(nonRetriableExceptions, other.nonRetriableExceptions) - && Objects.equals(retryInfo, other.retryInfo); - } - - /** Returns an instance which retry any checked exception and abort on any runtime exception. */ - public static ExceptionHandler getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - public static Builder newBuilder() { - return new Builder(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/FieldSelector.java b/google-cloud-core/src/main/java/com/google/cloud/FieldSelector.java deleted file mode 100644 index aad60f7a4d..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/FieldSelector.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2016 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; - -import com.google.api.core.InternalApi; -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -/** - * Interface for Google Cloud resource's fields. Implementations of this interface can be used to - * select only desired fields from a returned Google Cloud resource. - */ -public interface FieldSelector { - - /** - * Returns a string selector. This selector is passed to a Google Cloud service (possibly with - * other field selectors) to specify which resource fields should be returned by an API call. - */ - String getSelector(); - - /** - * A helper class used to build composite selectors given a number of fields. This class is not - * supposed to be used directly by users. - */ - @InternalApi - class Helper { - - private static final String[] EMPTY_FIELDS = {}; - - private Helper() {} - - private static final Function FIELD_TO_STRING_FUNCTION = - new Function() { - @Override - public String apply(FieldSelector fieldSelector) { - return fieldSelector.getSelector(); - } - }; - - private static String selector( - List required, - FieldSelector[] others, - String... extraResourceFields) { - Set fieldStrings = Sets.newHashSetWithExpectedSize(required.size() + others.length); - fieldStrings.addAll(Lists.transform(required, FIELD_TO_STRING_FUNCTION)); - fieldStrings.addAll(Lists.transform(Arrays.asList(others), FIELD_TO_STRING_FUNCTION)); - fieldStrings.addAll(Arrays.asList(extraResourceFields)); - return Joiner.on(',').join(fieldStrings); - } - - /** - * Returns a composite selector given a number of resource fields. The string selector returned - * by this method can be used for field selection in API calls that return a single resource. - * This method is not supposed to be used directly by users. - */ - public static String selector(List required, FieldSelector... others) { - return selector(required, others, new String[] {}); - } - - /** - * Returns a composite selector given a number of resource fields and a container name. The - * string selector returned by this method can be used for field selection in API calls that - * return a list of resources. This method is not supposed to be used directly by users. - */ - public static String listSelector( - String containerName, List required, FieldSelector... others) { - return "nextPageToken," + containerName + '(' + selector(required, others) + ')'; - } - - /** - * Returns a composite selector given a number of resource fields and a container name. This - * method also takes an {@code extraResourceFields} parameter to specify some extra resource - * fields as strings. The string selector returned by this method can be used for field - * selection in API calls that return a list of resources. This method is not supposed to be - * used directly by users. - */ - public static String listSelector( - String containerName, - List required, - FieldSelector[] others, - String... extraResourceFields) { - return listSelector(EMPTY_FIELDS, containerName, required, others, extraResourceFields); - } - - /** - * Returns a composite selector given a number of top level fields as strings, a number of - * resource fields and a container name. This method also takes an {@code extraResourceFields} - * parameter to specify some extra resource fields as strings. The string selector returned by - * this method can be used for field selection in API calls that return a list of resources. - * This method is not supposed to be used directly by users. - */ - public static String listSelector( - String[] topLevelFields, - String containerName, - List required, - FieldSelector[] others, - String... extraResourceFields) { - Set topLevelStrings = Sets.newHashSetWithExpectedSize(topLevelFields.length + 1); - topLevelStrings.addAll(Lists.asList("nextPageToken", topLevelFields)); - return Joiner.on(',').join(topLevelStrings) - + "," - + containerName - + '(' - + selector(required, others, extraResourceFields) - + ')'; - } - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/GcpLaunchStage.java b/google-cloud-core/src/main/java/com/google/cloud/GcpLaunchStage.java deleted file mode 100644 index e83f773c9d..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/GcpLaunchStage.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2017 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; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * A qualifier indicating what level of access and support can be expected of a particular Google - * Cloud Platform feature. The "GeneralAvailability" qualifier is not provided since the vast - * majority of features are in this category. Note that features may be in a later launch stage than - * the client library annotation indicates. - * - *

See more at the Launch Stages - * Documentation. - */ -public class GcpLaunchStage { - - /** - * Early Access features are limited to a closed group of testers. To use these features, you must - * sign up in advance and sign a Trusted Tester agreement (which includes confidentiality - * provisions). These features may be unstable, changed in backward-incompatible ways, and are not - * guaranteed to be released. - */ - @Retention(RetentionPolicy.RUNTIME) - public @interface EarlyAccess {} - - /** - * Alpha is a limited availability test for releases before they are cleared for widespread use. - * By Alpha, all significant design issues are resolved and we are in the process of verifying - * functionality. Alpha customers need to apply for access, agree to applicable terms, and have - * their projects whitelisted. Alpha releases don’t have to be feature complete, no SLAs are - * provided, and there are no technical support obligations, but they will be far enough along - * that customers can actually use them in test environments or for limited-use tests -- just like - * they would in normal production cases. - */ - @Retention(RetentionPolicy.RUNTIME) - public @interface Alpha {} - - /** - * Beta is the point at which we are ready to open a release for any customer to use. There are no - * SLA or technical support obligations in a Beta release, and charges may be waived in some - * cases. Products will be complete from a feature perspective, but may have some open outstanding - * issues. Beta releases are suitable for limited production use cases. - */ - @Retention(RetentionPolicy.RUNTIME) - public @interface Beta {} - - /** - * Deprecated features are scheduled to be shut down and removed. For more information, see the - * “Deprecation Policy” section of our Terms of - * Service and the Google Cloud Platform - * Subject to the Deprecation Policy documentation. - */ - @Retention(RetentionPolicy.RUNTIME) - public @interface Deprecated {} - - private GcpLaunchStage() { - // Intentionally left blank. - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Identity.java b/google-cloud-core/src/main/java/com/google/cloud/Identity.java deleted file mode 100644 index a3aff1ade7..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Identity.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.core.ApiFunction; -import com.google.common.base.CaseFormat; -import java.io.Serializable; -import java.util.Objects; - -/** - * An identity in a {@link Policy}. The following types of identities are permitted in IAM policies: - * - *

    - *
  • Google account - *
  • Service account - *
  • Google group - *
  • Google Apps domain - *
- * - *

There are also two special identities that represent all users and all Google-authenticated - * accounts. - * - * @see Concepts - * related to identity - */ -public final class Identity implements Serializable { - - private static final long serialVersionUID = -8181841964597657446L; - - private final Type type; - private final String value; - - /** The types of IAM identities. */ - public static final class Type extends StringEnumValue { - private static final long serialVersionUID = 3809891273596003916L; - - private Type(String constant) { - super(constant); - } - - private static final ApiFunction CONSTRUCTOR = - new ApiFunction() { - @Override - public Type apply(String constant) { - return new Type(constant); - } - }; - - private static final StringEnumType type = new StringEnumType(Type.class, CONSTRUCTOR); - - /** Represents anyone who is on the internet; with or without a Google account. */ - public static final Type ALL_USERS = type.createAndRegister("ALL_USERS"); - - /** Represents anyone who is authenticated with a Google account or a service account. */ - public static final Type ALL_AUTHENTICATED_USERS = - type.createAndRegister("ALL_AUTHENTICATED_USERS"); - - /** Represents a specific Google account. */ - public static final Type USER = type.createAndRegister("USER"); - - /** Represents a service account. */ - public static final Type SERVICE_ACCOUNT = type.createAndRegister("SERVICE_ACCOUNT"); - - /** Represents a Google group. */ - public static final Type GROUP = type.createAndRegister("GROUP"); - - /** Represents all the users of a Google Apps domain name. */ - public static final Type DOMAIN = type.createAndRegister("DOMAIN"); - - /** Represents owners of a Google Cloud Platform project. */ - public static final Type PROJECT_OWNER = type.createAndRegister("PROJECT_OWNER"); - - /** Represents editors of a Google Cloud Platform project. */ - public static final Type PROJECT_EDITOR = type.createAndRegister("PROJECT_EDITOR"); - - /** Represents viewers of a Google Cloud Platform project. */ - public static final Type PROJECT_VIEWER = type.createAndRegister("PROJECT_VIEWER"); - - /** - * Get the Type for the given String constant, and throw an exception if the constant is not - * recognized. - */ - public static Type valueOfStrict(String constant) { - return type.valueOfStrict(constant); - } - - /** Get the Type for the given String constant, and allow unrecognized values. */ - public static Type valueOf(String constant) { - return type.valueOf(constant); - } - - /** Return the known values for Type. */ - public static Type[] values() { - return type.values(); - } - } - - private Identity(Type type, String value) { - this.type = type; - this.value = value; - } - - public Type getType() { - return type; - } - - /** - * Returns the string identifier for this identity. The value corresponds to: - * - *

    - *
  • email address (for identities of type {@code USER}, {@code SERVICE_ACCOUNT}, and {@code - * GROUP}) - *
  • domain (for identities of type {@code DOMAIN}) - *
  • {@code null} (for identities of type {@code ALL_USERS} and {@code - * ALL_AUTHENTICATED_USERS}) - *
- */ - public String getValue() { - return value; - } - - /** - * Returns a new identity representing anyone who is on the internet; with or without a Google - * account. - */ - public static Identity allUsers() { - return new Identity(Type.ALL_USERS, null); - } - - /** - * Returns a new identity representing anyone who is authenticated with a Google account or a - * service account. - */ - public static Identity allAuthenticatedUsers() { - return new Identity(Type.ALL_AUTHENTICATED_USERS, null); - } - - /** - * Returns a new user identity. - * - * @param email An email address that represents a specific Google account. For example, - * alice@gmail.com or joe@example.com. - */ - public static Identity user(String email) { - return new Identity(Type.USER, checkNotNull(email)); - } - - /** - * Returns a new service account identity. - * - * @param email An email address that represents a service account. For example, - * my-other-app@appspot.gserviceaccount.com. - */ - public static Identity serviceAccount(String email) { - return new Identity(Type.SERVICE_ACCOUNT, checkNotNull(email)); - } - - /** - * Returns a new group identity. - * - * @param email An email address that represents a Google group. For example, - * admins@example.com. - */ - public static Identity group(String email) { - return new Identity(Type.GROUP, checkNotNull(email)); - } - - /** - * Returns a new domain identity. - * - * @param domain A Google Apps domain name that represents all the users of that domain. For - * example, google.com or example.com. - */ - public static Identity domain(String domain) { - return new Identity(Type.DOMAIN, checkNotNull(domain)); - } - - /** - * Returns a new project owner identity. - * - * @param projectId A Google Cloud Platform project ID. For example, my-sample-project. - */ - public static Identity projectOwner(String projectId) { - return new Identity(Type.PROJECT_OWNER, checkNotNull(projectId)); - } - - /** - * Returns a new project editor identity. - * - * @param projectId A Google Cloud Platform project ID. For example, my-sample-project. - */ - public static Identity projectEditor(String projectId) { - return new Identity(Type.PROJECT_EDITOR, checkNotNull(projectId)); - } - - /** - * Returns a new project viewer identity. - * - * @param projectId A Google Cloud Platform project ID. For example, my-sample-project. - */ - public static Identity projectViewer(String projectId) { - return new Identity(Type.PROJECT_VIEWER, checkNotNull(projectId)); - } - - @Override - public String toString() { - return strValue(); - } - - @Override - public int hashCode() { - return Objects.hash(value, type); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Identity)) { - return false; - } - Identity other = (Identity) obj; - return Objects.equals(value, other.getValue()) && Objects.equals(type, other.getType()); - } - - /** - * Returns the string value associated with the identity. Used primarily for converting from - * {@code Identity} objects to strings for protobuf-generated policies. - */ - public String strValue() { - String protobufString = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, type.toString()); - if (value == null) { - return protobufString; - } else { - return protobufString + ":" + value; - } - } - - /** - * Converts a string to an {@code Identity}. Used primarily for converting protobuf-generated - * policy identities to {@code Identity} objects. - */ - public static Identity valueOf(String identityStr) { - String[] info = identityStr.split(":", 2); - Type type = Type.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, info[0])); - if (info.length == 1) { - return new Identity(type, null); - } else if (info.length == 2) { - return new Identity(type, info[1]); - } else { - throw new IllegalArgumentException("Illegal identity string: \"" + identityStr + "\""); - } - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java b/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java deleted file mode 100644 index 8f1bac04ca..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2017 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; - -import static java.nio.charset.StandardCharsets.UTF_8; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; - -/** - * Retrieves Google Cloud project-id and a limited set of instance attributes from Metadata server. - * - * @see - * https://cloud.google.com/compute/docs/storing-retrieving-metadata - */ -public class MetadataConfig { - - private static final String METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/"; - private static final int TIMEOUT_MS = 5000; - - private MetadataConfig() {} - - public static String getProjectId() { - return getAttribute("project/project-id"); - } - - public static String getZone() { - String zoneId = getAttribute("instance/zone"); - if (zoneId != null && zoneId.contains("/")) { - return zoneId.substring(zoneId.lastIndexOf('/') + 1); - } - return zoneId; - } - - public static String getInstanceId() { - return getAttribute("instance/id"); - } - - public static String getClusterName() { - return getAttribute("instance/attributes/cluster-name"); - } - - public static String getContainerName() { - return getAttribute("instance/attributes/container-name"); - } - - public static String getNamespaceId() { - return getAttribute("instance/attributes/namespace-id"); - } - - public static String getAttribute(String attributeName) { - try { - URL url = new URL(METADATA_URL + attributeName); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setConnectTimeout(TIMEOUT_MS); - connection.setReadTimeout(TIMEOUT_MS); - connection.setRequestProperty("Metadata-Flavor", "Google"); - try (InputStream input = connection.getInputStream()) { - if (connection.getResponseCode() == 200) { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, UTF_8))) { - return reader.readLine(); - } - } - } - } catch (IOException ignore) { - // ignore - } - return null; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java b/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java deleted file mode 100644 index a1fbe44b92..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableMap; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Objects of this class represent a resource that can be used for monitoring, logging, billing, or - * other purposes. Examples include virtual machine instances, databases, and storage devices such - * as disks. The type field identifies a {@link MonitoredResourceDescriptor} object that describes - * the resource's schema. Information in the labels field identifies the actual resource and its - * attributes according to the schema. - * - *

For example, the monitored resource for Google Compute Engine VM instances has {@code - * gce_instance} type and specifies values for the labels {@code instance_id} and {@code zone} to - * identify particular VM instances. - */ -public final class MonitoredResource implements Serializable { - - private static final long serialVersionUID = -4393604148752640581L; - - private final String type; - private final Map labels; - - /** A builder for {@code MonitoredResource} objects. */ - public static class Builder { - - private String type; - private Map labels = new HashMap<>(); - - Builder(String type) { - this.type = type; - } - - Builder(MonitoredResource monitoredResource) { - this.type = monitoredResource.type; - this.labels = new HashMap<>(monitoredResource.labels); - } - - /** - * Sets the monitored resource type. This value must match the one of {@link - * MonitoredResourceDescriptor#getType()} of a {@code MonitoredResourceDescriptor} object. For - * example, the type {@code cloudsql_database} represent databases in Google Cloud SQL. - */ - public Builder setType(String type) { - this.type = type; - return this; - } - - /** - * Sets the values for all the labels required by the corresponding monitored resource - * descriptor (see {@link MonitoredResourceDescriptor#getLabels()}. For example, Google Compute - * Engine VM instances use the labels {@code instance_id} and {@code zone}. - */ - public Builder setLabels(Map labels) { - this.labels = new HashMap<>(checkNotNull(labels)); - return this; - } - - /** Adds a label to the labels of the monitored resource. */ - public Builder addLabel(String key, String value) { - this.labels.put(key, value); - return this; - } - - /** Clears all the labels of the monitored resource. */ - public Builder clearLabels() { - this.labels.clear(); - return this; - } - - public MonitoredResource build() { - return new MonitoredResource(this); - } - } - - MonitoredResource(Builder builder) { - this.type = checkNotNull(builder.type); - this.labels = ImmutableMap.copyOf(builder.labels); - } - - /** - * Returns the monitored resource type. This value must match the one of {@link - * MonitoredResourceDescriptor#getType()} of a {@code MonitoredResourceDescriptor} object. For - * example, the type {@code cloudsql_database} represent databases in Google Cloud SQL. - */ - public String getType() { - return type; - } - - /** - * Returns the values for all the labels required by the corresponding monitored resource - * descriptor (see {@link MonitoredResourceDescriptor#getLabels()}. For example, Google Compute - * Engine VM instances use the labels {@code instance_id} and {@code zone}. - */ - public Map getLabels() { - return labels; - } - - @Override - public int hashCode() { - return Objects.hash(type, labels); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof MonitoredResource)) { - return false; - } - MonitoredResource other = (MonitoredResource) obj; - return Objects.equals(type, other.type) && Objects.equals(labels, other.labels); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("type", type).add("labels", labels).toString(); - } - - public com.google.api.MonitoredResource toPb() { - return com.google.api.MonitoredResource.newBuilder().setType(type).putAllLabels(labels).build(); - } - - /** Returns a builder for this {@code MonitoredResource} object. */ - public Builder toBuilder() { - return new Builder(this); - } - - /** Returns a builder for {@code MonitoredResource} objects given the resource's type. */ - public static Builder newBuilder(String type) { - return new Builder(type); - } - - /** Creates a {@code MonitoredResource} object given the resource's type and labels. */ - public static MonitoredResource of(String type, Map labels) { - return newBuilder(type).setLabels(labels).build(); - } - - public static MonitoredResource fromPb(com.google.api.MonitoredResource descriptorPb) { - return new Builder(descriptorPb.getType()).setLabels(descriptorPb.getLabelsMap()).build(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java b/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java deleted file mode 100644 index cfc24590d4..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.core.ApiFunction; -import com.google.common.base.Function; -import com.google.common.base.MoreObjects; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * This class describes the schema of Cloud monitored resources. Monitored resource descriptors - * contain a type name and a set of labels. For example, the monitored resource descriptor for - * Google Compute Engine VM instances has a type of {@code gce_instance} and specifies the use of - * the labels {@code instance_id} and {@code zone} to identify particular VM instances. - */ -public class MonitoredResourceDescriptor implements Serializable { - - private static final long serialVersionUID = -3702077512777687441L; - public static final ApiFunction< - com.google.api.MonitoredResourceDescriptor, MonitoredResourceDescriptor> - FROM_PB_FUNCTION = - new ApiFunction< - com.google.api.MonitoredResourceDescriptor, MonitoredResourceDescriptor>() { - @Override - public MonitoredResourceDescriptor apply( - com.google.api.MonitoredResourceDescriptor pb) { - return fromPb(pb); - } - }; - - private final String type; - private final String name; - private final String displayName; - private final String description; - private final List labels; - - /** - * This class describes a label for a monitored resource. Label descriptors contain the key for - * the label, the type of data that the label can hold and an optional description. - */ - public static class LabelDescriptor implements Serializable { - - private static final long serialVersionUID = -2811608103754481777L; - private static final Function - FROM_PB_FUNCTION = - new Function() { - @Override - public LabelDescriptor apply(com.google.api.LabelDescriptor descriptorPb) { - return fromPb(descriptorPb); - } - }; - private static final Function TO_PB_FUNCTION = - new Function() { - @Override - public com.google.api.LabelDescriptor apply(LabelDescriptor descriptor) { - return descriptor.toPb(); - } - }; - - private final String key; - private final ValueType valueType; - private final String description; - - /** Value types that can be used as label values. */ - public enum ValueType { - STRING(com.google.api.LabelDescriptor.ValueType.STRING), - BOOL(com.google.api.LabelDescriptor.ValueType.BOOL), - INT64(com.google.api.LabelDescriptor.ValueType.INT64); - - private com.google.api.LabelDescriptor.ValueType typePb; - - ValueType(com.google.api.LabelDescriptor.ValueType typePb) { - this.typePb = typePb; - } - - com.google.api.LabelDescriptor.ValueType toPb() { - return typePb; - } - - static ValueType fromPb(com.google.api.LabelDescriptor.ValueType typePb) { - switch (typePb) { - case STRING: - return ValueType.STRING; - case BOOL: - return ValueType.BOOL; - case INT64: - return ValueType.INT64; - default: - throw new IllegalArgumentException("Unrecognized label type"); - } - } - } - - LabelDescriptor(String key, ValueType valueType, String description) { - this.key = checkNotNull(key); - this.valueType = checkNotNull(valueType); - this.description = description; - } - - /** Returns the key associated to this label. */ - public String getKey() { - return key; - } - - /** Returns the type of data that can be assigned to this label. */ - public ValueType getValueType() { - return valueType; - } - - /** - * Returns the optional human-readable description for this label. If not set, this method - * returns {@code null}. - */ - public String getDescription() { - return description; - } - - @Override - public final int hashCode() { - return Objects.hash(key, valueType, description); - } - - @Override - public final boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj == null || !obj.getClass().equals(LabelDescriptor.class)) { - return false; - } - LabelDescriptor other = (LabelDescriptor) obj; - return Objects.equals(key, other.key) - && Objects.equals(valueType, other.valueType) - && Objects.equals(description, other.description); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("key", key) - .add("valueType", valueType) - .add("description", description) - .toString(); - } - - com.google.api.LabelDescriptor toPb() { - com.google.api.LabelDescriptor.Builder builder = - com.google.api.LabelDescriptor.newBuilder().setKey(key).setValueType(valueType.toPb()); - if (description != null) { - builder.setDescription(description); - } - return builder.build(); - } - - static LabelDescriptor fromPb(com.google.api.LabelDescriptor descriptorPb) { - String description = null; - if (descriptorPb.getDescription() != null && !descriptorPb.getDescription().equals("")) { - description = descriptorPb.getDescription(); - } - return new LabelDescriptor( - descriptorPb.getKey(), ValueType.fromPb(descriptorPb.getValueType()), description); - } - } - - static class Builder { - - private final String type; - private String name; - private String displayName; - private String description; - private List labels = new ArrayList<>(); - - Builder(String type) { - this.type = type; - } - - Builder setName(String name) { - this.name = name; - return this; - } - - Builder setDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - Builder setDescription(String description) { - this.description = description; - return this; - } - - Builder setLabels(List labels) { - this.labels = labels; - return this; - } - - MonitoredResourceDescriptor build() { - return new MonitoredResourceDescriptor(this); - } - } - - MonitoredResourceDescriptor(Builder builder) { - this.type = checkNotNull(builder.type); - this.name = builder.name; - this.displayName = builder.displayName; - this.description = builder.description; - this.labels = checkNotNull(builder.labels); - } - - /** - * Returns the monitored resource type. For example, the type {@code cloudsql_database} represents - * databases in Google Cloud SQL. - */ - public String getType() { - return type; - } - - /** - * Returns an optional name for the monitored resource descriptor. If not set, this method returns - * {@code null}. - */ - public String getName() { - return name; - } - - /** - * Returns an optional concise name for the monitored resource type. This value might be displayed - * in user interfaces. For example, {@code Google Cloud SQL Database}. If not set, this method - * returns {@code null}. - */ - public String getDisplayName() { - return displayName; - } - - /** - * Returns an optional detailed description of the monitored resource type. This value might be - * used in documentation. If not set, this method returns {@code null}. - */ - public String getDescription() { - return description; - } - - /** - * Returns a list of labels used to describe instances of this monitored resource type. For - * example, an individual Google Cloud SQL database is identified by values for the labels {@code - * database_id} and {@code region}. - */ - public List getLabels() { - return labels; - } - - @Override - public final int hashCode() { - return Objects.hash(type, name, displayName, description, labels); - } - - @Override - public final boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj == null || !obj.getClass().equals(MonitoredResourceDescriptor.class)) { - return false; - } - MonitoredResourceDescriptor other = (MonitoredResourceDescriptor) obj; - return Objects.equals(type, other.type) - && Objects.equals(name, other.name) - && Objects.equals(displayName, other.displayName) - && Objects.equals(description, other.description) - && Objects.equals(labels, other.labels); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("type", type) - .add("name", name) - .add("displayName", displayName) - .add("description", description) - .add("labels", labels) - .toString(); - } - - public com.google.api.MonitoredResourceDescriptor toPb() { - com.google.api.MonitoredResourceDescriptor.Builder builder = - com.google.api.MonitoredResourceDescriptor.newBuilder() - .setType(type) - .addAllLabels(Iterables.transform(labels, LabelDescriptor.TO_PB_FUNCTION)); - if (name != null) { - builder.setName(name); - } - if (displayName != null) { - builder.setDisplayName(displayName); - } - if (description != null) { - builder.setDescription(description); - } - return builder.build(); - } - - static Builder newBuilder(String type) { - return new Builder(type); - } - - public static MonitoredResourceDescriptor fromPb( - com.google.api.MonitoredResourceDescriptor descriptorPb) { - Builder builder = newBuilder(descriptorPb.getType()); - if (descriptorPb.getName() != null && !descriptorPb.getName().equals("")) { - builder.setName(descriptorPb.getName()); - } - if (descriptorPb.getDisplayName() != null && !descriptorPb.getDisplayName().equals("")) { - builder.setDisplayName(descriptorPb.getDisplayName()); - } - if (descriptorPb.getDescription() != null && !descriptorPb.getDescription().equals("")) { - builder.setDescription(descriptorPb.getDescription()); - } - builder.setLabels( - Lists.transform(descriptorPb.getLabelsList(), LabelDescriptor.FROM_PB_FUNCTION)); - return builder.build(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/NoCredentials.java b/google-cloud-core/src/main/java/com/google/cloud/NoCredentials.java deleted file mode 100644 index 4726c4d0c6..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/NoCredentials.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2016 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; - -import com.google.auth.oauth2.OAuth2Credentials; -import java.io.ObjectStreamException; - -/** - * A placeholder for credentials to signify that requests sent to the server should not be - * authenticated. This is typically useful when using local service emulators. - */ -public class NoCredentials extends OAuth2Credentials { - - private static final long serialVersionUID = -6263971603971044288L; - private static final NoCredentials INSTANCE = new NoCredentials(); - - private NoCredentials() {} - - private Object readResolve() throws ObjectStreamException { - return INSTANCE; - } - - public static NoCredentials getInstance() { - return INSTANCE; - } - - @Override - public boolean equals(Object obj) { - return this == obj; - } - - @Override - public int hashCode() { - return System.identityHashCode(this); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/PageImpl.java b/google-cloud-core/src/main/java/com/google/cloud/PageImpl.java deleted file mode 100644 index 72e0e858b4..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/PageImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2015 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; - -import com.google.api.core.InternalApi; -import com.google.api.gax.paging.Page; -import com.google.common.collect.AbstractIterator; -import com.google.common.collect.ImmutableMap; -import java.io.Serializable; -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; -import java.util.Objects; - -/** - * Base implementation for Google Cloud paginated results. - * - * @param the value type that the page holds - */ -@InternalApi -public class PageImpl implements Page, Serializable { - - private static final long serialVersionUID = 3914827379823557934L; - - private final String cursor; - private final Iterable results; - private final NextPageFetcher pageFetcher; - - /** - * Interface for fetching the next page of results from the service. - * - * @param the value type that the page holds - */ - public interface NextPageFetcher extends Serializable { - - Page getNextPage(); - } - - static class PageIterator extends AbstractIterator { - - private Iterator currentPageIterator; - private Page currentPage; - - PageIterator(Page currentPage) { - this.currentPageIterator = currentPage.getValues().iterator(); - this.currentPage = currentPage; - } - - @Override - protected T computeNext() { - while (!currentPageIterator.hasNext()) { - currentPage = currentPage.getNextPage(); - if (currentPage == null) { - return endOfData(); - } - currentPageIterator = currentPage.getValues().iterator(); - } - return currentPageIterator.next(); - } - } - - /** - * Creates a {@code PageImpl} object. In order for the object to be serializable the {@code - * results} parameter must be serializable. - */ - public PageImpl(NextPageFetcher pageFetcher, String cursor, Iterable results) { - this.pageFetcher = pageFetcher; - this.cursor = cursor; - this.results = results; - } - - @Override - public Iterable getValues() { - return results == null ? Collections.emptyList() : results; - } - - @Override - public Iterable iterateAll() { - return new Iterable() { - @Override - public Iterator iterator() { - return new PageIterator<>(PageImpl.this); - } - }; - } - - @Override - public boolean hasNextPage() { - return getNextPageToken() != null && !getNextPageToken().equals(""); - } - - @Override - public String getNextPageToken() { - return cursor; - } - - @Override - public Page getNextPage() { - if (cursor == null || pageFetcher == null) { - return null; - } - return pageFetcher.getNextPage(); - } - - @Override - public int hashCode() { - return Objects.hash(cursor, results); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof PageImpl)) { - return false; - } - PageImpl other = (PageImpl) obj; - return Objects.equals(cursor, other.cursor) && Objects.equals(results, other.results); - } - - /** - * Utility method to construct the options map for the next page request. - * - * @param the value type that the page holds. Instances of {@code T} should be {@code - * Serializable} - * @param pageTokenOption the key for the next page cursor option in the options map - * @param cursor the cursor for the next page - * @param optionMap the previous options map - * @return the options map for the next page request - */ - public static Map nextRequestOptions( - T pageTokenOption, String cursor, Map optionMap) { - ImmutableMap.Builder builder = ImmutableMap.builder(); - if (cursor != null) { - builder.put(pageTokenOption, cursor); - } - for (Map.Entry option : optionMap.entrySet()) { - if (!Objects.equals(option.getKey(), pageTokenOption)) { - builder.put(option.getKey(), option.getValue()); - } - } - return builder.build(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/PlatformInformation.java b/google-cloud-core/src/main/java/com/google/cloud/PlatformInformation.java deleted file mode 100644 index 8c77bb9e91..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/PlatformInformation.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017 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; - -import com.google.api.core.InternalApi; - -@InternalApi("This class should only be used within google-cloud-java") -public final class PlatformInformation { - public static final String GAE_RUNTIME = System.getenv("GAE_RUNTIME"); - - private PlatformInformation() {} - - public static boolean isOnGAEStandard7() { - return "java7".equals(GAE_RUNTIME); - } - - public static boolean isOnGAEStandard8() { - return "java8".equals(GAE_RUNTIME); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Policy.java b/google-cloud-core/src/main/java/com/google/cloud/Policy.java deleted file mode 100644 index 1c5b78c9ea..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Policy.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.core.ApiFunction; -import com.google.api.core.InternalApi; -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.io.BaseEncoding; -import com.google.protobuf.ByteString; -import com.google.type.Expr; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -/** - * Class for Identity and Access Management (IAM) policies. IAM policies are used to specify access - * settings for Cloud Platform resources. A policy is a list of bindings. A binding assigns a set of - * identities to a role, where the identities can be user accounts, Google groups, Google domains, - * and service accounts. A role is a named list of permissions defined by IAM. - * - * @see Policy - */ -public final class Policy implements Serializable { - - private static final long serialVersionUID = -3348914530232544290L; - private final ImmutableList bindingsList; - private final String etag; - private final int version; - - /* - * Return true if Policy is version 3 OR bindings has a conditional binding. - * Return false if Policy is version 1 AND bindings does not have a conditional binding. - */ - private static boolean isConditional(int version, List bindingsList) { - for (Binding binding : bindingsList) { - if (binding.getCondition() != null) { - return true; - } - } - if (version == 3) { - return true; - } - return false; - } - - public abstract static class Marshaller { - - @InternalApi("This class should only be extended within google-cloud-java") - protected Marshaller() {} - - protected static final ApiFunction IDENTITY_VALUE_OF_FUNCTION = - new ApiFunction() { - @Override - public Identity apply(String identityPb) { - return Identity.valueOf(identityPb); - } - }; - protected static final ApiFunction IDENTITY_STR_VALUE_FUNCTION = - new ApiFunction() { - @Override - public String apply(Identity identity) { - return identity.strValue(); - } - }; - - protected abstract Policy fromPb(T policyPb); - - protected abstract T toPb(Policy policy); - } - - public static class DefaultMarshaller extends Marshaller { - - @Override - protected Policy fromPb(com.google.iam.v1.Policy policyPb) { - ImmutableList.Builder bindingsListBuilder = ImmutableList.builder(); - for (com.google.iam.v1.Binding bindingPb : policyPb.getBindingsList()) { - Binding.Builder convertedBinding = - Binding.newBuilder() - .setRole(bindingPb.getRole()) - .setMembers(bindingPb.getMembersList()); - if (bindingPb.hasCondition()) { - Expr expr = bindingPb.getCondition(); - convertedBinding.setCondition( - Condition.newBuilder() - .setTitle(expr.getTitle()) - .setDescription(expr.getDescription()) - .setExpression(expr.getExpression()) - .build()); - } - bindingsListBuilder.add(convertedBinding.build()); - } - return newBuilder() - .setBindings(bindingsListBuilder.build()) - .setEtag( - policyPb.getEtag().isEmpty() - ? null - : BaseEncoding.base64().encode(policyPb.getEtag().toByteArray())) - .setVersion(policyPb.getVersion()) - .build(); - } - - @Override - protected com.google.iam.v1.Policy toPb(Policy policy) { - com.google.iam.v1.Policy.Builder policyBuilder = com.google.iam.v1.Policy.newBuilder(); - List bindingPbList = new LinkedList<>(); - for (Binding binding : policy.getBindingsList()) { - com.google.iam.v1.Binding.Builder bindingBuilder = com.google.iam.v1.Binding.newBuilder(); - bindingBuilder.setRole(binding.getRole()); - bindingBuilder.addAllMembers(binding.getMembers()); - if (binding.getCondition() != null) { - Condition condition = binding.getCondition(); - bindingBuilder.setCondition( - Expr.newBuilder() - .setTitle(condition.getTitle()) - .setDescription(condition.getDescription()) - .setExpression(condition.getExpression()) - .build()); - } - bindingPbList.add(bindingBuilder.build()); - } - policyBuilder.addAllBindings(bindingPbList); - if (policy.etag != null) { - policyBuilder.setEtag(ByteString.copyFrom(BaseEncoding.base64().decode(policy.etag))); - } - policyBuilder.setVersion(policy.version); - return policyBuilder.build(); - } - } - - /** A builder for {@code Policy} objects. */ - public static class Builder { - private final List bindingsList = new ArrayList(); - private String etag; - private int version; - - @InternalApi("This class should only be extended within google-cloud-java") - protected Builder() {} - - @InternalApi("This class should only be extended within google-cloud-java") - protected Builder(Policy policy) { - bindingsList.addAll(policy.bindingsList); - setEtag(policy.etag); - setVersion(policy.version); - } - - /** - * Replaces the builder's map of bindings with the given map of bindings. - * - * @throws NullPointerException if the given map is null or contains any null keys or values - * @throws IllegalArgumentException if any identities in the given map are null or if policy - * version is equal to 3 or has conditional bindings because conditional policies are not - * supported - */ - public final Builder setBindings(Map> bindings) { - checkNotNull(bindings, "The provided map of bindings cannot be null."); - checkArgument( - !isConditional(this.version, this.bindingsList), - "setBindings() is only supported with version 1 policies and non-conditional policies"); - for (Map.Entry> binding : bindings.entrySet()) { - checkNotNull(binding.getKey(), "The role cannot be null."); - Set identities = binding.getValue(); - checkNotNull(identities, "A role cannot be assigned to a null set of identities."); - checkArgument(!identities.contains(null), "Null identities are not permitted."); - } - // convert into List format - this.bindingsList.clear(); - for (Map.Entry> binding : bindings.entrySet()) { - Binding.Builder bindingBuilder = Binding.newBuilder(); - bindingBuilder.setRole(binding.getKey().getValue()); - ImmutableList.Builder membersBuilder = ImmutableList.builder(); - for (Identity identity : binding.getValue()) { - membersBuilder.add(identity.strValue()); - } - bindingBuilder.setMembers(membersBuilder.build()); - this.bindingsList.add(bindingBuilder.build()); - } - return this; - } - - /** - * Replaces the builder's List of bindings with the given List of Bindings. - * - * @throws NullPointerException if the given list is null, role is null, or contains any null - * members in bindings - */ - public final Builder setBindings(List bindings) { - this.bindingsList.clear(); - for (Binding binding : bindings) { - Binding.Builder bindingBuilder = Binding.newBuilder(); - bindingBuilder.setMembers(ImmutableList.copyOf(binding.getMembers())); - bindingBuilder.setRole(binding.getRole()); - bindingBuilder.setCondition(binding.getCondition()); - this.bindingsList.add(bindingBuilder.build()); - } - return this; - } - - /** - * Removes the role (and all identities associated with that role) from the policy. - * - * @throws IllegalArgumentException if policy version is equal to 3 or has conditional bindings - * because conditional policies are not supported - */ - public final Builder removeRole(Role role) { - checkArgument( - !isConditional(this.version, this.bindingsList), - "removeRole() is only supported with version 1 policies and non-conditional policies"); - Iterator iterator = bindingsList.iterator(); - - while (iterator.hasNext()) { - Binding binding = (Binding) iterator.next(); - if (binding.getRole().equals(role.getValue())) { - iterator.remove(); - return this; - } - } - return this; - } - - /** - * Adds one or more identities to the policy under the role specified. - * - * @throws NullPointerException if the role or any of the identities is null. - * @throws IllegalArgumentException if policy version is equal to 3 or has conditional bindings. - */ - public final Builder addIdentity(Role role, Identity first, Identity... others) { - checkArgument( - !isConditional(this.version, this.bindingsList), - "addIdentity() is only supported with version 1 policies and non-conditional policies"); - String nullIdentityMessage = "Null identities are not permitted."; - checkNotNull(first, nullIdentityMessage); - checkNotNull(others, nullIdentityMessage); - checkNotNull(role, "The role cannot be null."); - for (int i = 0; i < bindingsList.size(); i++) { - Binding binding = bindingsList.get(i); - if (binding.getRole().equals(role.getValue())) { - Binding.Builder bindingBuilder = binding.toBuilder(); - ImmutableSet.Builder membersBuilder = ImmutableSet.builder(); - membersBuilder.addAll(binding.getMembers()); - membersBuilder.add(first.strValue()); - for (Identity identity : others) { - membersBuilder.add(identity.strValue()); - } - bindingBuilder.setMembers(membersBuilder.build()); - bindingsList.set(i, bindingBuilder.build()); - return this; - } - } - // Binding does not yet exist. - Binding.Builder bindingBuilder = Binding.newBuilder().setRole(role.getValue()); - ImmutableSet.Builder membersBuilder = ImmutableSet.builder(); - membersBuilder.add(first.strValue()); - for (Identity identity : others) { - membersBuilder.add(identity.strValue()); - } - bindingBuilder.setMembers(membersBuilder.build()); - bindingsList.add(bindingBuilder.build()); - return this; - } - - /** - * Removes one or more identities from an existing binding. Does nothing if the binding - * associated with the provided role doesn't exist. - * - * @throws IllegalArgumentException if policy version is equal to 3 or has conditional bindings - */ - public final Builder removeIdentity(Role role, Identity first, Identity... others) { - checkArgument( - !isConditional(this.version, this.bindingsList), - "removeIdentity() is only supported with version 1 policies and non-conditional policies"); - String nullIdentityMessage = "Null identities are not permitted."; - checkNotNull(first, nullIdentityMessage); - checkNotNull(others, nullIdentityMessage); - checkNotNull(role, "The role cannot be null."); - for (int i = 0; i < bindingsList.size(); i++) { - Binding binding = bindingsList.get(i); - if (binding.getRole().equals(role.getValue())) { - Binding.Builder bindingBuilder = binding.toBuilder().removeMembers(first.strValue()); - for (Identity identity : others) { - bindingBuilder.removeMembers(identity.strValue()); - } - Binding updatedBindings = bindingBuilder.build(); - bindingsList.set(i, updatedBindings); - break; - } - } - - Iterator iterator = bindingsList.iterator(); - while (iterator.hasNext()) { - Binding binding = (Binding) iterator.next(); - if (binding.getRole().equals(role.getValue()) && binding.getMembers().size() == 0) { - iterator.remove(); - break; - } - } - - return this; - } - - /** - * Sets the policy's etag. - * - *

Etags are used for optimistic concurrency control as a way to help prevent simultaneous - * updates of a policy from overwriting each other. It is strongly suggested that systems make - * use of the etag in the read-modify-write cycle to perform policy updates in order to avoid - * race conditions. An etag is returned in the response to getIamPolicy, and systems are - * expected to put that etag in the request to setIamPolicy to ensure that their change will be - * applied to the same version of the policy. If no etag is provided in the call to - * setIamPolicy, then the existing policy is overwritten blindly. - */ - public final Builder setEtag(String etag) { - this.etag = etag; - return this; - } - - /** Sets the version of the policy. */ - public final Builder setVersion(int version) { - this.version = version; - return this; - } - - /** Creates a {@code Policy} object. */ - public final Policy build() { - return new Policy(this); - } - } - - private Policy(Builder builder) { - this.bindingsList = ImmutableList.copyOf(builder.bindingsList); - this.etag = builder.etag; - this.version = builder.version; - } - - /** Returns a builder containing the properties of this IAM Policy. */ - public Builder toBuilder() { - return new Builder(this); - } - - /** - * Returns the map of bindings that comprises the policy. - * - * @throws IllegalArgumentException if policy version is equal to 3 or has conditional bindings - */ - public Map> getBindings() { - checkArgument( - !isConditional(this.version, this.bindingsList), - "getBindings() is only supported with version 1 policies and non-conditional policies"); - ImmutableMap.Builder> bindingsV1Builder = ImmutableMap.builder(); - for (Binding binding : bindingsList) { - ImmutableSet.Builder identities = ImmutableSet.builder(); - for (String member : binding.getMembers()) { - identities.add(Identity.valueOf(member)); - } - bindingsV1Builder.put(Role.of(binding.getRole()), identities.build()); - } - return bindingsV1Builder.build(); - } - - /** Returns the list of bindings that comprises the policy for version 3. */ - public ImmutableList getBindingsList() { - return bindingsList; - } - - /** - * Returns the policy's etag. - * - *

Etags are used for optimistic concurrency control as a way to help prevent simultaneous - * updates of a policy from overwriting each other. It is strongly suggested that systems make use - * of the etag in the read-modify-write cycle to perform policy updates in order to avoid race - * conditions. An etag is returned in the response to getIamPolicy, and systems are expected to - * put that etag in the request to setIamPolicy to ensure that their change will be applied to the - * same version of the policy. If no etag is provided in the call to setIamPolicy, then the - * existing policy is overwritten blindly. - */ - public String getEtag() { - return etag; - } - - /** - * Returns the version of the policy. The default version is 0, meaning only the "owner", - * "editor", and "viewer" roles are permitted. If the version is 1, you may also use other roles. - */ - public int getVersion() { - return version; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("bindings", bindingsList) - .add("etag", etag) - .add("version", version) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hash(getClass(), bindingsList, etag, version); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Policy)) { - return false; - } - Policy other = (Policy) obj; - if (bindingsList == null && other.getBindingsList() == null) { - return true; - } - if ((bindingsList == null && other.getBindingsList() != null) - || bindingsList != null && other.getBindingsList() == null - || bindingsList.size() != other.getBindingsList().size()) { - return false; - } - for (Binding binding : bindingsList) { - if (!other.getBindingsList().contains(binding)) { - return false; - } - } - return Objects.equals(etag, other.getEtag()) && version == other.getVersion(); - } - - /** Returns a builder for {@code Policy} objects. */ - public static Builder newBuilder() { - return new Builder(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ReadChannel.java b/google-cloud-core/src/main/java/com/google/cloud/ReadChannel.java deleted file mode 100644 index effc33ee8e..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ReadChannel.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2015 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; - -import java.io.Closeable; -import java.io.IOException; -import java.nio.channels.ReadableByteChannel; - -/** - * A channel for reading data from a Google Cloud object. - * - *

Implementations of this class may buffer data internally to reduce remote calls. This - * interface implements {@link Restorable} to allow saving the reader's state to continue reading - * afterwards. - */ -public interface ReadChannel extends ReadableByteChannel, Closeable, Restorable { - - /** - * Overridden to remove IOException. - * - * @see java.nio.channels.Channel#close() - */ - @Override - void close(); - - /** Set the offset to read from. */ - void seek(long position) throws IOException; - - /** - * Sets the minimum size that will be read by a single RPC. Read data will be locally buffered - * until consumed. - */ - void setChunkSize(int chunkSize); - - /** - * Captures the read channel state so that it can be saved and restored afterwards. - * - * @return a {@link RestorableState} object that contains the read channel state and can restore - * it afterwards. - */ - @Override - RestorableState capture(); - - /** - * Limit the maximum number of bytes to be read from the objects content, counting from the - * beginning of the object, which will be available to read from this channel. If the limit is - * larger than the actual size of the content this will have no material impact. - * - *

If used in conjunction with {@link #seek(long)} the total number of returned bytes from this - * channel will be reduced by the number of bytes specified to seek. - * - *

The value provided as {@code limit} will define a left-closed, - * right-open interval along with either {@code 0} or any value provided to {@link - * #seek(long)}, i.e. {@code [}{@link #seek(long)}{@code , }{@link #limit(long)}{@code )}. - * - *

An example to help illustrate the relationship

- * - * Imagine some data {@code [A, B, C, D, E, F, G, H, I, J]}, 10 bytes total. - * - *
    - *
  1. {@code limit(5)} would produce {@code [A, B, C, D, E]} - *
  2. {@code seek(8)} would produce {@code [I, J]} - *
  3. {@code seek(2)} {@code limit(5)} would produce {@code [C, D, E]} - *
  4. {@code seek(3)} {@code limit(3)} would produce {@code []} - *
- * - *

NOTE:Implementers are not required to return a new instance from this method, however - * they are allowed to. Users of this method should always use the instance returned from this - * method. - * - *

Default Implementation:By default, this method will simply return {@code this}. - * - * @param limit the maximum number of bytes to limit this channel to - * @return The instance of channel which will respect the limit. - * @throws UnsupportedOperationException If the {@code this} instances does not support limiting - * @since 2.4.0 - */ - default ReadChannel limit(long limit) { - return this; - } - - /** - * The currently defined limit for this channel. Initial value is {@link Long#MAX_VALUE} - * - * @return the current limit for this channel - * @throws UnsupportedOperationException If the {@code this} instances does not support limiting - * @since 2.4.0 - */ - default long limit() { - return Long.MAX_VALUE; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Restorable.java b/google-cloud-core/src/main/java/com/google/cloud/Restorable.java deleted file mode 100644 index 7feedf0c6e..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Restorable.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2015 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; - -/** - * Implementation of this interface can persist their state and restore from it. - * - *

A typical capture usage: - * - *

{@code
- * X restorableObj; // X instanceof Restorable
- * RestorableState state = restorableObj.capture();
- * .. persist state
- * }
- * - *

A typical restore usage: - * - *

{@code
- * RestorableState state = ... // read from persistence
- * X restorableObj = state.restore();
- * ...
- * }
- * - * @param the restorable object's type - */ -public interface Restorable> { - - /** - * Captures the state of this object. - * - * @return a {@link RestorableState} instance that contains the state for this object and can - * restore it afterwards. - */ - RestorableState capture(); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/RestorableState.java b/google-cloud-core/src/main/java/com/google/cloud/RestorableState.java deleted file mode 100644 index 53a6458f1f..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/RestorableState.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 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; - -/** - * A common interface for restorable states. Implementations of {@code RestorableState} are capable - * of saving the state of an object to restore it for later use. - * - *

Implementations of this class must implement {@link java.io.Serializable} to ensure that the - * state of a the object can be correctly serialized. - * - * @param the restored object's type - */ -public interface RestorableState> { - - /** Returns an object whose internal state reflects the one saved in the invocation object. */ - T restore(); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/RetryHelper.java b/google-cloud-core/src/main/java/com/google/cloud/RetryHelper.java deleted file mode 100644 index 986fd35587..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/RetryHelper.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2015 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; - -import com.google.api.core.ApiClock; -import com.google.api.core.BetaApi; -import com.google.api.gax.retrying.DirectRetryingExecutor; -import com.google.api.gax.retrying.ExponentialPollAlgorithm; -import com.google.api.gax.retrying.ExponentialRetryAlgorithm; -import com.google.api.gax.retrying.ResultRetryAlgorithm; -import com.google.api.gax.retrying.RetryAlgorithm; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.retrying.RetryingExecutor; -import com.google.api.gax.retrying.RetryingFuture; -import com.google.api.gax.retrying.TimedRetryAlgorithm; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; - -/** - * Utility class for retrying operations. For more details about the parameters, see {@link - * RetrySettings}. In case if retrying is unsuccessful, {@link RetryHelperException} will be thrown. - */ -@BetaApi -public class RetryHelper { - public static V runWithRetries( - Callable callable, - RetrySettings retrySettings, - ResultRetryAlgorithm resultRetryAlgorithm, - ApiClock clock) - throws RetryHelperException { - try { - // Suppressing should be ok as a workaraund. Current and only ResultRetryAlgorithm - // implementation does not use response at all, so ignoring its type is ok. - @SuppressWarnings("unchecked") - ResultRetryAlgorithm algorithm = (ResultRetryAlgorithm) resultRetryAlgorithm; - return run(callable, new ExponentialRetryAlgorithm(retrySettings, clock), algorithm); - } catch (Exception e) { - // TODO: remove RetryHelperException, throw InterruptedException or - // ExecutionException#getCause() explicitly - throw new RetryHelperException(e.getCause()); - } - } - - public static V poll( - Callable callable, - RetrySettings pollSettings, - ResultRetryAlgorithm resultPollAlgorithm, - ApiClock clock) - throws ExecutionException, InterruptedException { - return run(callable, new ExponentialPollAlgorithm(pollSettings, clock), resultPollAlgorithm); - } - - private static V run( - Callable callable, - TimedRetryAlgorithm timedAlgorithm, - ResultRetryAlgorithm resultAlgorithm) - throws ExecutionException, InterruptedException { - RetryAlgorithm retryAlgorithm = new RetryAlgorithm<>(resultAlgorithm, timedAlgorithm); - RetryingExecutor executor = new DirectRetryingExecutor<>(retryAlgorithm); - - RetryingFuture retryingFuture = executor.createFuture(callable); - executor.submit(retryingFuture); - return retryingFuture.get(); - } - - public static class RetryHelperException extends RuntimeException { - - private static final long serialVersionUID = -8519852520090965314L; - - RetryHelperException(Throwable cause) { - super(cause); - } - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/RetryOption.java b/google-cloud-core/src/main/java/com/google/cloud/RetryOption.java deleted file mode 100644 index a1069b48a2..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/RetryOption.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.core.BetaApi; -import com.google.api.gax.retrying.RetrySettings; -import java.io.Serializable; -import org.threeten.bp.Duration; - -/** - * This class represents an options wrapper around the {@link RetrySettings} class and is an - * alternative way of initializing it. The retry options are usually provided in a form of varargs - * for methods that wait for changes in the status of a resource, do poll operations or retry on - * failures. - */ -@BetaApi -public class RetryOption implements Serializable { - - private static final long serialVersionUID = 3622837212525370224L; - - private enum OptionType { - TOTAL_TIMEOUT, - INITIAL_RETRY_DELAY, - RETRY_DELAY_MULTIPLIER, - MAX_RETRY_DELAY, - MAX_ATTEMPTS, - JITTERED - } - - private final OptionType type; - private final Object value; - - private RetryOption(OptionType type, Object value) { - this.type = checkNotNull(type); - this.value = checkNotNull(value); - } - - /** See {@link RetrySettings#getTotalTimeout()}. */ - public static RetryOption totalTimeout(Duration totalTimeout) { - return new RetryOption(OptionType.TOTAL_TIMEOUT, totalTimeout); - } - - /** See {@link RetrySettings#getInitialRetryDelay()}. */ - public static RetryOption initialRetryDelay(Duration initialRetryDelay) { - return new RetryOption(OptionType.INITIAL_RETRY_DELAY, initialRetryDelay); - } - - /** See {@link RetrySettings#getRetryDelayMultiplier()}. */ - public static RetryOption retryDelayMultiplier(double retryDelayMultiplier) { - return new RetryOption(OptionType.RETRY_DELAY_MULTIPLIER, retryDelayMultiplier); - } - - /** See {@link RetrySettings#getMaxRetryDelay()}. */ - public static RetryOption maxRetryDelay(Duration maxRetryDelay) { - return new RetryOption(OptionType.MAX_RETRY_DELAY, maxRetryDelay); - } - - /** See {@link RetrySettings#getMaxAttempts()}. */ - public static RetryOption maxAttempts(int maxAttempts) { - return new RetryOption(OptionType.MAX_ATTEMPTS, maxAttempts); - } - - /** See {@link RetrySettings#isJittered()} ()}. */ - public static RetryOption jittered(boolean jittered) { - return new RetryOption(OptionType.JITTERED, jittered); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - RetryOption that = (RetryOption) o; - - if (type != that.type) { - return false; - } - return value.equals(that.value); - } - - @Override - public int hashCode() { - int result = type.hashCode(); - result = 31 * result + value.hashCode(); - return result; - } - - /** - * Creates a new {@code RetrySettings} instance, merging provided settings and multiple {@code - * RetryOptions}, each of which represents a single property in {@code RetrySettings}. It is an - * alternative way of initializing {@link RetrySettings} instances. - * - * @param settings retry settings - * @param options zero or more Retry - * @return new {@code RetrySettings} instance, which is a result of merging {@code options} into - * {@code settings}, i.e. each element in {@code options}, if present, overrides corresponding - * property in {@code settings} - */ - public static RetrySettings mergeToSettings(RetrySettings settings, RetryOption... options) { - if (options.length <= 0) { - return settings; - } - RetrySettings.Builder builder = settings.toBuilder(); - for (RetryOption option : options) { - switch (option.type) { - case TOTAL_TIMEOUT: - builder.setTotalTimeout((Duration) option.value); - break; - case INITIAL_RETRY_DELAY: - builder.setInitialRetryDelay((Duration) option.value); - break; - case RETRY_DELAY_MULTIPLIER: - builder.setRetryDelayMultiplier((Double) option.value); - break; - case MAX_RETRY_DELAY: - builder.setMaxRetryDelay((Duration) option.value); - break; - case MAX_ATTEMPTS: - builder.setMaxAttempts((Integer) option.value); - break; - case JITTERED: - builder.setJittered((Boolean) option.value); - break; - default: - throw new IllegalArgumentException("Unknown option type: " + option.type); - } - } - return builder.build(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Role.java b/google-cloud-core/src/main/java/com/google/cloud/Role.java deleted file mode 100644 index e75dd5f8f2..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Role.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.io.Serializable; -import java.util.Objects; - -/** - * A role in a IAM {@link Policy}. Project owners can grant access to team members to access - * project's resources and APIs by granting IAM roles to team members. - * - * @see Viewing the Grantable - * Roles on Resources - * @see Understanding Roles - */ -public final class Role implements Serializable { - - private static final long serialVersionUID = -7779252712160972508L; - private static final String ROLE_PREFIX = "roles/"; - - private final String value; - - private Role(String value) { - this.value = value; - } - - /** - * Returns the string identifier for this role. For example, {@code "roles/viewer"}, {@code - * "roles/editor"}, or {@code "roles/owner"}. - */ - public String getValue() { - return value; - } - - /** - * Returns the viewer role. Encapsulates the permission for read-only actions that preserve state - * of a resource. - * - * @see Understanding Roles - */ - public static Role viewer() { - return of("viewer"); - } - - /** - * Returns the editor role. Encapsulates all viewer's permissions and permissions for actions that - * modify the state of a resource. - * - * @see Understanding Roles - */ - public static Role editor() { - return of("editor"); - } - - /** - * Returns the owner role. Encapsulates all editor's permissions and permissions to manage access - * control for a resource or manage the billing options for a project. - * - * @see Understanding Roles - */ - public static Role owner() { - return of("owner"); - } - - /** - * Returns a new role given its string value. - * - *

If the value contains no slash character ({@code '/'}), the prefix {@code "roles/""} is - * prepended. This slightly simplifies usage for predefined roles. For custom roles, call this - * method with the fully-qualified name, eg {@code "projects/XXX/roles/YYY"}. - * - * @param value the string value for the role - * @see Viewing the Grantable - * Roles on Resources - */ - public static Role of(String value) { - checkNotNull(value); - if (!value.contains("/")) { - value = ROLE_PREFIX + value; - } - return new Role(value); - } - - @Override - public int hashCode() { - return Objects.hash(value); - } - - @Override - public String toString() { - return value; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof Role && Objects.equals(value, ((Role) obj).getValue()); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Service.java b/google-cloud-core/src/main/java/com/google/cloud/Service.java deleted file mode 100644 index bfacabdf7f..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Service.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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; - -/** - * Interface for service objects. - * - * @param the {@code ServiceOptions} subclass corresponding to the service - */ -public interface Service> { - - OptionsT getOptions(); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ServiceDefaults.java b/google-cloud-core/src/main/java/com/google/cloud/ServiceDefaults.java deleted file mode 100644 index 7151740d99..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ServiceDefaults.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017 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; - -import com.google.cloud.spi.ServiceRpcFactory; -import java.io.Serializable; - -public interface ServiceDefaults< - ServiceT extends Service, OptionsT extends ServiceOptions> - extends Serializable { - ServiceFactory getDefaultServiceFactory(); - - ServiceRpcFactory getDefaultRpcFactory(); - - TransportOptions getDefaultTransportOptions(); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ServiceFactory.java b/google-cloud-core/src/main/java/com/google/cloud/ServiceFactory.java deleted file mode 100644 index 3b8fefe52d..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ServiceFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 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; - -/** - * A base interface for all service factories. - * - *

Implementation must provide a public no-arg constructor. Loading of a factory implementation - * is done via {@link java.util.ServiceLoader}. - * - * @param the service subclass - * @param the {@code ServiceOptions} subclass corresponding to the service - */ -@SuppressWarnings("rawtypes") -public interface ServiceFactory { - - ServiceT create(ServiceOptionsT serviceOptions); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java b/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java deleted file mode 100644 index 231b9040c9..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java +++ /dev/null @@ -1,770 +0,0 @@ -/* - * Copyright 2015 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; - -import static com.google.common.base.MoreObjects.firstNonNull; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import com.google.api.client.http.GenericUrl; -import com.google.api.client.http.HttpHeaders; -import com.google.api.client.http.HttpRequest; -import com.google.api.client.http.HttpRequestFactory; -import com.google.api.client.http.HttpResponse; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.GenericJson; -import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.JsonObjectParser; -import com.google.api.client.json.gson.GsonFactory; -import com.google.api.core.ApiClock; -import com.google.api.core.BetaApi; -import com.google.api.core.CurrentMillisClock; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.GaxProperties; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.FixedHeaderProvider; -import com.google.api.gax.rpc.HeaderProvider; -import com.google.api.gax.rpc.NoHeaderProvider; -import com.google.auth.Credentials; -import com.google.auth.oauth2.GoogleCredentials; -import com.google.auth.oauth2.QuotaProjectIdProvider; -import com.google.auth.oauth2.ServiceAccountCredentials; -import com.google.cloud.spi.ServiceRpcFactory; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.io.Files; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.ServiceLoader; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.threeten.bp.Duration; - -/** - * Abstract class representing service options. - * - * @param the service subclass - * @param the {@code ServiceOptions} subclass corresponding to the service - */ -public abstract class ServiceOptions< - ServiceT extends Service, OptionsT extends ServiceOptions> - implements Serializable { - - public static final String CREDENTIAL_ENV_NAME = "GOOGLE_APPLICATION_CREDENTIALS"; - - private static final String DEFAULT_HOST = "https://www.googleapis.com"; - private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; - private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; - - private static final RetrySettings DEFAULT_RETRY_SETTINGS = - getDefaultRetrySettingsBuilder().build(); - private static final RetrySettings NO_RETRY_SETTINGS = - getDefaultRetrySettingsBuilder().setMaxAttempts(1).build(); - - private static final long serialVersionUID = 9198896031667942014L; - protected final String clientLibToken; - - private final String projectId; - private final String host; - private final RetrySettings retrySettings; - private final String serviceRpcFactoryClassName; - private final String serviceFactoryClassName; - private final ApiClock clock; - protected Credentials credentials; - private final TransportOptions transportOptions; - private final HeaderProvider headerProvider; - private final String quotaProjectId; - - private transient ServiceRpcFactory serviceRpcFactory; - private transient ServiceFactory serviceFactory; - private transient ServiceT service; - private transient ServiceRpc rpc; - - /** - * Builder for {@code ServiceOptions}. - * - * @param the service subclass - * @param the {@code ServiceOptions} subclass corresponding to the service - * @param the {@code ServiceOptions} builder - */ - public abstract static class Builder< - ServiceT extends Service, - OptionsT extends ServiceOptions, - B extends Builder> { - - private final ImmutableSet allowedClientLibTokens = - ImmutableSet.of(ServiceOptions.getGoogApiClientLibName()); - private String projectId; - private String host; - protected Credentials credentials; - private RetrySettings retrySettings; - private ServiceFactory serviceFactory; - private ServiceRpcFactory serviceRpcFactory; - private ApiClock clock; - private TransportOptions transportOptions; - private HeaderProvider headerProvider; - private String clientLibToken = ServiceOptions.getGoogApiClientLibName(); - private String quotaProjectId; - - @InternalApi("This class should only be extended within google-cloud-java") - protected Builder() {} - - @InternalApi("This class should only be extended within google-cloud-java") - protected Builder(ServiceOptions options) { - projectId = options.projectId; - host = options.host; - credentials = options.credentials; - retrySettings = options.retrySettings; - serviceFactory = options.serviceFactory; - serviceRpcFactory = options.serviceRpcFactory; - clock = options.clock; - transportOptions = options.transportOptions; - clientLibToken = options.clientLibToken; - quotaProjectId = options.quotaProjectId; - } - - protected abstract ServiceOptions build(); - - @SuppressWarnings("unchecked") - protected B self() { - return (B) this; - } - - /** Sets the service factory. */ - public B setServiceFactory(ServiceFactory serviceFactory) { - this.serviceFactory = serviceFactory; - return self(); - } - - /** - * Sets the service's clock. The clock is mainly used for testing purpose. {@link ApiClock} will - * be replaced by Java8's {@code java.time.Clock}. - * - * @param clock the clock to set - * @return the builder - */ - public B setClock(ApiClock clock) { - this.clock = clock; - return self(); - } - - /** - * Sets the project ID. If no project ID is set, {@link #getDefaultProjectId()} will be used to - * attempt getting the project ID from the environment. - * - * @return the builder - */ - public B setProjectId(String projectId) { - this.projectId = projectId; - return self(); - } - - /** - * Sets service host. - * - * @return the builder - */ - public B setHost(String host) { - this.host = host; - return self(); - } - - /** - * Sets the service authentication credentials. If no credentials are set, {@link - * GoogleCredentials#getApplicationDefault()} will be used to attempt getting credentials from - * the environment. Use {@link NoCredentials#getInstance()} to skip authentication, this is - * typically useful when using local service emulators. - * - * @param credentials authentication credentials, should not be {@code null} - * @return the builder - * @throws NullPointerException if {@code credentials} is {@code null}. To disable - * authentication use {@link NoCredentials#getInstance()} - */ - public B setCredentials(Credentials credentials) { - this.credentials = checkNotNull(credentials); - // set project id if available - if (this.projectId == null && credentials instanceof ServiceAccountCredentials) { - this.projectId = ((ServiceAccountCredentials) credentials).getProjectId(); - } - - if (this.quotaProjectId == null && credentials instanceof QuotaProjectIdProvider) { - this.quotaProjectId = ((QuotaProjectIdProvider) credentials).getQuotaProjectId(); - } - return self(); - } - - /** - * Sets configuration parameters for request retries. - * - * @return the builder - */ - public B setRetrySettings(RetrySettings retrySettings) { - this.retrySettings = retrySettings; - return self(); - } - - /** - * Sets the factory for rpc services. - * - * @return the builder - */ - public B setServiceRpcFactory(ServiceRpcFactory serviceRpcFactory) { - this.serviceRpcFactory = serviceRpcFactory; - return self(); - } - - /** - * Sets the transport options. - * - * @return the builder - */ - public B setTransportOptions(TransportOptions transportOptions) { - this.transportOptions = transportOptions; - return self(); - } - - /** - * Sets the static header provider. The header provider will be called during client - * construction only once. The headers returned by the provider will be cached and supplied as - * is for each request issued by the constructed client. Some reserved headers can be overridden - * (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying - * transport layer. - * - * @param headerProvider the header provider - * @return the builder - */ - @BetaApi - public B setHeaderProvider(HeaderProvider headerProvider) { - this.headerProvider = headerProvider; - return self(); - } - - @InternalApi - public B setClientLibToken(String clientLibToken) { - Preconditions.checkArgument( - getAllowedClientLibTokens().contains(clientLibToken), "Illegal client lib token"); - this.clientLibToken = clientLibToken; - return self(); - } - - /** - * Sets the quotaProjectId that specifies the project used for quota and billing purposes. - * - * @see See system parameter - * $userProject - */ - public B setQuotaProjectId(String quotaProjectId) { - this.quotaProjectId = quotaProjectId; - return self(); - } - - protected Set getAllowedClientLibTokens() { - return allowedClientLibTokens; - } - } - - @InternalApi("This class should only be extended within google-cloud-java") - protected ServiceOptions( - Class> serviceFactoryClass, - Class> rpcFactoryClass, - Builder builder, - ServiceDefaults serviceDefaults) { - projectId = builder.projectId != null ? builder.projectId : getDefaultProject(); - if (projectIdRequired()) { - checkArgument( - projectId != null, - "A project ID is required for this service but could not be determined from the builder " - + "or the environment. Please set a project ID using the builder."); - } - host = firstNonNull(builder.host, getDefaultHost()); - credentials = builder.credentials != null ? builder.credentials : defaultCredentials(); - retrySettings = firstNonNull(builder.retrySettings, getDefaultRetrySettings()); - serviceFactory = - firstNonNull( - builder.serviceFactory, - getFromServiceLoader(serviceFactoryClass, serviceDefaults.getDefaultServiceFactory())); - serviceFactoryClassName = serviceFactory.getClass().getName(); - serviceRpcFactory = - firstNonNull( - builder.serviceRpcFactory, - getFromServiceLoader(rpcFactoryClass, serviceDefaults.getDefaultRpcFactory())); - serviceRpcFactoryClassName = serviceRpcFactory.getClass().getName(); - clock = firstNonNull(builder.clock, CurrentMillisClock.getDefaultClock()); - transportOptions = - firstNonNull(builder.transportOptions, serviceDefaults.getDefaultTransportOptions()); - headerProvider = firstNonNull(builder.headerProvider, new NoHeaderProvider()); - clientLibToken = builder.clientLibToken; - quotaProjectId = - builder.quotaProjectId != null - ? builder.quotaProjectId - : getValueFromCredentialsFile(getCredentialsPath(), "quota_project_id"); - } - - private static String getCredentialsPath() { - return System.getProperty(CREDENTIAL_ENV_NAME, System.getenv(CREDENTIAL_ENV_NAME)); - } - - /** - * Returns whether a service requires a project ID. This method may be overridden in - * service-specific Options objects. - * - * @return true if a project ID is required to use the service, false if not - */ - protected boolean projectIdRequired() { - return true; - } - - private static GoogleCredentials defaultCredentials() { - try { - return GoogleCredentials.getApplicationDefault(); - } catch (Exception ex) { - return null; - } - } - - protected String getDefaultHost() { - return DEFAULT_HOST; - } - - protected String getDefaultProject() { - return getDefaultProjectId(); - } - - /** - * Returns the default project ID, or {@code null} if no default project ID could be found. This - * method returns the first available project ID among the following sources: - * - *

    - *
  1. The project ID specified by the GOOGLE_CLOUD_PROJECT environment variable - *
  2. The App Engine project ID - *
  3. The project ID specified in the JSON credentials file pointed by the {@code - * GOOGLE_APPLICATION_CREDENTIALS} environment variable - *
  4. The Google Cloud SDK project ID - *
  5. The Compute Engine project ID - *
- */ - public static String getDefaultProjectId() { - String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); - if (projectId == null) { - projectId = - System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); - } - if (projectId == null) { - projectId = getAppEngineProjectId(); - } - if (projectId == null) { - projectId = getServiceAccountProjectId(); - } - return projectId != null ? projectId : getGoogleCloudProjectId(); - } - - public static String getAppEngineAppId() { - return System.getProperty("com.google.appengine.application.id"); - } - - private static String getActiveGoogleCloudConfig(File configDir) { - String activeGoogleCloudConfig = null; - try { - activeGoogleCloudConfig = - Files.asCharSource(new File(configDir, "active_config"), Charset.defaultCharset()) - .readFirstLine(); - } catch (IOException ex) { - // ignore - } - // if reading active_config failed or the file is empty we try default - return firstNonNull(activeGoogleCloudConfig, "default"); - } - - protected static String getGoogleCloudProjectId() { - File configDir; - if (System.getenv().containsKey("CLOUDSDK_CONFIG")) { - configDir = new File(System.getenv("CLOUDSDK_CONFIG")); - } else if (isWindows() && System.getenv().containsKey("APPDATA")) { - configDir = new File(System.getenv("APPDATA"), "gcloud"); - } else { - configDir = new File(System.getProperty("user.home"), ".config/gcloud"); - } - String activeConfig = getActiveGoogleCloudConfig(configDir); - FileReader fileReader = null; - try { - fileReader = new FileReader(new File(configDir, "configurations/config_" + activeConfig)); - } catch (FileNotFoundException newConfigFileNotFoundEx) { - try { - fileReader = new FileReader(new File(configDir, "properties")); - } catch (FileNotFoundException oldConfigFileNotFoundEx) { - // ignore - } - } - if (fileReader != null) { - try (BufferedReader reader = new BufferedReader(fileReader)) { - String line; - String section = null; - Pattern projectPattern = Pattern.compile("^project\\s*=\\s*(.*)$"); - Pattern sectionPattern = Pattern.compile("^\\[(.*)\\]$"); - while ((line = reader.readLine()) != null) { - if (line.isEmpty() || line.startsWith(";")) { - continue; - } - line = line.trim(); - Matcher matcher = sectionPattern.matcher(line); - if (matcher.matches()) { - section = matcher.group(1); - } else if (section == null || section.equals("core")) { - matcher = projectPattern.matcher(line); - if (matcher.matches()) { - return matcher.group(1); - } - } - } - } catch (IOException ex) { - // ignore - } - } - // return project id from metadata config - return MetadataConfig.getProjectId(); - } - - private static boolean isWindows() { - return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"); - } - - protected static String getAppEngineProjectId() { - String projectId = null; - if (PlatformInformation.isOnGAEStandard7()) { - projectId = getAppEngineProjectIdFromAppId(); - } else { - // for GAE flex and standard Java 8 environment - projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); - if (projectId == null) { - projectId = System.getenv("GCLOUD_PROJECT"); - } - if (projectId == null) { - projectId = getAppEngineProjectIdFromAppId(); - } - if (projectId == null) { - try { - projectId = getAppEngineProjectIdFromMetadataServer(); - } catch (IOException ignore) { - projectId = null; - } - } - } - return projectId; - } - - protected static String getAppEngineProjectIdFromAppId() { - String projectId = getAppEngineAppId(); - if (projectId != null && projectId.contains(":")) { - int colonIndex = projectId.indexOf(":"); - projectId = projectId.substring(colonIndex + 1); - } - return projectId; - } - - private static String getAppEngineProjectIdFromMetadataServer() throws IOException { - String metadata = "http://metadata.google.internal"; - String projectIdURL = "/computeMetadata/v1/project/project-id"; - GenericUrl url = new GenericUrl(metadata + projectIdURL); - - HttpTransport netHttpTransport = new NetHttpTransport(); - HttpRequestFactory requestFactory = netHttpTransport.createRequestFactory(); - HttpRequest request = - requestFactory - .buildGetRequest(url) - .setConnectTimeout(500) - .setReadTimeout(500) - .setHeaders(new HttpHeaders().set("Metadata-Flavor", "Google")); - HttpResponse response = request.execute(); - return headerContainsMetadataFlavor(response) ? response.parseAsString() : null; - } - - @InternalApi("Visible for testing") - static boolean headerContainsMetadataFlavor(HttpResponse response) { - String metadataFlavorValue = response.getHeaders().getFirstHeaderStringValue("Metadata-Flavor"); - return "Google".equals(metadataFlavorValue); - } - - protected static String getServiceAccountProjectId() { - return getValueFromCredentialsFile(getCredentialsPath(), "project_id"); - } - - @InternalApi("Visible for testing") - static String getValueFromCredentialsFile(String credentialsPath, String key) { - if (credentialsPath != null) { - try (InputStream credentialsStream = new FileInputStream(credentialsPath)) { - JsonFactory jsonFactory = GsonFactory.getDefaultInstance(); - JsonObjectParser parser = new JsonObjectParser(jsonFactory); - GenericJson fileContents = - parser.parseAndClose(credentialsStream, StandardCharsets.UTF_8, GenericJson.class); - return (String) fileContents.get(key); - } catch (IOException | IllegalArgumentException ex) { - return null; - } - } - return null; - } - - /** - * Returns a Service object for the current service. For instance, when using Google Cloud - * Storage, it returns a Storage object. - */ - @SuppressWarnings("unchecked") - public ServiceT getService() { - if (shouldRefreshService(service)) { - service = serviceFactory.create((OptionsT) this); - } - return service; - } - - /** - * @param cachedService The currently cached service object - * @return true if the currently cached service object should be refreshed. - */ - protected boolean shouldRefreshService(ServiceT cachedService) { - return cachedService == null; - } - - /** - * Returns a Service RPC object for the current service. For instance, when using Google Cloud - * Storage, it returns a StorageRpc object. - */ - @SuppressWarnings("unchecked") - public ServiceRpc getRpc() { - if (shouldRefreshRpc(rpc)) { - rpc = serviceRpcFactory.create((OptionsT) this); - } - return rpc; - } - - /** - * @param cachedRpc The currently cached service object - * @return true if the currently cached service object should be refreshed. - */ - protected boolean shouldRefreshRpc(ServiceRpc cachedRpc) { - return cachedRpc == null; - } - - /** - * Returns the project ID. Return value can be null (for services that don't require a project - * ID). - */ - public String getProjectId() { - return projectId; - } - - /** Returns the service host. */ - public String getHost() { - return host; - } - - /** Returns the authentication credentials. */ - public Credentials getCredentials() { - return credentials; - } - - /** Returns the authentication credentials. If required, credentials are scoped. */ - public Credentials getScopedCredentials() { - Credentials credentialsToReturn = credentials; - if (credentials instanceof GoogleCredentials - && ((GoogleCredentials) credentials).createScopedRequired()) { - credentialsToReturn = ((GoogleCredentials) credentials).createScoped(getScopes()); - } - return credentialsToReturn; - } - - /** Returns configuration parameters for request retries. */ - public RetrySettings getRetrySettings() { - return retrySettings; - } - - /** - * Returns the service's clock. Default time source uses {@link System#currentTimeMillis()} to get - * current time. - */ - public ApiClock getClock() { - return clock; - } - - /** Returns the transport-specific options for this service. */ - public TransportOptions getTransportOptions() { - return transportOptions; - } - - /** - * Returns the application's name as a string in the format {@code gcloud-java/[version]}, - * optionally prepended with externally supplied User-Agent header value (via setting custom - * header provider). - */ - public String getApplicationName() { - String libraryVersion = getLibraryVersion(); - - // We have to do the following since underlying layers often do not appreciate User-Agent - // provided as a normal header and override it or treat setting "application name" as the only - // way to append something to User-Agent header. - StringBuilder sb = new StringBuilder(); - String customUserAgentValue = getUserAgent(); - if (customUserAgentValue != null) { - sb.append(customUserAgentValue).append(' '); - } - if (libraryVersion == null) { - sb.append(getLibraryName()); - } else { - sb.append(getLibraryName()).append('/').append(libraryVersion); - } - - return sb.toString(); - } - - /** Returns the library's name, {@code gcloud-java}, as a string. */ - public static String getLibraryName() { - return "gcloud-java"; - } - - /** Returns the library's name used by x-goog-api-client header as a string. */ - public static String getGoogApiClientLibName() { - return "gccl"; - } - - /** Returns the library's version as a string. */ - public String getLibraryVersion() { - return GaxProperties.getLibraryVersion(this.getClass()); - } - - @InternalApi - public final HeaderProvider getMergedHeaderProvider(HeaderProvider internalHeaderProvider) { - Map mergedHeaders = - ImmutableMap.builder() - .putAll(internalHeaderProvider.getHeaders()) - .putAll(headerProvider.getHeaders()) - .build(); - return FixedHeaderProvider.create(mergedHeaders); - } - - @InternalApi - public final String getUserAgent() { - if (headerProvider != null) { - for (Map.Entry entry : headerProvider.getHeaders().entrySet()) { - if ("user-agent".equals(entry.getKey().toLowerCase())) { - return entry.getValue(); - } - } - } - return null; - } - - protected int baseHashCode() { - return Objects.hash( - projectId, - host, - credentials, - retrySettings, - serviceFactoryClassName, - serviceRpcFactoryClassName, - clock, - quotaProjectId); - } - - protected boolean baseEquals(ServiceOptions other) { - return Objects.equals(projectId, other.projectId) - && Objects.equals(host, other.host) - && Objects.equals(credentials, other.credentials) - && Objects.equals(retrySettings, other.retrySettings) - && Objects.equals(serviceFactoryClassName, other.serviceFactoryClassName) - && Objects.equals(serviceRpcFactoryClassName, other.serviceRpcFactoryClassName) - && Objects.equals(clock, other.clock) - && Objects.equals(quotaProjectId, other.quotaProjectId); - } - - private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException { - input.defaultReadObject(); - serviceFactory = newInstance(serviceFactoryClassName); - serviceRpcFactory = newInstance(serviceRpcFactoryClassName); - } - - @SuppressWarnings("unchecked") - @InternalApi - public static T newInstance(String className) throws IOException, ClassNotFoundException { - try { - return (T) Class.forName(className).newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - throw new IOException(e); - } - } - - public static RetrySettings getDefaultRetrySettings() { - return DEFAULT_RETRY_SETTINGS; - } - - public static RetrySettings getNoRetrySettings() { - return NO_RETRY_SETTINGS; - } - - private static RetrySettings.Builder getDefaultRetrySettingsBuilder() { - return RetrySettings.newBuilder() - .setMaxAttempts(6) - .setInitialRetryDelay(Duration.ofMillis(1000L)) - .setMaxRetryDelay(Duration.ofMillis(32_000L)) - .setRetryDelayMultiplier(2.0) - .setTotalTimeout(Duration.ofMillis(50_000L)) - .setInitialRpcTimeout(Duration.ofMillis(50_000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(50_000L)); - } - - protected abstract Set getScopes(); - - public abstract > B toBuilder(); - - /** - * Some services may have different backoff requirements listed in their SLAs. Be sure to override - * this method in options subclasses when the service's backoff requirement differs from the - * default parameters listed in {@link RetrySettings}. - */ - protected RetrySettings defaultRetrySettings() { - return getDefaultRetrySettings(); - } - - @InternalApi - public static T getFromServiceLoader(Class clazz, T defaultInstance) { - return Iterables.getFirst(ServiceLoader.load(clazz), defaultInstance); - } - - public String getClientLibToken() { - return clientLibToken; - } - - /** Returns the quotaProjectId that specifies the project used for quota and billing purposes. */ - public String getQuotaProjectId() { - return quotaProjectId; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/ServiceRpc.java b/google-cloud-core/src/main/java/com/google/cloud/ServiceRpc.java deleted file mode 100644 index ce4bd18a6a..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/ServiceRpc.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2017 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; - -public interface ServiceRpc {} diff --git a/google-cloud-core/src/main/java/com/google/cloud/StringEnumType.java b/google-cloud-core/src/main/java/com/google/cloud/StringEnumType.java deleted file mode 100644 index 647e53f8e3..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/StringEnumType.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017 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; - -import com.google.api.core.ApiFunction; -import com.google.api.core.InternalApi; -import com.google.common.base.Preconditions; -import java.lang.reflect.Array; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * This represents a concept having a known set of acceptable String values, which can expand later - * due to new API features. - */ -@InternalApi -public class StringEnumType { - - private final Class clazz; - private final ApiFunction constructor; - private final Map knownValues = new LinkedHashMap<>(); - - public StringEnumType(Class clazz, ApiFunction constructor) { - this.clazz = Preconditions.checkNotNull(clazz); - this.constructor = Preconditions.checkNotNull(constructor); - } - - /** Create a new constant and register it in the known values. */ - public EnumT createAndRegister(String constant) { - EnumT instance = constructor.apply(constant); - knownValues.put(constant, instance); - return instance; - } - - /** - * Get the enum object for the given String constant, and throw an exception if the constant is - * not recognized. - */ - public EnumT valueOfStrict(String constant) { - EnumT value = knownValues.get(constant); - if (value != null) { - return value; - } else { - throw new IllegalArgumentException( - "Constant \"" + constant + "\" not found for enum \"" + clazz.getName() + "\""); - } - } - - /** Get the enum object for the given String constant, and allow unrecognized values. */ - public EnumT valueOf(String constant) { - if (constant == null || constant.isEmpty()) { - throw new IllegalArgumentException("Empty enum constants not allowed."); - } - EnumT value = knownValues.get(constant); - if (value != null) { - return value; - } else { - return constructor.apply(constant); - } - } - - /** Return the known values of this enum type. */ - public EnumT[] values() { - Collection valueCollection = knownValues.values(); - - @SuppressWarnings("unchecked") - final EnumT[] valueArray = (EnumT[]) Array.newInstance(clazz, valueCollection.size()); - int i = 0; - for (EnumT enumV : valueCollection) { - valueArray[i] = enumV; - i++; - } - - return valueArray; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/StringEnumValue.java b/google-cloud-core/src/main/java/com/google/cloud/StringEnumValue.java deleted file mode 100644 index 2f1ae94218..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/StringEnumValue.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2017 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; - -import com.google.api.core.InternalApi; -import com.google.common.base.Preconditions; -import java.io.Serializable; - -/** - * This represents a specific instance of a concept having a known set of acceptable String values, - * which can expand later due to new API features. Standard Java enums can't be used in such a - * context. - */ -public abstract class StringEnumValue implements Serializable { - private static final long serialVersionUID = 1501809419544297884L; - private final String constant; - - /** Don't create subclasses outside of google-cloud-java. */ - @InternalApi("This class should only be extended within google-cloud-java") - protected StringEnumValue(String constant) { - this.constant = Preconditions.checkNotNull(constant); - } - - public String name() { - return constant; - } - - @Override - public String toString() { - return constant; - } - - @Override - public boolean equals(Object that) { - if (that == null) { - return false; - } - if (this == that) { - return true; - } - if (!(getClass().equals(that.getClass()))) { - return false; - } - StringEnumValue thatEnumValue = (StringEnumValue) that; - return this.constant.equals(thatEnumValue.constant); - } - - @Override - public int hashCode() { - return constant.hashCode(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java b/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java deleted file mode 100644 index e0308c3836..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright 2017 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; - -import static com.google.common.base.Preconditions.checkArgument; - -import com.google.protobuf.util.Timestamps; -import java.io.Serializable; -import java.util.Date; -import java.util.Objects; -import java.util.concurrent.TimeUnit; -import org.threeten.bp.Instant; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.ZoneOffset; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.format.DateTimeFormatterBuilder; -import org.threeten.bp.format.DateTimeParseException; -import org.threeten.bp.temporal.TemporalAccessor; - -/** - * Represents a timestamp with nanosecond precision. Timestamps cover the range [0001-01-01, - * 9999-12-31]. - * - *

{@code Timestamp} instances are immutable. - */ -public final class Timestamp implements Comparable, Serializable { - - private static final long serialVersionUID = 5152143600571559844L; - - /** The smallest legal timestamp ("0001-01-01T00:00:00Z"). */ - public static final Timestamp MIN_VALUE = new Timestamp(-62135596800L, 0); - - /** The largest legal timestamp ("9999-12-31T23:59:59Z"). */ - public static final Timestamp MAX_VALUE = - new Timestamp(253402300799L, (int) TimeUnit.SECONDS.toNanos(1) - 1); - - private static final DateTimeFormatter format = DateTimeFormatter.ISO_LOCAL_DATE_TIME; - - private static final DateTimeFormatter timestampParser = - new DateTimeFormatterBuilder() - .appendOptional(DateTimeFormatter.ISO_LOCAL_DATE_TIME) - .optionalStart() - .appendOffsetId() - .optionalEnd() - .toFormatter() - .withZone(ZoneOffset.UTC); - - private final long seconds; - private final int nanos; - - private Timestamp(long seconds, int nanos) { - this.seconds = seconds; - this.nanos = nanos; - } - - /** - * Creates an instance representing the value of {@code seconds} and {@code nanos} since January - * 1, 1970, 00:00:00 UTC. - * - * @param seconds seconds since January 1, 1970, 00:00:00 UTC. A negative value is the number of - * seconds before January 1, 1970, 00:00:00 UTC. - * @param nanos the fractional seconds component, in the range 0..999999999. - * @throws IllegalArgumentException if the timestamp is outside the representable range - */ - public static Timestamp ofTimeSecondsAndNanos(long seconds, int nanos) { - checkArgument( - Timestamps.isValid(seconds, nanos), "timestamp out of range: %s, %s", seconds, nanos); - return new Timestamp(seconds, nanos); - } - - /** - * Creates an instance representing the value of {@code microseconds}. - * - * @throws IllegalArgumentException if the timestamp is outside the representable range - */ - public static Timestamp ofTimeMicroseconds(long microseconds) { - long seconds = microseconds / 1_000_000; - int nanos = (int) (microseconds % 1_000_000 * 1000); - if (nanos < 0) { - seconds--; - nanos += 1_000_000_000; - } - checkArgument( - Timestamps.isValid(seconds, nanos), "timestamp out of range: %s, %s", seconds, nanos); - return new Timestamp(seconds, nanos); - } - - /** - * Creates an instance representing the value of {@code Date}. - * - * @throws IllegalArgumentException if the timestamp is outside the representable range - */ - public static Timestamp of(Date date) { - return ofTimeMicroseconds(TimeUnit.MILLISECONDS.toMicros(date.getTime())); - } - - /** Creates an instance with current time. */ - public static Timestamp now() { - java.sql.Timestamp date = new java.sql.Timestamp(System.currentTimeMillis()); - return of(date); - } - - /** - * Creates an instance representing the value of {@code timestamp}. - * - * @throws IllegalArgumentException if the timestamp is outside the representable range - */ - public static Timestamp of(java.sql.Timestamp timestamp) { - int nanos = timestamp.getNanos(); - - // A pre-epoch timestamp can be off by one second because of the way that integer division - // works. For example, -1001 / 1000 == -1. In this case, we want this result to be -2. This - // causes any pre-epoch timestamp to be off by 1 second - fix this by subtracting 1 from the - // seconds value if the seconds value is less than zero and is not divisible by 1000. - // TODO: replace with Math.floorDiv when we drop Java 7 support - long seconds = timestamp.getTime() / 1000; - if (seconds < 0 && timestamp.getTime() % 1000 != 0) { - --seconds; - } - - return Timestamp.ofTimeSecondsAndNanos(seconds, nanos); - } - - /** - * Returns the number of seconds since January 1, 1970, 00:00:00 UTC. A negative value is the - * number of seconds before January 1, 1970, 00:00:00 UTC. - */ - public long getSeconds() { - return seconds; - } - - /** Returns the fractional seconds component, in nanoseconds. */ - public int getNanos() { - return nanos; - } - - /** Returns a JDBC timestamp initialized to the same point in time as {@code this}. */ - public java.sql.Timestamp toSqlTimestamp() { - java.sql.Timestamp ts = new java.sql.Timestamp(seconds * 1000); - ts.setNanos(nanos); - return ts; - } - - /** - * Returns a new {@code java.util.Date} corresponding to this {@code timestamp}. Any - * sub-millisecond precision will be stripped. - * - * @return An approximate {@code java.util.Date} representation of this {@code timestamp}. - */ - public Date toDate() { - long secondsInMilliseconds = TimeUnit.SECONDS.toMillis(this.seconds); - long nanosInMilliseconds = TimeUnit.NANOSECONDS.toMillis(this.nanos); - return new Date(secondsInMilliseconds + nanosInMilliseconds); - } - - @Override - public int compareTo(Timestamp other) { - int r = Long.compare(seconds, other.seconds); - if (r == 0) { - r = Integer.compare(nanos, other.nanos); - } - return r; - } - - /** Creates an instance of Timestamp from {@code com.google.protobuf.Timestamp}. */ - public static Timestamp fromProto(com.google.protobuf.Timestamp proto) { - return new Timestamp(proto.getSeconds(), proto.getNanos()); - } - - /** - * Returns a {@code com.google.protobuf.Timestamp} initialized to the same point in time as {@code - * this}. - */ - public com.google.protobuf.Timestamp toProto() { - return com.google.protobuf.Timestamp.newBuilder().setSeconds(seconds).setNanos(nanos).build(); - } - - /** - * Creates a Timestamp instance from the given string. Input string should be in the RFC 3339 - * format, like '2020-12-01T10:15:30.000Z' or with the timezone offset, such as - * '2020-12-01T10:15:30+01:00'. - * - * @param timestamp string in the RFC 3339 format - * @return created Timestamp - * @throws DateTimeParseException if unable to parse - */ - public static Timestamp parseTimestamp(String timestamp) { - TemporalAccessor temporalAccessor = timestampParser.parse(timestamp); - Instant instant = Instant.from(temporalAccessor); - return ofTimeSecondsAndNanos(instant.getEpochSecond(), instant.getNano()); - } - - private StringBuilder toString(StringBuilder b) { - format.formatTo(LocalDateTime.ofEpochSecond(seconds, 0, ZoneOffset.UTC), b); - if (nanos != 0) { - b.append(String.format(".%09d", nanos)); - } - b.append('Z'); - return b; - } - - @Override - public String toString() { - return toString(new StringBuilder()).toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Timestamp that = (Timestamp) o; - return seconds == that.seconds && nanos == that.nanos; - } - - @Override - public int hashCode() { - return Objects.hash(seconds, nanos); - } - - // TODO(user): Consider adding math operations. -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/TransportOptions.java b/google-cloud-core/src/main/java/com/google/cloud/TransportOptions.java deleted file mode 100644 index e62fdddefc..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/TransportOptions.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2017 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; - -import java.io.Serializable; - -/** An abstraction for transport-specific options, e.g. for http1.1 vs grpc. */ -public interface TransportOptions extends Serializable {} diff --git a/google-cloud-core/src/main/java/com/google/cloud/Tuple.java b/google-cloud-core/src/main/java/com/google/cloud/Tuple.java deleted file mode 100644 index c9d2b9bc25..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/Tuple.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017 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; - -public class Tuple { - - private final X x; - private final Y y; - - private Tuple(X x, Y y) { - this.x = x; - this.y = y; - } - - public static Tuple of(X x, Y y) { - return new Tuple<>(x, y); - } - - public X x() { - return x; - } - - public Y y() { - return y; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/WriteChannel.java b/google-cloud-core/src/main/java/com/google/cloud/WriteChannel.java deleted file mode 100644 index 947909bb66..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/WriteChannel.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2015 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; - -import java.io.Closeable; -import java.nio.channels.WritableByteChannel; - -/** - * A channel for writing data to Google Cloud services. - * - *

Implementations of this class may further buffer data internally to reduce remote calls. - * Written data might not be visible until calling {@link #close()}. This interface implements - * {@link Restorable} to allow saving the writer's state to continue writing afterwards. - */ -public interface WriteChannel extends WritableByteChannel, Closeable, Restorable { - - /** - * Sets the minimum size that will be written by a single RPC. Written data will be buffered and - * only flushed upon reaching this size or closing the channel. - */ - void setChunkSize(int chunkSize); - - /** - * Captures the write channel state so that it can be saved and restored afterwards. The original - * {@code WriteChannel} and the restored one should not both be used. Closing one channel causes - * the other channel to close; subsequent writes will fail. - * - * @return a {@link RestorableState} object that contains the write channel state and can restore - * it afterwards. - */ - @Override - RestorableState capture(); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/package-info.java b/google-cloud-core/src/main/java/com/google/cloud/package-info.java deleted file mode 100644 index 56d9be78d6..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2016 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. - */ - -/** Core classes for the {@code google-cloud} library. */ -package com.google.cloud; diff --git a/google-cloud-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java b/google-cloud-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java deleted file mode 100644 index bd27986e1d..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/spi/ServiceRpcFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2015 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.spi; - -import com.google.cloud.ServiceOptions; -import com.google.cloud.ServiceRpc; - -/** - * A base interface for all service RPC factories. Implementation must provide a public no-arg - * constructor. Loading of a factory implementation is done via {@link java.util.ServiceLoader}. - */ -@SuppressWarnings("rawtypes") -public interface ServiceRpcFactory { - - ServiceRpc create(OptionsT options); -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java b/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java deleted file mode 100644 index 9679c6299c..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import com.google.api.core.CurrentMillisClock; -import com.google.api.core.InternalApi; -import com.google.cloud.ExceptionHandler; -import com.google.cloud.RetryHelper; -import com.google.cloud.ServiceOptions; -import com.google.common.io.CharStreams; -import com.google.common.util.concurrent.SettableFuture; -import com.google.common.util.concurrent.UncheckedExecutionException; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.math.BigInteger; -import java.net.HttpURLConnection; -import java.net.ServerSocket; -import java.net.URL; -import java.net.URLConnection; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; -import java.nio.file.Files; -import java.nio.file.Path; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import org.threeten.bp.Duration; - -/** Utility class to start and stop a local service which is used by unit testing. */ -@InternalApi -public abstract class BaseEmulatorHelper { - - private final String emulator; - private final int port; - private final String projectId; - private EmulatorRunner activeRunner; - private BlockingProcessStreamReader blockingProcessReader; - - protected static final String PROJECT_ID_PREFIX = "test-project-"; - protected static final String DEFAULT_HOST = "localhost"; - protected static final int DEFAULT_PORT = 8080; - - @InternalApi("This class should only be extended within google-cloud-java") - protected BaseEmulatorHelper(String emulator, int port, String projectId) { - this.emulator = emulator; - this.port = port > 0 ? port : DEFAULT_PORT; - this.projectId = projectId; - } - - /** - * Returns the emulator runners supported by this emulator. Runners are evaluated in order, the - * first available runner is selected and executed - */ - protected abstract List getEmulatorRunners(); - - /** Returns a logger. */ - protected abstract Logger getLogger(); - - /** - * Starts the local service as a subprocess. Blocks the execution until {@code blockUntilOutput} - * is found on stdout. - */ - protected final void startProcess(String blockUntilOutput) - throws IOException, InterruptedException { - for (EmulatorRunner runner : getEmulatorRunners()) { - // Iterate through all emulator runners until find first available runner. - if (runner.isAvailable()) { - activeRunner = runner; - runner.start(); - break; - } - } - if (activeRunner != null) { - blockingProcessReader = - BlockingProcessStreamReader.start( - emulator, activeRunner.getProcess().getInputStream(), blockUntilOutput, getLogger()); - } else { - // No available runner found. - throw new IOException("No available emulator runner is found."); - } - } - - /** - * Waits for the local service's subprocess to terminate, and stop any possible thread listening - * for its output. - */ - protected final int waitForProcess(Duration timeout) - throws IOException, InterruptedException, TimeoutException { - if (activeRunner != null) { - int exitCode = activeRunner.waitFor(timeout); - activeRunner = null; - return exitCode; - } - if (blockingProcessReader != null) { - blockingProcessReader.join(); - blockingProcessReader = null; - } - return 0; - } - - private static int waitForProcess(final Process process, Duration timeout) - throws InterruptedException, TimeoutException { - if (process == null) { - return 0; - } - - final SettableFuture exitValue = SettableFuture.create(); - - Thread waiter = - new Thread( - new Runnable() { - @Override - public void run() { - try { - exitValue.set(process.waitFor()); - } catch (InterruptedException e) { - exitValue.setException(e); - } - } - }); - waiter.start(); - - try { - return exitValue.get(timeout.toMillis(), TimeUnit.MILLISECONDS); - } catch (ExecutionException e) { - if (e.getCause() instanceof InterruptedException) { - throw (InterruptedException) e.getCause(); - } - throw new UncheckedExecutionException(e); - } finally { - waiter.interrupt(); - } - } - - /** Returns the port to which the local emulator is listening. */ - public int getPort() { - return port; - } - - /** Returns the project ID associated with the local emulator. */ - public String getProjectId() { - return projectId; - } - - /** Returns service options to access the local emulator. */ - public abstract T getOptions(); - - /** Starts the local emulator. */ - public abstract void start() throws IOException, InterruptedException; - - /** Stops the local emulator. */ - public abstract void stop(Duration timeout) - throws IOException, InterruptedException, TimeoutException; - - /** Resets the internal state of the emulator. */ - public abstract void reset() throws IOException; - - protected final String sendPostRequest(String request) throws IOException { - URL url = new URL("http", DEFAULT_HOST, this.port, request); - HttpURLConnection con = (HttpURLConnection) url.openConnection(); - con.setRequestMethod("POST"); - con.setDoOutput(true); - OutputStream out = con.getOutputStream(); - out.write("".getBytes()); - out.flush(); - - InputStream in = con.getInputStream(); - String response = CharStreams.toString(new InputStreamReader(con.getInputStream())); - in.close(); - return response; - } - - protected static int findAvailablePort(int defaultPort) { - try (ServerSocket tempSocket = new ServerSocket(0)) { - return tempSocket.getLocalPort(); - } catch (IOException e) { - return defaultPort; - } - } - - protected static boolean isWindows() { - return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"); - } - - /** Utility interface to start and run an emulator. */ - protected interface EmulatorRunner { - - /** - * Returns {@code true} if the emulator associated to this runner is available and can be - * started. - */ - boolean isAvailable(); - - /** Starts the emulator associated to this runner. */ - void start() throws IOException; - - /** Wait for the emulator associated to this runner to terminate, returning the exit status. */ - int waitFor(Duration timeout) throws InterruptedException, TimeoutException; - - /** Returns the process associated to the emulator, if any. */ - Process getProcess(); - } - - /** Utility class to start and run an emulator from the Google Cloud SDK. */ - protected static class GcloudEmulatorRunner implements EmulatorRunner { - - private final List commandText; - private final String versionPrefix; - private final Version minVersion; - private Process process; - private static final Logger log = Logger.getLogger(GcloudEmulatorRunner.class.getName()); - - public GcloudEmulatorRunner(List commandText, String versionPrefix, String minVersion) { - this.commandText = commandText; - this.versionPrefix = versionPrefix; - this.minVersion = Version.fromString(minVersion); - } - - @Override - public boolean isAvailable() { - try { - return isGcloudInstalled() && isEmulatorUpToDate() && !commandText.isEmpty(); - } catch (IOException | InterruptedException e) { - e.printStackTrace(System.err); - } - return false; - } - - @Override - public void start() throws IOException { - log.fine("Starting emulator via Google Cloud SDK"); - process = CommandWrapper.create().setCommand(commandText).setRedirectErrorStream().start(); - } - - @Override - public int waitFor(Duration timeout) throws InterruptedException, TimeoutException { - return waitForProcess(process, timeout); - } - - @Override - public Process getProcess() { - return process; - } - - private boolean isGcloudInstalled() { - String path = System.getenv("PATH"); - return path != null && path.contains("google-cloud-sdk"); - } - - private boolean isEmulatorUpToDate() throws IOException, InterruptedException { - Version currentVersion = getInstalledEmulatorVersion(versionPrefix); - return currentVersion != null && currentVersion.compareTo(minVersion) >= 0; - } - - private Version getInstalledEmulatorVersion(String versionPrefix) - throws IOException, InterruptedException { - Process process = - CommandWrapper.create() - .setCommand(Arrays.asList("gcloud", "version")) - // gcloud redirects all output to stderr while emulators' executables use either - // stdout or stderr with no apparent convention. To be able to properly intercept and - // block waiting for emulators to be ready we redirect everything to stdout - .setRedirectErrorStream() - .start(); - process.waitFor(); - try (BufferedReader reader = - new BufferedReader(new InputStreamReader(process.getInputStream()))) { - for (String line = reader.readLine(); line != null; line = reader.readLine()) { - if (line.startsWith(versionPrefix)) { - String[] lineComponents = line.split(" "); - if (lineComponents.length > 1) { - return Version.fromString(lineComponents[1]); - } - } - } - return null; - } - } - } - - /** Utility class to start and run an emulator from a download URL. */ - protected static class DownloadableEmulatorRunner implements EmulatorRunner { - - private final List commandText; - private final String md5CheckSum; - private final URL downloadUrl; - private final String fileName; - private String accessToken; - private Process process; - private static final Logger log = Logger.getLogger(DownloadableEmulatorRunner.class.getName()); - - public DownloadableEmulatorRunner( - List commandText, URL downloadUrl, String md5CheckSum) { - this.commandText = commandText; - this.md5CheckSum = md5CheckSum; - this.downloadUrl = downloadUrl; - String[] splitUrl = downloadUrl.toString().split("/"); - this.fileName = splitUrl[splitUrl.length - 1]; - } - - public DownloadableEmulatorRunner( - List commandText, URL downloadUrl, String md5CheckSum, String accessToken) { - this(commandText, downloadUrl, md5CheckSum); - this.accessToken = accessToken; - } - - @Override - public boolean isAvailable() { - try { - downloadZipFile(); - return true; - } catch (IOException e) { - return false; - } - } - - @Override - public void start() throws IOException { - ExceptionHandler retryOnAnythingExceptionHandler = - ExceptionHandler.newBuilder().retryOn(Exception.class).build(); - - Path emulatorPath = - RetryHelper.runWithRetries( - new Callable() { - @Override - public Path call() throws IOException { - return downloadEmulator(); - } - }, - ServiceOptions.getDefaultRetrySettings(), - retryOnAnythingExceptionHandler, - CurrentMillisClock.getDefaultClock()); - process = - CommandWrapper.create() - .setCommand(commandText) - .setDirectory(emulatorPath) - // gcloud redirects all output to stderr while emulators' executables use either - // stdout - // or stderr with no apparent convention. To be able to properly intercept and block - // waiting for emulators to be ready we redirect everything to stdout - .setRedirectErrorStream() - .start(); - } - - @Override - public int waitFor(Duration timeout) throws InterruptedException, TimeoutException { - return waitForProcess(process, timeout); - } - - @Override - public Process getProcess() { - return process; - } - - private Path downloadEmulator() throws IOException { - // Retrieve the file name from the download link - String[] splittedUrl = downloadUrl.toString().split("/"); - String fileName = splittedUrl[splittedUrl.length - 1]; - - // Each run is associated with its own folder that is deleted once test completes. - Path emulatorPath = Files.createTempDirectory(fileName.split("\\.")[0]); - File emulatorFolder = emulatorPath.toFile(); - emulatorFolder.deleteOnExit(); - - File zipFile = downloadZipFile(); - // Unzip the emulator - try (ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFile))) { - if (log.isLoggable(Level.FINE)) { - log.fine("Unzipping emulator"); - } - ZipEntry entry = zipIn.getNextEntry(); - while (entry != null) { - File filePath = new File(emulatorFolder, entry.getName()); - String canonicalEmulatorFolderPath = emulatorFolder.getCanonicalPath(); - String canonicalFilePath = filePath.getCanonicalPath(); - if (!canonicalFilePath.startsWith(canonicalEmulatorFolderPath + File.separator)) { - throw new IllegalStateException( - "Entry is outside of the target dir: " + entry.getName()); - } - if (!entry.isDirectory()) { - extractFile(zipIn, filePath); - } else { - filePath.mkdir(); - } - zipIn.closeEntry(); - entry = zipIn.getNextEntry(); - } - } - return emulatorPath; - } - - private File downloadZipFile() throws IOException { - // Check if we already have a local copy of the emulator and download it if not. - File zipFile = new File(System.getProperty("java.io.tmpdir"), fileName); - if (!zipFile.exists() || (md5CheckSum != null && !md5CheckSum.equals(md5(zipFile)))) { - if (log.isLoggable(Level.FINE)) { - log.fine("Fetching emulator"); - } - URLConnection urlConnection = downloadUrl.openConnection(); - if (accessToken != null) { - urlConnection.setRequestProperty("Authorization", "Bearer " + accessToken); - } - ReadableByteChannel rbc = Channels.newChannel(urlConnection.getInputStream()); - try (FileOutputStream fos = new FileOutputStream(zipFile)) { - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - } - } else { - if (log.isLoggable(Level.FINE)) { - log.fine("Using cached emulator"); - } - } - return zipFile; - } - - private void extractFile(ZipInputStream zipIn, File filePath) throws IOException { - try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath))) { - byte[] bytesIn = new byte[1024]; - int read; - while ((read = zipIn.read(bytesIn)) != -1) { - bos.write(bytesIn, 0, read); - } - } - } - - private static String md5(File zipFile) throws IOException { - try { - MessageDigest md5 = MessageDigest.getInstance("MD5"); - try (InputStream is = new BufferedInputStream(new FileInputStream(zipFile))) { - byte[] bytes = new byte[4 * 1024 * 1024]; - int len; - while ((len = is.read(bytes)) >= 0) { - md5.update(bytes, 0, len); - } - } - return String.format("%032x", new BigInteger(1, md5.digest())); - } catch (NoSuchAlgorithmException e) { - throw new IOException(e); - } - } - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java b/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java deleted file mode 100644 index 90fbb764d5..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import static com.google.common.base.MoreObjects.firstNonNull; - -import com.google.common.base.Strings; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * This class allows to read a process output stream, block until a provided string appears on the - * stream and redirect pertinent error logs to a provided logger. - */ -class BlockingProcessStreamReader extends Thread { - - private static final int LOG_LENGTH_LIMIT = 50000; - - private final BufferedReader errorReader; - private final Logger logger; - private StringBuilder currentLog; - private Level currentLogLevel; - private boolean collectionMode; - private final String emulatorTag; - private final Pattern logLinePattern; - - private BlockingProcessStreamReader( - String emulator, InputStream stream, String blockUntil, Logger logger) throws IOException { - super("blocking-process-stream-reader"); - setDaemon(true); - errorReader = new BufferedReader(new InputStreamReader(stream)); - this.logger = logger; - this.emulatorTag = "[" + emulator + "]"; - this.logLinePattern = Pattern.compile("(\\[" + emulator + "\\]\\s)?(\\w+):.*"); - if (!Strings.isNullOrEmpty(blockUntil)) { - String line; - do { - line = errorReader.readLine(); - } while (line != null && !line.contains(blockUntil)); - } - } - - @Override - public void run() { - String previousLine = ""; - String nextLine = ""; - try { - for (; ; ) { - previousLine = nextLine; - nextLine = errorReader.readLine(); - if (nextLine == null) { - break; - } - processLogLine(previousLine, nextLine); - } - } catch (IOException e) { - e.printStackTrace(System.err); - } - processLogLine(previousLine, firstNonNull(nextLine, "")); - writeLog(); - } - - private void processLogLine(String previousLine, String nextLine) { - // Each log is two lines with the following format: - // [Emulator]? [Date] [Time] [LoggingClass] [method] - // [Emulator]? [LEVEL]: error message - // [Emulator]? more data - // Exceptions and stack traces are included in error stream, separated by a newline - Level nextLogLevel = getLevel(nextLine); - if (nextLogLevel != null) { - writeLog(); - currentLog = new StringBuilder(); - currentLogLevel = nextLogLevel; - collectionMode = true; - } else if (collectionMode) { - if (currentLog.length() > LOG_LENGTH_LIMIT) { - collectionMode = false; - } else if (currentLog.length() == 0) { - // strip level out of the line - currentLog.append(emulatorTag); - currentLog.append(previousLine.split(":", 2)[1]); - currentLog.append(System.getProperty("line.separator")); - } else { - if (!previousLine.startsWith(emulatorTag)) { - currentLog.append(emulatorTag); - currentLog.append(' '); - } - currentLog.append(previousLine); - currentLog.append(System.getProperty("line.separator")); - } - } - } - - private void writeLog() { - if (currentLogLevel != null && currentLog != null && currentLog.length() != 0) { - logger.log(currentLogLevel, currentLog.toString().trim()); - } - } - - private Level getLevel(String line) { - try { - Matcher matcher = logLinePattern.matcher(line); - if (matcher.matches()) { - return Level.parse(matcher.group(2)); - } else { - return null; - } - } catch (IllegalArgumentException e) { - return null; // level wasn't supplied in this log line - } - } - - static BlockingProcessStreamReader start( - String emulator, InputStream stream, String blockUntil, Logger logger) throws IOException { - BlockingProcessStreamReader thread = - new BlockingProcessStreamReader(emulator, stream, blockUntil, logger); - thread.start(); - return thread; - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/CommandWrapper.java b/google-cloud-core/src/main/java/com/google/cloud/testing/CommandWrapper.java deleted file mode 100644 index 79f70150a5..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/CommandWrapper.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -/** Utility class that executes system commands on both Windows and Unix. */ -class CommandWrapper { - - private final List prefix; - private List command; - private String nullFilename; - private boolean redirectOutputToNull; - private boolean redirectErrorStream; - private boolean redirectErrorInherit; - private Path directory; - - private CommandWrapper() { - this.prefix = new ArrayList<>(); - if (BaseEmulatorHelper.isWindows()) { - this.prefix.add("cmd"); - this.prefix.add("/C"); - this.nullFilename = "NUL:"; - } else { - this.prefix.add("bash"); - this.nullFilename = "/dev/null"; - } - } - - CommandWrapper setCommand(List command) { - this.command = new ArrayList<>(command.size() + this.prefix.size()); - this.command.addAll(prefix); - this.command.addAll(command); - return this; - } - - CommandWrapper setRedirectOutputToNull() { - this.redirectOutputToNull = true; - return this; - } - - CommandWrapper setRedirectErrorStream() { - this.redirectErrorStream = true; - return this; - } - - CommandWrapper setRedirectErrorInherit() { - this.redirectErrorInherit = true; - return this; - } - - CommandWrapper setDirectory(Path directory) { - this.directory = directory; - return this; - } - - ProcessBuilder getBuilder() { - ProcessBuilder builder = new ProcessBuilder(command); - if (redirectOutputToNull) { - builder.redirectOutput(new File(nullFilename)); - } - if (directory != null) { - builder.directory(directory.toFile()); - } - if (redirectErrorStream) { - builder.redirectErrorStream(true); - } - if (redirectErrorInherit) { - builder.redirectError(ProcessBuilder.Redirect.INHERIT); - } - return builder; - } - - public Process start() throws IOException { - return getBuilder().start(); - } - - static CommandWrapper create() { - return new CommandWrapper(); - } -} diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/Version.java b/google-cloud-core/src/main/java/com/google/cloud/testing/Version.java deleted file mode 100644 index dfdc076fdf..0000000000 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/Version.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** Simplified wrapper for emulator's versions. */ -class Version implements Comparable { - - private static final Pattern VERSION_PATTERN = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+)$"); - - private final int major; - private final int minor; - private final int patch; - - private Version(int major, int minor, int patch) { - this.major = major; - this.minor = minor; - this.patch = patch; - } - - @Override - public int compareTo(Version version) { - int result = major - version.major; - if (result == 0) { - result = minor - version.minor; - if (result == 0) { - result = patch - version.patch; - } - } - return result; - } - - @Override - public String toString() { - return String.format("%d.%d.%d", major, minor, patch); - } - - @Override - public boolean equals(Object other) { - return this == other || other instanceof Version && compareTo((Version) other) == 0; - } - - @Override - public int hashCode() { - return Objects.hash(major, minor, patch); - } - - int getMajor() { - return major; - } - - int getMinor() { - return minor; - } - - int getPatch() { - return patch; - } - - static Version fromString(String version) { - Matcher matcher = VERSION_PATTERN.matcher(checkNotNull(version)); - if (matcher.matches()) { - return new Version( - Integer.valueOf(matcher.group(1)), - Integer.valueOf(matcher.group(2)), - Integer.valueOf(matcher.group(3))); - } - throw new IllegalArgumentException("Invalid version format"); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/AsyncPageImplTest.java b/google-cloud-core/src/test/java/com/google/cloud/AsyncPageImplTest.java deleted file mode 100644 index 241793b3be..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/AsyncPageImplTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; - -import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; -import com.google.api.gax.paging.AsyncPage; -import com.google.common.collect.ImmutableList; -import java.util.concurrent.ExecutionException; -import org.junit.Test; - -public class AsyncPageImplTest { - - private static final ImmutableList VALUES1 = ImmutableList.of("1", "2"); - private static final ImmutableList VALUES2 = ImmutableList.of("3", "4"); - private static final ImmutableList VALUES3 = ImmutableList.of("5", "6"); - private static final ImmutableList ALL_VALUES = - ImmutableList.builder().addAll(VALUES1).addAll(VALUES2).addAll(VALUES3).build(); - private static final ImmutableList SOME_VALUES = - ImmutableList.builder().addAll(VALUES2).addAll(VALUES3).build(); - - private static class TestPageFetcher implements AsyncPageImpl.NextPageFetcher { - private static final long serialVersionUID = 4703765400378593176L; - - private final AsyncPageImpl nextResult; - - TestPageFetcher(AsyncPageImpl nextResult) { - this.nextResult = nextResult; - } - - @Override - public ApiFuture> getNextPage() { - return ApiFutures.>immediateFuture(nextResult); - } - } - - @Test - public void testPage() { - final AsyncPageImpl nextResult = new AsyncPageImpl<>(null, "c", VALUES2); - AsyncPageImpl.NextPageFetcher fetcher = new TestPageFetcher(nextResult); - AsyncPageImpl result = new AsyncPageImpl<>(fetcher, "c", VALUES1); - assertEquals(nextResult, result.getNextPage()); - assertEquals("c", result.getNextPageToken()); - assertEquals(VALUES1, result.getValues()); - } - - @Test - public void testPageAsync() throws ExecutionException, InterruptedException { - final AsyncPageImpl nextResult = new AsyncPageImpl<>(null, "c", VALUES2); - AsyncPageImpl.NextPageFetcher fetcher = new TestPageFetcher(nextResult); - AsyncPageImpl result = new AsyncPageImpl<>(fetcher, "c", VALUES1); - assertEquals(nextResult, result.getNextPageAsync().get()); - assertEquals("c", result.getNextPageToken()); - assertEquals(VALUES1, result.getValues()); - } - - @Test - public void testIterateAll() { - final AsyncPageImpl nextResult2 = new AsyncPageImpl<>(null, "c3", VALUES3); - AsyncPageImpl.NextPageFetcher fetcher2 = new TestPageFetcher(nextResult2); - final AsyncPageImpl nextResult1 = new AsyncPageImpl<>(fetcher2, "c2", VALUES2); - AsyncPageImpl.NextPageFetcher fetcher1 = new TestPageFetcher(nextResult1); - AsyncPageImpl result = new AsyncPageImpl<>(fetcher1, "c1", VALUES1); - assertEquals(ALL_VALUES, ImmutableList.copyOf(result.iterateAll())); - } - - @Test - public void testAsyncPageAndIterateAll() throws ExecutionException, InterruptedException { - final AsyncPageImpl nextResult2 = new AsyncPageImpl<>(null, "c3", VALUES3); - AsyncPageImpl.NextPageFetcher fetcher2 = new TestPageFetcher(nextResult2); - final AsyncPageImpl nextResult1 = new AsyncPageImpl<>(fetcher2, "c2", VALUES2); - AsyncPageImpl.NextPageFetcher fetcher1 = new TestPageFetcher(nextResult1); - AsyncPageImpl result = new AsyncPageImpl<>(fetcher1, "c1", VALUES1); - assertEquals(nextResult1, result.getNextPageAsync().get()); - assertEquals("c1", result.getNextPageToken()); - assertEquals(VALUES1, result.getValues()); - assertEquals(SOME_VALUES, ImmutableList.copyOf(result.getNextPageAsync().get().iterateAll())); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/BaseSerializationTest.java b/google-cloud-core/src/test/java/com/google/cloud/BaseSerializationTest.java deleted file mode 100644 index 5dcd1726bb..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/BaseSerializationTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.base.MoreObjects.firstNonNull; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import org.junit.Test; - -/** - * Base class for serialization tests. To use this class in your tests override the {@code - * serializableObjects()} method to return all objects that must be serializable. Also override - * {@code restorableObjects()} method to return all restorable objects whose state must be tested - * for proper serialization. Both methods can return {@code null} if no such object needs to be - * tested. - */ -public abstract class BaseSerializationTest { - - /** Returns all objects for which correct serialization must be tested. */ - protected abstract Serializable[] serializableObjects(); - - /** Returns all restorable objects whose state must be tested for proper serialization. */ - protected abstract Restorable[] restorableObjects(); - - @Test - public void testSerializableObjects() throws Exception { - for (Serializable obj : firstNonNull(serializableObjects(), new Serializable[0])) { - Object copy = serializeAndDeserialize(obj); - assertEquals(obj, obj); - assertEquals(obj, copy); - assertEquals(obj.hashCode(), copy.hashCode()); - assertEquals(obj.toString(), copy.toString()); - assertNotSame(obj, copy); - assertEquals(copy, copy); - } - } - - @Test - public void testRestorableObjects() throws Exception { - for (Restorable restorable : firstNonNull(restorableObjects(), new Restorable[0])) { - RestorableState state = restorable.capture(); - RestorableState deserializedState = serializeAndDeserialize(state); - assertEquals(state, deserializedState); - assertEquals(state.hashCode(), deserializedState.hashCode()); - assertEquals(state.toString(), deserializedState.toString()); - } - } - - @SuppressWarnings("unchecked") - public T serializeAndDeserialize(T obj) throws IOException, ClassNotFoundException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - try (ObjectOutputStream output = new ObjectOutputStream(bytes)) { - output.writeObject(obj); - } - try (ObjectInputStream input = - new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) { - return (T) input.readObject(); - } - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java b/google-cloud-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java deleted file mode 100644 index 4bc5993f7f..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/BaseServiceExceptionTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2015 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; - -import static com.google.cloud.BaseServiceException.UNKNOWN_CODE; -import static com.google.common.truth.Truth.assertThat; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import com.google.cloud.BaseServiceException.ExceptionData; -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import org.junit.Test; - -/** Tests for {@link BaseServiceException}. */ -public class BaseServiceExceptionTest { - - private static final int CODE = 1; - private static final int CODE_NO_REASON = 2; - private static final String MESSAGE = "some message"; - private static final String REASON = "some reason"; - private static final boolean NOT_RETRYABLE = false; - private static final boolean RETRYABLE = true; - private static final boolean IDEMPOTENT = true; - private static final String DEBUG_INFO = "debugInfo"; - private static final String LOCATION = "location"; - - private static class CustomServiceException extends BaseServiceException { - - private static final long serialVersionUID = -195251309124875103L; - - public CustomServiceException(int code, String message, String reason, boolean idempotent) { - super( - ExceptionData.from( - code, - message, - reason, - BaseServiceException.isRetryable(code, reason, idempotent, RETRYABLE_ERRORS))); - } - - private static final Set RETRYABLE_ERRORS = - ImmutableSet.of( - new Error(CODE, REASON), new Error(null, REASON), new Error(CODE_NO_REASON, null)); - } - - @Test - public void testBaseServiceException() { - BaseServiceException serviceException = - new BaseServiceException(ExceptionData.from(CODE, MESSAGE, REASON, NOT_RETRYABLE)); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertFalse(serviceException.isRetryable()); - assertNull(serviceException.getCause()); - - Exception cause = new RuntimeException(); - serviceException = - new BaseServiceException(ExceptionData.from(CODE, MESSAGE, REASON, NOT_RETRYABLE, cause)); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertFalse(serviceException.isRetryable()); - assertEquals(cause, serviceException.getCause()); - - serviceException = - new BaseServiceException( - ExceptionData.newBuilder() - .setMessage(MESSAGE) - .setCause(cause) - .setCode(CODE) - .setReason(REASON) - .setRetryable(RETRYABLE) - .setDebugInfo(DEBUG_INFO) - .setLocation(LOCATION) - .build()); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertTrue(serviceException.isRetryable()); - assertEquals(cause, serviceException.getCause()); - assertEquals(DEBUG_INFO, serviceException.getDebugInfo()); - assertEquals(LOCATION, serviceException.getLocation()); - - serviceException = new CustomServiceException(CODE, MESSAGE, REASON, IDEMPOTENT); - assertEquals(CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertTrue(serviceException.isRetryable()); - - serviceException = new CustomServiceException(CODE_NO_REASON, MESSAGE, null, IDEMPOTENT); - assertEquals(CODE_NO_REASON, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertNull(serviceException.getReason()); - assertTrue(serviceException.isRetryable()); - - serviceException = new CustomServiceException(UNKNOWN_CODE, MESSAGE, REASON, IDEMPOTENT); - assertEquals(UNKNOWN_CODE, serviceException.getCode()); - assertEquals(MESSAGE, serviceException.getMessage()); - assertEquals(REASON, serviceException.getReason()); - assertTrue(serviceException.isRetryable()); - } - - @Test - public void testTranslateAndThrow() throws Exception { - BaseServiceException cause = - new BaseServiceException(ExceptionData.from(CODE, MESSAGE, REASON, NOT_RETRYABLE)); - RetryHelper.RetryHelperException exceptionMock = - createMock(RetryHelper.RetryHelperException.class); - expect(exceptionMock.getCause()).andReturn(cause).times(2); - replay(exceptionMock); - try { - BaseServiceException.translate(exceptionMock); - } catch (BaseServiceException ex) { - assertEquals(CODE, ex.getCode()); - assertEquals(MESSAGE, ex.getMessage()); - assertFalse(ex.isRetryable()); - } finally { - verify(exceptionMock); - } - } - - @Test - @SuppressWarnings("TruthSelfEquals") - public void testError_Equal() { - BaseServiceException.Error error = new BaseServiceException.Error(0, "reason", true); - assertThat(error).isEqualTo(error); - assertThat(error.hashCode()).isEqualTo(error.hashCode()); - - BaseServiceException.Error sameError = new BaseServiceException.Error(0, "reason", true); - assertThat(error).isEqualTo(sameError); - assertThat(error.hashCode()).isEqualTo(sameError.hashCode()); - - BaseServiceException.Error error2 = new BaseServiceException.Error(1, "other reason", false); - assertThat(error).isNotEqualTo(error2); - assertThat(error.hashCode()).isNotEqualTo(error2.hashCode()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java b/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java deleted file mode 100644 index 65743a347a..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2015 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; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertFalse; -import static junit.framework.TestCase.assertTrue; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import com.google.cloud.spi.ServiceRpcFactory; -import java.io.IOException; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.nio.channels.ClosedChannelException; -import java.util.Arrays; -import java.util.Random; -import org.junit.Before; -import org.junit.Test; - -public class BaseWriteChannelTest { - - private abstract static class CustomService implements Service {} - - private abstract static class CustomServiceOptions - extends ServiceOptions { - - private static final long serialVersionUID = 3302358029307467197L; - - protected CustomServiceOptions( - Class> serviceFactoryClass, - Class> rpcFactoryClass, - Builder builder) { - super(serviceFactoryClass, rpcFactoryClass, builder, null); - } - } - - private static final Serializable ENTITY = 42L; - private static final String UPLOAD_ID = "uploadId"; - private static final byte[] CONTENT = {0xD, 0xE, 0xA, 0xD}; - private static final int MIN_CHUNK_SIZE = 256 * 1024; // 256 KiB - private static final int DEFAULT_CHUNK_SIZE = 60 * MIN_CHUNK_SIZE; // 15MiB - private static final Random RANDOM = new Random(); - private static BaseWriteChannel channel; - - @Before - public void setUp() { - channel = - new BaseWriteChannel(null, ENTITY, UPLOAD_ID) { - @Override - public RestorableState capture() { - return null; - } - - @Override - protected void flushBuffer(int length, boolean last) {} - - @Override - protected BaseState.Builder stateBuilder() { - return null; - } - }; - } - - @Test - public void testConstructor() { - assertEquals(null, channel.getOptions()); - assertEquals(ENTITY, channel.getEntity()); - assertEquals(0, channel.getPosition()); - assertEquals(UPLOAD_ID, channel.getUploadId()); - assertEquals(0, channel.getLimit()); - assertTrue(channel.isOpen()); - assertArrayEquals(new byte[0], channel.getBuffer()); - assertEquals(DEFAULT_CHUNK_SIZE, channel.getChunkSize()); - } - - @Test - public void testClose() throws IOException { - channel.close(); - assertFalse(channel.isOpen()); - assertNull(channel.getBuffer()); - } - - @Test(expected = ClosedChannelException.class) - public void testValidateOpen() throws IOException { - channel.close(); - channel.write(ByteBuffer.allocate(42)); - } - - @Test - public void testChunkSize() { - channel.setChunkSize(42); - assertThat(channel.getChunkSize() >= MIN_CHUNK_SIZE).isTrue(); - assertThat(channel.getChunkSize() % MIN_CHUNK_SIZE).isEqualTo(0); - - channel.setChunkSize(2 * MIN_CHUNK_SIZE); - assertThat(channel.getChunkSize() >= MIN_CHUNK_SIZE).isTrue(); - assertThat(channel.getChunkSize() % MIN_CHUNK_SIZE).isEqualTo(0); - - channel.setChunkSize(2 * MIN_CHUNK_SIZE + 1); - assertThat(channel.getChunkSize() >= MIN_CHUNK_SIZE).isTrue(); - assertThat(channel.getChunkSize() % MIN_CHUNK_SIZE).isEqualTo(0); - } - - @Test - public void testWrite() throws IOException { - channel.write(ByteBuffer.wrap(CONTENT)); - assertEquals(CONTENT.length, channel.getLimit()); - assertEquals(DEFAULT_CHUNK_SIZE, channel.getBuffer().length); - assertArrayEquals(Arrays.copyOf(CONTENT, DEFAULT_CHUNK_SIZE), channel.getBuffer()); - } - - @Test - public void testWriteAndFlush() throws IOException { - ByteBuffer content = randomBuffer(DEFAULT_CHUNK_SIZE + 1); - channel.write(content); - assertEquals(DEFAULT_CHUNK_SIZE, channel.getPosition()); - assertEquals(1, channel.getLimit()); - byte[] newContent = new byte[DEFAULT_CHUNK_SIZE]; - newContent[0] = content.get(DEFAULT_CHUNK_SIZE); - assertArrayEquals(newContent, channel.getBuffer()); - } - - private static ByteBuffer randomBuffer(int size) { - byte[] byteArray = new byte[size]; - RANDOM.nextBytes(byteArray); - return ByteBuffer.wrap(byteArray); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/BatchResultTest.java b/google-cloud-core/src/test/java/com/google/cloud/BatchResultTest.java deleted file mode 100644 index 001bba9834..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/BatchResultTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.cloud.BaseServiceException.ExceptionData; -import org.easymock.EasyMock; -import org.junit.Before; -import org.junit.Test; - -public class BatchResultTest { - - private BatchResult result; - - @Before - public void setUp() { - result = new BatchResult() {}; - } - - @Test - public void testSuccess() { - assertFalse(result.completed()); - try { - result.get(); - fail("This was not completed yet."); - } catch (IllegalStateException ex) { - // expected - } - result.success(true); - assertTrue(result.get()); - // test that null is allowed - result.success(null); - } - - @Test - public void testError() { - assertFalse(result.completed()); - try { - result.get(); - fail("This was not completed yet."); - } catch (IllegalStateException ex) { - // expected - } - try { - result.error(null); - fail(); - } catch (NullPointerException exc) { - // expected - } - BaseServiceException ex = - new BaseServiceException(ExceptionData.from(0, "message", "reason", false)); - result.error(ex); - try { - result.get(); - fail("This is a failed operation and should have thrown a DnsException."); - } catch (BaseServiceException real) { - assertSame(ex, real); - } - } - - @Test - public void testNotifyError() { - final BaseServiceException ex = - new BaseServiceException(ExceptionData.from(0, "message", "reason", false)); - assertFalse(result.completed()); - BatchResult.Callback callback = - EasyMock.createStrictMock(BatchResult.Callback.class); - callback.error(ex); - EasyMock.replay(callback); - result.notify(callback); - result.error(ex); - try { - result.notify(callback); - fail("The batch has been completed."); - } catch (IllegalStateException exception) { - // expected - } - EasyMock.verify(callback); - } - - @Test - public void testNotifySuccess() { - assertFalse(result.completed()); - BatchResult.Callback callback = - EasyMock.createStrictMock(BatchResult.Callback.class); - callback.success(true); - EasyMock.replay(callback); - result.notify(callback); - result.success(true); - try { - result.notify(callback); - fail("The batch has been completed."); - } catch (IllegalStateException exception) { - // expected - } - EasyMock.verify(callback); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/ByteArrayTest.java b/google-cloud-core/src/test/java/com/google/cloud/ByteArrayTest.java deleted file mode 100644 index 42873f8643..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/ByteArrayTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - -import com.google.common.io.ByteStreams; -import com.google.protobuf.ByteString; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import org.junit.BeforeClass; -import org.junit.Test; - -public class ByteArrayTest { - - private static final String STRING_CONTENT = "Hello, ByteArray!"; - private static final byte[] BYTES_CONTENT = STRING_CONTENT.getBytes(StandardCharsets.UTF_8); - private static final ByteBuffer BYTE_BUFFER_CONTENT = ByteBuffer.wrap(BYTES_CONTENT); - private static final InputStream STREAM_CONTENT = new ByteArrayInputStream(BYTES_CONTENT); - private static final ByteArray STRING_ARRAY = ByteArray.copyFrom(STRING_CONTENT); - private static final ByteArray BYTES_ARRAY = ByteArray.copyFrom(BYTES_CONTENT); - private static final ByteArray BYTE_BUFFER_ARRAY = ByteArray.copyFrom(BYTE_BUFFER_CONTENT); - private static final ByteArray ARRAY = new ByteArray(ByteString.copyFrom(BYTES_CONTENT)); - - private static ByteArray streamArray; - - @BeforeClass - public static void beforeClass() throws IOException { - streamArray = ByteArray.copyFrom(STREAM_CONTENT); - BYTE_BUFFER_CONTENT.flip(); - } - - @Test - public void testCopyFromString() throws IOException { - assertEquals(STRING_CONTENT, STRING_ARRAY.toStringUtf8()); - assertArrayEquals(BYTES_CONTENT, STRING_ARRAY.toByteArray()); - assertEquals(BYTE_BUFFER_CONTENT.asReadOnlyBuffer(), STRING_ARRAY.asReadOnlyByteBuffer()); - assertArrayEquals(BYTES_CONTENT, ByteStreams.toByteArray(STRING_ARRAY.asInputStream())); - } - - @Test - public void testCopyFromByteArray() throws IOException { - assertEquals(STRING_CONTENT, BYTES_ARRAY.toStringUtf8()); - assertArrayEquals(BYTES_CONTENT, BYTES_ARRAY.toByteArray()); - assertEquals(BYTE_BUFFER_CONTENT.asReadOnlyBuffer(), BYTES_ARRAY.asReadOnlyByteBuffer()); - assertArrayEquals(BYTES_CONTENT, ByteStreams.toByteArray(BYTES_ARRAY.asInputStream())); - } - - @Test - public void testCopyFromByteBuffer() throws IOException { - assertEquals(STRING_CONTENT, BYTE_BUFFER_ARRAY.toStringUtf8()); - assertArrayEquals(BYTES_CONTENT, BYTE_BUFFER_ARRAY.toByteArray()); - assertEquals(BYTE_BUFFER_CONTENT.asReadOnlyBuffer(), BYTE_BUFFER_ARRAY.asReadOnlyByteBuffer()); - assertArrayEquals(BYTES_CONTENT, ByteStreams.toByteArray(BYTE_BUFFER_ARRAY.asInputStream())); - } - - @Test - public void testCopyFromStream() throws IOException { - assertEquals(STRING_CONTENT, streamArray.toStringUtf8()); - assertArrayEquals(BYTES_CONTENT, streamArray.toByteArray()); - assertEquals(BYTE_BUFFER_CONTENT.asReadOnlyBuffer(), streamArray.asReadOnlyByteBuffer()); - assertArrayEquals(BYTES_CONTENT, ByteStreams.toByteArray(streamArray.asInputStream())); - } - - @Test - public void testLength() { - assertEquals(BYTES_CONTENT.length, ARRAY.length()); - } - - @Test - public void testToStringUtf8() { - assertEquals(STRING_CONTENT, ARRAY.toStringUtf8()); - } - - @Test - public void testToByteArray() { - assertArrayEquals(BYTES_CONTENT, ARRAY.toByteArray()); - } - - @Test - public void testAsReadOnlyByteBuffer() { - assertEquals(BYTE_BUFFER_CONTENT.asReadOnlyBuffer(), ARRAY.asReadOnlyByteBuffer()); - } - - @Test - public void testAsInputStream() throws IOException { - assertArrayEquals(BYTES_CONTENT, ByteStreams.toByteArray(ARRAY.asInputStream())); - } - - @Test - public void testHashCode() { - assertEquals(STRING_ARRAY.hashCode(), BYTES_ARRAY.hashCode()); - assertEquals(BYTES_ARRAY.hashCode(), BYTE_BUFFER_ARRAY.hashCode()); - assertEquals(BYTE_BUFFER_ARRAY.hashCode(), streamArray.hashCode()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/ConditionTest.java b/google-cloud-core/src/test/java/com/google/cloud/ConditionTest.java deleted file mode 100644 index 67e0e6c2b5..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/ConditionTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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; - -import static com.google.common.truth.Truth.assertThat; - -import org.junit.Test; - -public final class ConditionTest { - - @Test - public void title_nullable() { - Condition condition = - Condition.newBuilder().setTitle(null).setDescription("desc").setExpression("expr").build(); - - assertThat(condition.getTitle()).isNull(); - } - - @Test - public void description_nullable() { - Condition condition = - Condition.newBuilder().setTitle("title").setDescription(null).setExpression("expr").build(); - - assertThat(condition.getDescription()).isNull(); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/DateTest.java b/google-cloud-core/src/test/java/com/google/cloud/DateTest.java deleted file mode 100644 index d95efaf094..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/DateTest.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2017 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; - -import static com.google.common.testing.SerializableTester.reserializeAndAssert; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; - -import com.google.common.testing.EqualsTester; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Unit tests for {@link Date}. */ -@RunWith(JUnit4.class) -public class DateTest { - - private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); - - @Test - public void parseDate() { - verifyDate("2016-09-18", 2016, 9, 18); - verifyDate("2000-01-01", 2000, 1, 1); - verifyDate("9999-12-31", 9999, 12, 31); - verifyDate("0001-01-01", 1, 1, 1); - verifyDate("2000-02-29", 2000, 2, 29); // This is a valid leap year. - verifyDate("1900-02-29", 1900, 2, 29); // This is NOT a valid leap year. - verifyDate("2001-02-29", 2001, 2, 29); // Also not a valid leap year. - verifyDate("2000-04-31", 2000, 4, 31); // Not a valid date. - } - - private void verifyDate(String input, int year, int month, int day) { - Date date = Date.parseDate(input); - assertThat(date.getYear()).isEqualTo(year); - assertThat(date.getMonth()).isEqualTo(month); - assertThat(date.getDayOfMonth()).isEqualTo(day); - } - - @Test - public void parseInvalidDates() { - parseInvalidDate("2016/09/18"); - parseInvalidDate("2016 09 18"); - parseInvalidDate("2016-9-18"); - parseInvalidDate("2016-09-18T10:00"); - parseInvalidDate(""); - parseInvalidDate("test"); - parseInvalidDate("aaaa-bb-cc"); - parseInvalidDate("aaaa-01-01"); - parseInvalidDate("2019-bb-01"); - parseInvalidDate("2019-01-cc"); - parseInvalidMonth("2000-13-01"); - parseInvalidMonth("2000-00-01"); - parseInvalidDay("2000-12-32"); - parseInvalidDay("2000-12-00"); - parseInvalidDate("10000-01-01"); - parseInvalidYear("0000-01-01"); - parseInvalidYear("-001-01-01"); - parseInvalidMonth("0001--1-01"); - parseInvalidDay("0001-01--1"); - } - - private void parseInvalidDate(String input) { - try { - Date.parseDate(input); - fail("Expected exception"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).contains("Invalid date"); - } - } - - private void parseInvalidYear(String input) { - try { - Date.parseDate(input); - fail("Expected exception"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).contains("Invalid year"); - } - } - - private void parseInvalidMonth(String input) { - try { - Date.parseDate(input); - fail("Expected exception"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).contains("Invalid month"); - } - } - - private void parseInvalidDay(String input) { - try { - Date.parseDate(input); - fail("Expected exception"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).contains("Invalid day"); - } - } - - @Test - public void testToString() { - Date date = Date.fromYearMonthDay(10, 9, 5); - assertThat(date.toString()).isEqualTo("0010-09-05"); - date = Date.fromYearMonthDay(2016, 12, 31); - assertThat(date.toString()).isEqualTo("2016-12-31"); - date = Date.fromYearMonthDay(1, 1, 1); - assertThat(date.toString()).isEqualTo("0001-01-01"); - } - - @Test - public void equalAndHashCode() { - Date d1 = Date.fromYearMonthDay(2016, 9, 18); - Date d2 = Date.fromYearMonthDay(2016, 9, 18); - Date d3 = Date.fromYearMonthDay(2016, 9, 19); - new EqualsTester().addEqualityGroup(d1, d2).addEqualityGroup(d3).testEquals(); - } - - @Test - public void validOrdering() { - Date d1 = Date.fromYearMonthDay(2016, 9, 18); - Date d2 = Date.fromYearMonthDay(2016, 9, 19); - Date d3 = Date.fromYearMonthDay(2016, 9, 20); - Date d4 = Date.fromYearMonthDay(2016, 10, 1); - Date d5 = Date.fromYearMonthDay(2017, 1, 1); - assertDescending(d5, d4, d3, d2, d1); - } - - @Test - public void serialization() { - reserializeAndAssert(Date.fromYearMonthDay(2017, 4, 20)); - } - - @Test - public void testToJavaUtilDate() throws ParseException { - Date gcDate = Date.parseDate("2016-09-18"); - java.util.Date juDate1 = SIMPLE_DATE_FORMAT.parse("2016-09-18"); - java.util.Date juDate2 = Date.toJavaUtilDate(gcDate); - assertThat(juDate1).isEqualTo(juDate2); - } - - @Test - public void testFromJavaUtilDate() throws ParseException { - java.util.Date juDate = SIMPLE_DATE_FORMAT.parse("2016-09-18"); - Date gcDate = Date.fromJavaUtilDate(juDate); - assertThat(gcDate.getYear()).isEqualTo(2016); - assertThat(gcDate.getMonth()).isEqualTo(9); - assertThat(gcDate.getDayOfMonth()).isEqualTo(18); - } - - private void assertDescending(Date... dates) { - for (int i = 0; i < dates.length - 1; i++) { - assertThat(dates[i]).isEquivalentAccordingToCompareTo(dates[i]); - for (int j = i + 1; j < dates.length; j++) { - assertThat(dates[i]).isGreaterThan(dates[j]); - } - } - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java b/google-cloud-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java deleted file mode 100644 index 50e0583c89..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/ExceptionHandlerTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2015 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; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.cloud.ExceptionHandler.Interceptor; -import com.google.cloud.ExceptionHandler.Interceptor.RetryResult; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.channels.ClosedByInterruptException; -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicReference; -import org.junit.Test; - -/** Tests for {@link ExceptionHandler}. */ -public class ExceptionHandlerTest { - - @Test - public void testVerifyCaller() { - class A implements Callable { - @Override - public Object call() throws IOException, InterruptedException { - return null; - } - } - - class B extends A {} - - class C extends A { - @Override - public Object call() throws FileNotFoundException { - return "c"; - } - } - - class D extends C { - @Override - public Object call() throws IllegalArgumentException { - return "d"; - } - } - - class E extends A { - @Override - public String call() throws NullPointerException { - return "e"; - } - } - - class F extends A { - @Override - public Object call() throws Error { - return "f"; - } - } - - // using default exception handler (retry upon any non-runtime exceptions) - ExceptionHandler handler = ExceptionHandler.getDefaultInstance(); - assertValidCallable(new A(), handler); - assertValidCallable(new B(), handler); - assertValidCallable(new C(), handler); - assertValidCallable(new D(), handler); - assertValidCallable(new E(), handler); - assertInvalidCallable(new F(), handler); - - handler = - ExceptionHandler.newBuilder() - .retryOn(FileNotFoundException.class, NullPointerException.class) - .build(); - assertInvalidCallable(new A(), handler); - assertInvalidCallable(new B(), handler); - assertValidCallable(new C(), handler); - assertInvalidCallable(new D(), handler); - assertValidCallable(new E(), handler); - assertInvalidCallable(new F(), handler); - } - - private static void assertValidCallable(Callable callable, ExceptionHandler handler) { - handler.verifyCaller(callable); - } - - private static void assertInvalidCallable(Callable callable, ExceptionHandler handler) { - try { - handler.verifyCaller(callable); - fail("Expected RetryHelper constructor to fail"); - } catch (IllegalArgumentException ex) { - // expected - } - } - - @Test - public void testShouldTry() { - ExceptionHandler handler = ExceptionHandler.newBuilder().retryOn(IOException.class).build(); - assertTrue(handler.shouldRetry(new IOException(), null)); - assertTrue(handler.shouldRetry(new ClosedByInterruptException(), null)); - assertFalse(handler.shouldRetry(new RuntimeException(), null)); - - ExceptionHandler.Builder builder = - ExceptionHandler.newBuilder() - .retryOn(IOException.class, NullPointerException.class) - .abortOn( - RuntimeException.class, - ClosedByInterruptException.class, - InterruptedException.class); - - handler = builder.build(); - assertTrue(handler.shouldRetry(new IOException(), null)); - assertFalse(handler.shouldRetry(new ClosedByInterruptException(), null)); - assertFalse(handler.shouldRetry(new InterruptedException(), null)); - assertFalse(handler.shouldRetry(new RuntimeException(), null)); - assertTrue(handler.shouldRetry(new NullPointerException(), null)); - - final AtomicReference before = new AtomicReference<>(RetryResult.NO_RETRY); - @SuppressWarnings("serial") - Interceptor interceptor = - new Interceptor() { - - @Override - public RetryResult afterEval(Exception exception, RetryResult retryResult) { - return retryResult == RetryResult.NO_RETRY ? RetryResult.RETRY : RetryResult.NO_RETRY; - } - - @Override - public RetryResult beforeEval(Exception exception) { - return before.get(); - } - }; - - builder.addInterceptors(interceptor); - handler = builder.build(); - assertFalse(handler.shouldRetry(new IOException(), null)); - assertFalse(handler.shouldRetry(new ClosedByInterruptException(), null)); - assertFalse(handler.shouldRetry(new InterruptedException(), null)); - assertFalse(handler.shouldRetry(new RuntimeException(), null)); - assertFalse(handler.shouldRetry(new NullPointerException(), null)); - - before.set(RetryResult.RETRY); - assertTrue(handler.shouldRetry(new IOException(), null)); - assertTrue(handler.shouldRetry(new ClosedByInterruptException(), null)); - assertTrue(handler.shouldRetry(new InterruptedException(), null)); - assertTrue(handler.shouldRetry(new RuntimeException(), null)); - assertTrue(handler.shouldRetry(new NullPointerException(), null)); - - before.set(RetryResult.CONTINUE_EVALUATION); - assertFalse(handler.shouldRetry(new IOException(), null)); - assertTrue(handler.shouldRetry(new ClosedByInterruptException(), null)); - assertTrue(handler.shouldRetry(new InterruptedException(), null)); - assertTrue(handler.shouldRetry(new RuntimeException(), null)); - assertFalse(handler.shouldRetry(new NullPointerException(), null)); - } - - @Test(expected = NullPointerException.class) - public void testNullRetryResultFromBeforeEval() { - @SuppressWarnings("serial") - Interceptor interceptor = - new Interceptor() { - - @Override - public RetryResult beforeEval(Exception exception) { - return null; - } - - @Override - public RetryResult afterEval(Exception exception, RetryResult retryResult) { - return RetryResult.CONTINUE_EVALUATION; - } - }; - - ExceptionHandler handler = ExceptionHandler.newBuilder().addInterceptors(interceptor).build(); - handler.shouldRetry(new Exception(), null); - } - - @Test(expected = NullPointerException.class) - public void testNullRetryResultFromAfterEval() { - @SuppressWarnings("serial") - Interceptor interceptor = - new Interceptor() { - - @Override - public RetryResult beforeEval(Exception exception) { - return RetryResult.CONTINUE_EVALUATION; - } - - @Override - public RetryResult afterEval(Exception exception, RetryResult retryResult) { - return null; - } - }; - - ExceptionHandler handler = ExceptionHandler.newBuilder().addInterceptors(interceptor).build(); - handler.shouldRetry(new Exception(), null); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java b/google-cloud-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java deleted file mode 100644 index 7b94ff5294..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/FieldSelectorHelperTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import com.google.cloud.FieldSelector.Helper; -import com.google.common.collect.ImmutableList; -import java.util.List; -import org.junit.Test; - -public class FieldSelectorHelperTest { - - private static final FieldSelector FIELD1 = - new FieldSelector() { - @Override - public String getSelector() { - return "field1"; - } - }; - private static final FieldSelector FIELD2 = - new FieldSelector() { - @Override - public String getSelector() { - return "field2"; - } - }; - private static final FieldSelector FIELD3 = - new FieldSelector() { - @Override - public String getSelector() { - return "field3"; - } - }; - private static final String[] FIRST_LEVEL_FIELDS = {"firstLevel1", "firstLevel2"}; - private static final List REQUIRED_FIELDS = ImmutableList.of(FIELD1, FIELD2); - private static final String CONTAINER = "container"; - - @Test - public void testSelector() { - String selector = Helper.selector(REQUIRED_FIELDS, FIELD3); - assertTrue(selector.contains("field1")); - assertTrue(selector.contains("field2")); - assertTrue(selector.contains("field3")); - assertEquals(20, selector.length()); - } - - @Test - public void testListSelector() { - String selector = Helper.listSelector(CONTAINER, REQUIRED_FIELDS, FIELD3); - assertTrue(selector.startsWith("nextPageToken,container(")); - assertTrue(selector.contains("field1")); - assertTrue(selector.contains("field2")); - assertTrue(selector.contains("field3")); - assertTrue(selector.endsWith(")")); - assertEquals(45, selector.length()); - } - - @Test - public void testListSelectorWithExtraFields() { - String selector = - Helper.listSelector(CONTAINER, REQUIRED_FIELDS, new FieldSelector[] {FIELD3}, "field4"); - assertTrue(selector.startsWith("nextPageToken,container(")); - assertTrue(selector.contains("field1")); - assertTrue(selector.contains("field2")); - assertTrue(selector.contains("field3")); - assertTrue(selector.contains("field4")); - assertTrue(selector.endsWith(")")); - assertEquals(52, selector.length()); - } - - @Test - public void testListSelectorWithFirstLevelFields() { - String selector = - Helper.listSelector( - FIRST_LEVEL_FIELDS, CONTAINER, REQUIRED_FIELDS, new FieldSelector[] {FIELD3}, "field4"); - assertTrue(selector.contains("firstLevel1")); - assertTrue(selector.contains("firstLevel2")); - assertTrue(selector.contains("nextPageToken")); - assertTrue(selector.contains("container(")); - assertTrue(selector.contains("field1")); - assertTrue(selector.contains("field2")); - assertTrue(selector.contains("field3")); - assertTrue(selector.contains("field4")); - assertTrue(selector.endsWith(")")); - assertEquals(76, selector.length()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/IdentityTest.java b/google-cloud-core/src/test/java/com/google/cloud/IdentityTest.java deleted file mode 100644 index 8f8abb170c..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/IdentityTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class IdentityTest { - - private static final Identity ALL_USERS = Identity.allUsers(); - private static final Identity ALL_AUTH_USERS = Identity.allAuthenticatedUsers(); - private static final Identity USER = Identity.user("abc@gmail.com"); - private static final Identity SERVICE_ACCOUNT = - Identity.serviceAccount("service-account@gmail.com"); - private static final Identity GROUP = Identity.group("group@gmail.com"); - private static final Identity DOMAIN = Identity.domain("google.com"); - private static final Identity PROJECT_OWNER = Identity.projectOwner("my-sample-project"); - private static final Identity PROJECT_EDITOR = Identity.projectEditor("my-sample-project"); - private static final Identity PROJECT_VIEWER = Identity.projectViewer("my-sample-project"); - - @Test - public void testAllUsers() { - assertEquals(Identity.Type.ALL_USERS, ALL_USERS.getType()); - assertNull(ALL_USERS.getValue()); - } - - @Test - public void testAllAuthenticatedUsers() { - assertEquals(Identity.Type.ALL_AUTHENTICATED_USERS, ALL_AUTH_USERS.getType()); - assertNull(ALL_AUTH_USERS.getValue()); - } - - @Test - public void testUser() { - assertEquals(Identity.Type.USER, USER.getType()); - assertEquals("abc@gmail.com", USER.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testUserNullEmail() { - Identity.user(null); - } - - @Test - public void testServiceAccount() { - assertEquals(Identity.Type.SERVICE_ACCOUNT, SERVICE_ACCOUNT.getType()); - assertEquals("service-account@gmail.com", SERVICE_ACCOUNT.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testServiceAccountNullEmail() { - Identity.serviceAccount(null); - } - - @Test - public void testGroup() { - assertEquals(Identity.Type.GROUP, GROUP.getType()); - assertEquals("group@gmail.com", GROUP.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testGroupNullEmail() { - Identity.group(null); - } - - @Test - public void testDomain() { - assertEquals(Identity.Type.DOMAIN, DOMAIN.getType()); - assertEquals("google.com", DOMAIN.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testDomainNullId() { - Identity.domain(null); - } - - @Test - public void testProjectOwner() { - assertEquals(Identity.Type.PROJECT_OWNER, PROJECT_OWNER.getType()); - assertEquals("my-sample-project", PROJECT_OWNER.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testProjectOwnerNullId() { - Identity.projectOwner(null); - } - - @Test - public void testProjectEditor() { - assertEquals(Identity.Type.PROJECT_EDITOR, PROJECT_EDITOR.getType()); - assertEquals("my-sample-project", PROJECT_EDITOR.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testProjectEditorNullId() { - Identity.projectEditor(null); - } - - @Test - public void testProjectViewer() { - assertEquals(Identity.Type.PROJECT_VIEWER, PROJECT_VIEWER.getType()); - assertEquals("my-sample-project", PROJECT_VIEWER.getValue()); - } - - @Test(expected = NullPointerException.class) - public void testProjectViewerNullId() { - Identity.projectViewer(null); - } - - @Test - public void testIdentityToAndFromPb() { - compareIdentities(ALL_USERS, Identity.valueOf(ALL_USERS.strValue())); - compareIdentities(ALL_AUTH_USERS, Identity.valueOf(ALL_AUTH_USERS.strValue())); - compareIdentities(USER, Identity.valueOf(USER.strValue())); - compareIdentities(SERVICE_ACCOUNT, Identity.valueOf(SERVICE_ACCOUNT.strValue())); - compareIdentities(GROUP, Identity.valueOf(GROUP.strValue())); - compareIdentities(DOMAIN, Identity.valueOf(DOMAIN.strValue())); - compareIdentities(PROJECT_OWNER, Identity.valueOf(PROJECT_OWNER.strValue())); - compareIdentities(PROJECT_EDITOR, Identity.valueOf(PROJECT_EDITOR.strValue())); - compareIdentities(PROJECT_VIEWER, Identity.valueOf(PROJECT_VIEWER.strValue())); - } - - @Test(expected = IllegalArgumentException.class) - public void testValueOfEmpty() { - Identity.valueOf(""); - } - - @Test - public void testUnrecognizedToString() { - assertEquals("a:b", Identity.valueOf("a:b").strValue()); - } - - @Test - public void testValueOfThreePart() { - Identity identity = Identity.valueOf("a:b:c"); - assertEquals("A", identity.getType().name()); - assertEquals("b:c", identity.getValue()); - } - - private void compareIdentities(Identity expected, Identity actual) { - assertEquals(expected, actual); - assertEquals(expected.getType(), actual.getType()); - assertEquals(expected.getValue(), actual.getValue()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java b/google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java deleted file mode 100644 index b29896af48..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceDescriptorTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import com.google.cloud.MonitoredResourceDescriptor.LabelDescriptor; -import com.google.cloud.MonitoredResourceDescriptor.LabelDescriptor.ValueType; -import com.google.common.collect.ImmutableList; -import java.util.List; -import org.junit.Test; - -public class MonitoredResourceDescriptorTest { - - private static final LabelDescriptor BOOLEAN_LABEL = - new LabelDescriptor("booleanKey", ValueType.BOOL, "Boolean label"); - private static final LabelDescriptor STRING_LABEL = - new LabelDescriptor("stringKey", ValueType.STRING, "String label"); - private static final LabelDescriptor INT_LABEL = - new LabelDescriptor("intKey", ValueType.INT64, "Int label"); - private static final LabelDescriptor INT_LABEL_NO_DESCRIPTION = - new LabelDescriptor("intKey", ValueType.INT64, null); - private static final String TYPE = "resource_type"; - private static final String NAME = "resourceName"; - private static final String DISPLAY_NAME = "Display Name"; - private static final String DESCRIPTION = "Resource Descriptor"; - private static final List LABELS = - ImmutableList.of(BOOLEAN_LABEL, STRING_LABEL, INT_LABEL); - private static final MonitoredResourceDescriptor RESOURCE_DESCRIPTOR = - MonitoredResourceDescriptor.newBuilder(TYPE) - .setName(NAME) - .setDisplayName(DISPLAY_NAME) - .setDescription(DESCRIPTION) - .setLabels(LABELS) - .build(); - - @Test - public void testLabelDescriptor() { - assertEquals("booleanKey", BOOLEAN_LABEL.getKey()); - assertEquals(ValueType.BOOL, BOOLEAN_LABEL.getValueType()); - assertEquals("Boolean label", BOOLEAN_LABEL.getDescription()); - assertEquals("stringKey", STRING_LABEL.getKey()); - assertEquals(ValueType.STRING, STRING_LABEL.getValueType()); - assertEquals("String label", STRING_LABEL.getDescription()); - assertEquals("intKey", INT_LABEL.getKey()); - assertEquals(ValueType.INT64, INT_LABEL.getValueType()); - assertEquals("Int label", INT_LABEL.getDescription()); - assertEquals("intKey", INT_LABEL_NO_DESCRIPTION.getKey()); - assertEquals(ValueType.INT64, INT_LABEL_NO_DESCRIPTION.getValueType()); - assertNull(INT_LABEL_NO_DESCRIPTION.getDescription()); - } - - @Test - public void testBuilder() { - assertEquals(TYPE, RESOURCE_DESCRIPTOR.getType()); - assertEquals(NAME, RESOURCE_DESCRIPTOR.getName()); - assertEquals(DISPLAY_NAME, RESOURCE_DESCRIPTOR.getDisplayName()); - assertEquals(DESCRIPTION, RESOURCE_DESCRIPTOR.getDescription()); - assertEquals(LABELS, RESOURCE_DESCRIPTOR.getLabels()); - MonitoredResourceDescriptor resourceDescriptor = - MonitoredResourceDescriptor.newBuilder(TYPE).build(); - assertEquals(TYPE, resourceDescriptor.getType()); - assertNull(resourceDescriptor.getName()); - assertNull(resourceDescriptor.getDisplayName()); - assertNull(resourceDescriptor.getDescription()); - assertEquals(ImmutableList.of(), resourceDescriptor.getLabels()); - } - - @Test - public void testToAndFromPbLabelDescriptor() { - compareLabelDescriptor(BOOLEAN_LABEL, LabelDescriptor.fromPb(BOOLEAN_LABEL.toPb())); - compareLabelDescriptor(STRING_LABEL, LabelDescriptor.fromPb(STRING_LABEL.toPb())); - compareLabelDescriptor(INT_LABEL, LabelDescriptor.fromPb(INT_LABEL.toPb())); - compareLabelDescriptor( - INT_LABEL_NO_DESCRIPTION, LabelDescriptor.fromPb(INT_LABEL_NO_DESCRIPTION.toPb())); - } - - @Test - public void testToAndFromPb() { - compareResourceDescriptor( - RESOURCE_DESCRIPTOR, MonitoredResourceDescriptor.fromPb(RESOURCE_DESCRIPTOR.toPb())); - MonitoredResourceDescriptor resourceDescriptor = - MonitoredResourceDescriptor.newBuilder(TYPE).build(); - compareResourceDescriptor( - resourceDescriptor, MonitoredResourceDescriptor.fromPb(resourceDescriptor.toPb())); - } - - private void compareLabelDescriptor(LabelDescriptor expected, LabelDescriptor value) { - assertEquals(expected, value); - assertEquals(expected.getKey(), value.getKey()); - assertEquals(expected.getValueType(), value.getValueType()); - assertEquals(expected.getDescription(), value.getDescription()); - assertEquals(expected.hashCode(), value.hashCode()); - assertEquals(expected.toString(), value.toString()); - } - - private void compareResourceDescriptor( - MonitoredResourceDescriptor expected, MonitoredResourceDescriptor value) { - assertEquals(expected, value); - assertEquals(expected.getType(), value.getType()); - assertEquals(expected.getName(), value.getName()); - assertEquals(expected.getDisplayName(), value.getDisplayName()); - assertEquals(expected.getDescription(), value.getDescription()); - assertEquals(expected.getLabels(), value.getLabels()); - assertEquals(expected.hashCode(), value.hashCode()); - assertEquals(expected.toString(), value.toString()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceTest.java b/google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceTest.java deleted file mode 100644 index 6054a7aa34..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/MonitoredResourceTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import org.junit.Test; - -public class MonitoredResourceTest { - - private static final String TYPE = "cloudsql_database"; - private static final Map LABELS = - ImmutableMap.of("dataset-id", "myDataset", "zone", "myZone"); - private static final MonitoredResource MONITORED_RESOURCE = - MonitoredResource.newBuilder(TYPE).setLabels(LABELS).build(); - - @Test - public void testBuilder() { - assertEquals(TYPE, MONITORED_RESOURCE.getType()); - assertEquals(LABELS, MONITORED_RESOURCE.getLabels()); - MonitoredResource monitoredResource = - MonitoredResource.newBuilder(TYPE) - .addLabel("dataset-id", "myDataset") - .addLabel("zone", "myZone") - .build(); - assertEquals(TYPE, monitoredResource.getType()); - assertEquals(LABELS, monitoredResource.getLabels()); - compareMonitoredResource(MONITORED_RESOURCE, monitoredResource); - monitoredResource = - MonitoredResource.newBuilder(TYPE) - .setType("global") - .addLabel("dataset-id", "myDataset") - .addLabel("zone", "myZone") - .clearLabels() - .build(); - assertEquals("global", monitoredResource.getType()); - assertEquals(ImmutableMap.of(), monitoredResource.getLabels()); - } - - @Test - public void testToBuilder() { - compareMonitoredResource(MONITORED_RESOURCE, MONITORED_RESOURCE.toBuilder().build()); - MonitoredResource monitoredResource = - MONITORED_RESOURCE.toBuilder().setType("global").clearLabels().build(); - assertEquals("global", monitoredResource.getType()); - assertEquals(ImmutableMap.of(), monitoredResource.getLabels()); - monitoredResource = - monitoredResource - .toBuilder() - .setType(TYPE) - .setLabels(ImmutableMap.of("dataset-id", "myDataset")) - .addLabel("zone", "myZone") - .build(); - compareMonitoredResource(MONITORED_RESOURCE, monitoredResource); - } - - @Test - public void testOf() { - MonitoredResource monitoredResource = MonitoredResource.of(TYPE, LABELS); - assertEquals(TYPE, monitoredResource.getType()); - assertEquals(LABELS, monitoredResource.getLabels()); - compareMonitoredResource(MONITORED_RESOURCE, monitoredResource); - } - - @Test - public void testToAndFromPb() { - compareMonitoredResource( - MONITORED_RESOURCE, MonitoredResource.fromPb(MONITORED_RESOURCE.toPb())); - MonitoredResource monitoredResource = - MonitoredResource.of(TYPE, ImmutableMap.of()); - compareMonitoredResource(monitoredResource, MonitoredResource.fromPb(monitoredResource.toPb())); - } - - private void compareMonitoredResource(MonitoredResource expected, MonitoredResource value) { - assertEquals(expected, value); - assertEquals(expected.getType(), value.getType()); - assertEquals(expected.getLabels(), value.getLabels()); - assertEquals(expected.hashCode(), value.hashCode()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/PageImplTest.java b/google-cloud-core/src/test/java/com/google/cloud/PageImplTest.java deleted file mode 100644 index 5e6a6782d6..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/PageImplTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 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; - -import static org.junit.Assert.assertEquals; - -import com.google.api.gax.paging.Page; -import com.google.common.collect.ImmutableList; -import org.junit.Test; - -public class PageImplTest { - - private static final ImmutableList VALUES = ImmutableList.of("1", "2"); - private static final ImmutableList NEXT_VALUES = ImmutableList.of("3", "4"); - private static final ImmutableList ALL_VALUES = - ImmutableList.builder().addAll(VALUES).addAll(NEXT_VALUES).build(); - - private static class TestPageFetcher implements PageImpl.NextPageFetcher { - private static final long serialVersionUID = -8316752901403429976L; - - private final PageImpl nextResult; - - TestPageFetcher(PageImpl nextResult) { - this.nextResult = nextResult; - } - - @Override - public Page getNextPage() { - return nextResult; - } - } - - @Test - public void testPage() { - final PageImpl nextResult = new PageImpl<>(null, "c", NEXT_VALUES); - PageImpl.NextPageFetcher fetcher = new TestPageFetcher(nextResult); - PageImpl result = new PageImpl<>(fetcher, "c", VALUES); - assertEquals(nextResult, result.getNextPage()); - assertEquals("c", result.getNextPageToken()); - assertEquals(VALUES, result.getValues()); - } - - @Test - public void testIterateAll() { - final PageImpl nextResult = new PageImpl<>(null, "c", NEXT_VALUES); - PageImpl.NextPageFetcher fetcher = new TestPageFetcher(nextResult); - PageImpl result = new PageImpl<>(fetcher, "c", VALUES); - assertEquals(ALL_VALUES, ImmutableList.copyOf(result.iterateAll())); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/PolicyTest.java b/google-cloud-core/src/test/java/com/google/cloud/PolicyTest.java deleted file mode 100644 index 98695c2a4c..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/PolicyTest.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.cloud.Policy.DefaultMarshaller; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import org.junit.Test; - -public class PolicyTest { - - private static final Identity ALL_USERS = Identity.allUsers(); - private static final Identity ALL_AUTH_USERS = Identity.allAuthenticatedUsers(); - private static final Identity USER = Identity.user("abc@gmail.com"); - private static final Identity SERVICE_ACCOUNT = - Identity.serviceAccount("service-account@gmail.com"); - private static final Identity GROUP = Identity.group("group@gmail.com"); - private static final Identity DOMAIN = Identity.domain("google.com"); - private static final Role VIEWER = Role.viewer(); - private static final Role EDITOR = Role.editor(); - private static final Role OWNER = Role.owner(); - private static final Map> BINDINGS = - ImmutableMap.of( - VIEWER, - ImmutableSet.of(USER, SERVICE_ACCOUNT, ALL_USERS), - EDITOR, - ImmutableSet.of(ALL_AUTH_USERS, GROUP, DOMAIN)); - private static final Policy SIMPLE_POLICY = - Policy.newBuilder() - .addIdentity(VIEWER, USER, SERVICE_ACCOUNT, ALL_USERS) - .addIdentity(EDITOR, ALL_AUTH_USERS, GROUP, DOMAIN) - .build(); - private static final Policy FULL_POLICY = - Policy.newBuilder() - .setBindings(SIMPLE_POLICY.getBindings()) - .setEtag("etag") - .setVersion(1) - .build(); - - @Test - public void testBuilder() { - assertEquals(BINDINGS, SIMPLE_POLICY.getBindings()); - assertEquals(null, SIMPLE_POLICY.getEtag()); - assertEquals(0, SIMPLE_POLICY.getVersion()); - assertEquals(BINDINGS, FULL_POLICY.getBindings()); - assertEquals("etag", FULL_POLICY.getEtag()); - assertEquals(1, FULL_POLICY.getVersion()); - Map> editorBinding = - ImmutableMap.>builder().put(EDITOR, BINDINGS.get(EDITOR)).build(); - Policy policy = FULL_POLICY.toBuilder().setBindings(editorBinding).build(); - assertEquals(editorBinding, policy.getBindings()); - assertEquals("etag", policy.getEtag()); - assertEquals(1, policy.getVersion()); - policy = SIMPLE_POLICY.toBuilder().removeRole(EDITOR).build(); - assertEquals(ImmutableMap.of(VIEWER, BINDINGS.get(VIEWER)), policy.getBindings()); - assertNull(policy.getEtag()); - assertEquals(0, policy.getVersion()); - policy = - policy - .toBuilder() - .removeIdentity(VIEWER, USER, ALL_USERS) - .addIdentity(VIEWER, DOMAIN, GROUP) - .build(); - assertEquals( - ImmutableMap.of(VIEWER, ImmutableSet.of(SERVICE_ACCOUNT, DOMAIN, GROUP)), - policy.getBindings()); - assertNull(policy.getEtag()); - assertEquals(0, policy.getVersion()); - policy = - Policy.newBuilder() - .removeIdentity(VIEWER, USER) - .addIdentity(OWNER, USER, SERVICE_ACCOUNT) - .addIdentity(EDITOR, GROUP) - .removeIdentity(EDITOR, GROUP) - .build(); - assertEquals( - ImmutableMap.of(OWNER, ImmutableSet.of(USER, SERVICE_ACCOUNT)), policy.getBindings()); - assertNull(policy.getEtag()); - assertEquals(0, policy.getVersion()); - } - - @Test - public void testPolicyOrderShouldNotMatter() { - Role role1 = Role.of("role1"); - Identity identity1 = Identity.user("user1@example.com"); - Role role2 = Role.of("role2"); - Identity identity2 = Identity.user("user2@example.com"); - Policy policy1 = - Policy.newBuilder().addIdentity(role1, identity1).addIdentity(role2, identity2).build(); - Policy policy2 = - Policy.newBuilder().addIdentity(role2, identity2).addIdentity(role1, identity1).build(); - assertEquals(policy1, policy2); - } - - @Test - public void testPolicyMultipleAddIdentitiesShouldNotMatter() { - Role role1 = Role.of("role1"); - Identity identity1 = Identity.user("user1@example.com"); - Role role2 = Role.of("role2"); - Identity identity2 = Identity.user("user2@example.com"); - Policy policy1 = - Policy.newBuilder() - .addIdentity(role1, identity1) - .addIdentity(role2, identity2) - .addIdentity(role2, identity2) - .build(); - Policy policy2 = - Policy.newBuilder().addIdentity(role2, identity2).addIdentity(role1, identity1).build(); - assertEquals(policy1, policy2); - } - - @Test - public void testIllegalPolicies() { - try { - Policy.newBuilder().addIdentity(null, USER); - fail("Null role should cause exception."); - } catch (NullPointerException ex) { - assertEquals("The role cannot be null.", ex.getMessage()); - } - try { - Policy.newBuilder().addIdentity(VIEWER, null, USER); - fail("Null identity should cause exception."); - } catch (NullPointerException ex) { - assertEquals("Null identities are not permitted.", ex.getMessage()); - } - try { - Policy.newBuilder().addIdentity(VIEWER, USER, (Identity[]) null); - fail("Null identity should cause exception."); - } catch (NullPointerException ex) { - assertEquals("Null identities are not permitted.", ex.getMessage()); - } - try { - Policy.newBuilder().setBindings((Map>) null); - fail("Null bindings map should cause exception."); - } catch (NullPointerException ex) { - assertEquals("The provided map of bindings cannot be null.", ex.getMessage()); - } - try { - Map> bindings = new HashMap<>(); - bindings.put(VIEWER, null); - Policy.newBuilder().setBindings(bindings); - fail("Null set of identities should cause exception."); - } catch (NullPointerException ex) { - assertEquals("A role cannot be assigned to a null set of identities.", ex.getMessage()); - } - try { - Map> bindings = new HashMap<>(); - Set identities = new HashSet<>(); - identities.add(null); - bindings.put(VIEWER, identities); - Policy.newBuilder().setBindings(bindings); - fail("Null identity should cause exception."); - } catch (IllegalArgumentException ex) { - assertEquals("Null identities are not permitted.", ex.getMessage()); - } - } - - @Test - public void testEqualsHashCode() { - assertNotNull(FULL_POLICY); - Policy emptyPolicy = Policy.newBuilder().build(); - Policy anotherPolicy = Policy.newBuilder().build(); - assertEquals(emptyPolicy, anotherPolicy); - assertEquals(emptyPolicy.hashCode(), anotherPolicy.hashCode()); - assertNotEquals(FULL_POLICY, SIMPLE_POLICY); - assertNotEquals(FULL_POLICY.hashCode(), SIMPLE_POLICY.hashCode()); - Policy copy = SIMPLE_POLICY.toBuilder().build(); - assertEquals(SIMPLE_POLICY, copy); - assertEquals(SIMPLE_POLICY.hashCode(), copy.hashCode()); - } - - @Test - public void testBindings() { - assertTrue(Policy.newBuilder().build().getBindings().isEmpty()); - assertEquals(BINDINGS, SIMPLE_POLICY.getBindings()); - } - - @Test - public void testEtag() { - assertNull(SIMPLE_POLICY.getEtag()); - assertEquals("etag", FULL_POLICY.getEtag()); - } - - @Test - public void testVersion() { - assertEquals(0, SIMPLE_POLICY.getVersion()); - assertEquals(1, FULL_POLICY.getVersion()); - } - - @Test - public void testDefaultMarshaller() { - DefaultMarshaller marshaller = new DefaultMarshaller(); - Policy emptyPolicy = Policy.newBuilder().build(); - assertEquals(emptyPolicy, marshaller.fromPb(marshaller.toPb(emptyPolicy))); - assertEquals(SIMPLE_POLICY, marshaller.fromPb(marshaller.toPb(SIMPLE_POLICY))); - assertEquals(FULL_POLICY, marshaller.fromPb(marshaller.toPb(FULL_POLICY))); - com.google.iam.v1.Policy policyPb = com.google.iam.v1.Policy.getDefaultInstance(); - Policy policy = marshaller.fromPb(policyPb); - assertTrue(policy.getBindings().isEmpty()); - assertNull(policy.getEtag()); - assertEquals(0, policy.getVersion()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/PolicyV3Test.java b/google-cloud-core/src/test/java/com/google/cloud/PolicyV3Test.java deleted file mode 100644 index bdddf656f4..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/PolicyV3Test.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.cloud.Policy.DefaultMarshaller; -import com.google.common.collect.ImmutableList; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import org.junit.Test; - -public class PolicyV3Test { - - private static final String ALL_USERS = "allUsers"; - private static final String ALL_AUTH_USERS = "allAuthenticatedUsers"; - private static final String USER = "user:abc@gmail.com"; - private static final String SERVICE_ACCOUNT = "serviceAccount:service-account@gmail.com"; - private static final String GROUP = "group:group@gmail.com"; - private static final String DOMAIN = "domain:google.com"; - private static final String VIEWER = "roles/viewer"; - private static final String EDITOR = "roles/editor"; - private static final String OWNER = "roles/owner"; - private static final ImmutableList MEMBERS_LIST_1 = - ImmutableList.of(USER, SERVICE_ACCOUNT, ALL_USERS); - private static final ImmutableList MEMBERS_LIST_2 = - ImmutableList.of(ALL_AUTH_USERS, GROUP, DOMAIN); - - private static final Binding VIEWER_BINDING = - Binding.newBuilder().setRole(VIEWER).setMembers(MEMBERS_LIST_1).build(); - private static final Binding EDITOR_BINDING = - Binding.newBuilder().setRole(EDITOR).setMembers(MEMBERS_LIST_2).build(); - private static final ImmutableList BINDINGS_NO_CONDITIONS = - ImmutableList.of(VIEWER_BINDING, EDITOR_BINDING); - private static final Condition CONDITION = - Condition.newBuilder() - .setTitle("Condition") - .setDescription("Condition") - .setExpression("Expr") - .build(); - private static final ImmutableList BINDINGS_WITH_CONDITIONS = - ImmutableList.of(VIEWER_BINDING.toBuilder().setCondition(CONDITION).build(), EDITOR_BINDING); - private static final Policy FULL_POLICY_V1 = - Policy.newBuilder().setBindings(BINDINGS_NO_CONDITIONS).setEtag("etag").setVersion(1).build(); - - private static final Policy FULL_POLICY_V3 = - Policy.newBuilder() - .setBindings(BINDINGS_WITH_CONDITIONS) - .setEtag("etag") - .setVersion(3) - .build(); - - private static final Policy FULL_POLICY_V3_WITH_VERSION_1 = - Policy.newBuilder() - .setBindings(BINDINGS_WITH_CONDITIONS) - .setEtag("etag") - .setVersion(1) - .build(); - - @Test - public void testBuilderV1() { - assertEquals(BINDINGS_NO_CONDITIONS, FULL_POLICY_V1.getBindingsList()); - assertEquals(1, FULL_POLICY_V1.getVersion()); - assertEquals("etag", FULL_POLICY_V1.getEtag()); - Policy policy = FULL_POLICY_V1.toBuilder().setBindings(BINDINGS_NO_CONDITIONS).build(); - assertEquals(BINDINGS_NO_CONDITIONS, policy.getBindingsList()); - assertEquals("etag", policy.getEtag()); - assertEquals(1, policy.getVersion()); - } - - @Test - public void testBuilderV3WithConditions() { - assertEquals(BINDINGS_WITH_CONDITIONS, FULL_POLICY_V3.getBindingsList()); - assertEquals(3, FULL_POLICY_V3.getVersion()); - assertEquals("etag", FULL_POLICY_V3.getEtag()); - Policy policy = FULL_POLICY_V3.toBuilder().setBindings(BINDINGS_WITH_CONDITIONS).build(); - assertEquals(BINDINGS_WITH_CONDITIONS, policy.getBindingsList()); - assertEquals("etag", policy.getEtag()); - assertEquals(3, policy.getVersion()); - } - - @Test - public void testBuilderV1ToV3Compatability() { - assertEquals(BINDINGS_WITH_CONDITIONS, FULL_POLICY_V3_WITH_VERSION_1.getBindingsList()); - assertEquals(1, FULL_POLICY_V3_WITH_VERSION_1.getVersion()); - assertEquals("etag", FULL_POLICY_V3_WITH_VERSION_1.getEtag()); - Policy policy = - FULL_POLICY_V3_WITH_VERSION_1 - .toBuilder() - .setBindings(BINDINGS_WITH_CONDITIONS) - .setVersion(3) - .build(); - assertEquals(BINDINGS_WITH_CONDITIONS, policy.getBindingsList()); - assertEquals("etag", policy.getEtag()); - assertEquals(3, policy.getVersion()); - } - - @Test - public void removeMemberFromPolicy() { - assertEquals(3, FULL_POLICY_V3.getBindingsList().get(0).getMembers().size()); - List bindings = new ArrayList<>(FULL_POLICY_V3.getBindingsList()); - - for (int i = 0; i < bindings.size(); i++) { - Binding binding = bindings.get(i); - if (binding.getRole().equals(VIEWER)) { - bindings.set(i, binding.toBuilder().removeMembers(ALL_USERS).build()); - break; - } - } - - Policy updatedPolicy = FULL_POLICY_V3.toBuilder().setBindings(bindings).build(); - assertEquals(2, updatedPolicy.getBindingsList().get(0).getMembers().size()); - } - - @Test - public void addMemberFromPolicy() { - assertEquals(3, FULL_POLICY_V3.getBindingsList().get(0).getMembers().size()); - List bindings = new ArrayList<>(FULL_POLICY_V3.getBindingsList()); - - for (int i = 0; i < bindings.size(); i++) { - Binding binding = bindings.get(i); - if (binding.getRole().equals(VIEWER)) { - bindings.set(i, binding.toBuilder().addMembers("user:example@example.com").build()); - } - } - - Policy updatedPolicy = FULL_POLICY_V3.toBuilder().setBindings(bindings).build(); - assertEquals(4, updatedPolicy.getBindingsList().get(0).getMembers().size()); - } - - @Test - public void removeBindingFromPolicy() { - assertEquals(2, FULL_POLICY_V3.getBindingsList().size()); - List bindings = new ArrayList<>(FULL_POLICY_V3.getBindingsList()); - - Iterator iterator = bindings.iterator(); - while (iterator.hasNext()) { - Binding binding = (Binding) iterator.next(); - if (binding.getRole().equals(EDITOR) && binding.getCondition() == null) { - iterator.remove(); - break; - } - } - - Policy updatedPolicy = FULL_POLICY_V3.toBuilder().setBindings(bindings).build(); - assertEquals(1, updatedPolicy.getBindingsList().size()); - } - - @Test - public void addBindingToPolicy() { - assertEquals(2, FULL_POLICY_V3.getBindingsList().size()); - List bindings = new ArrayList<>(FULL_POLICY_V3.getBindingsList()); - bindings.add(Binding.newBuilder().setRole(OWNER).setMembers(ImmutableList.of(USER)).build()); - Policy updatedPolicy = FULL_POLICY_V3.toBuilder().setBindings(bindings).build(); - assertEquals(3, updatedPolicy.getBindingsList().size()); - } - - @Test - public void testIllegalPolicies() { - try { - Binding.newBuilder().setRole(null).build(); - fail("Null role should cause exception."); - } catch (NullPointerException ex) { - assertEquals("Null role", ex.getMessage()); - } - try { - FULL_POLICY_V3 - .toBuilder() - .setBindings( - Arrays.asList( - Binding.newBuilder() - .setRole("test") - .setMembers(Arrays.asList(null, "user")) - .build())) - .build(); - fail("Null member should cause exception."); - } catch (NullPointerException ex) { - assertEquals("at index 0", ex.getMessage()); - } - try { - FULL_POLICY_V3.getBindings(); - fail("getBindings() should cause exception with Policy V3."); - } catch (IllegalArgumentException ex) { - assertEquals( - "getBindings() is only supported with version 1 policies and non-conditional policies", - ex.getMessage()); - } - try { - FULL_POLICY_V3.toBuilder().addIdentity(Role.editor(), Identity.allUsers()); - fail("getBindings() should cause exception with Policy V3."); - } catch (IllegalArgumentException ex) { - assertEquals( - "addIdentity() is only supported with version 1 policies and non-conditional policies", - ex.getMessage()); - } - try { - FULL_POLICY_V3.toBuilder().removeIdentity(Role.editor(), Identity.allUsers()); - fail("getBindings() should cause exception with Policy V3."); - } catch (IllegalArgumentException ex) { - assertEquals( - "removeIdentity() is only supported with version 1 policies and non-conditional policies", - ex.getMessage()); - } - try { - FULL_POLICY_V3.toBuilder().setBindings(FULL_POLICY_V1.getBindings()); - fail("getBindings() should cause exception with Policy V3."); - } catch (IllegalArgumentException ex) { - assertEquals( - "setBindings() is only supported with version 1 policies and non-conditional policies", - ex.getMessage()); - } - } - - @Test - public void testEqualsHashCode() { - assertNotNull(FULL_POLICY_V3); - Policy emptyPolicy = Policy.newBuilder().build(); - Policy anotherPolicy = Policy.newBuilder().build(); - assertEquals(emptyPolicy, anotherPolicy); - assertEquals(emptyPolicy.hashCode(), anotherPolicy.hashCode()); - assertNotEquals(FULL_POLICY_V3, FULL_POLICY_V1); - assertNotEquals(FULL_POLICY_V3.hashCode(), FULL_POLICY_V1.hashCode()); - Policy copy = FULL_POLICY_V1.toBuilder().build(); - assertEquals(FULL_POLICY_V1, copy); - assertEquals(FULL_POLICY_V1.hashCode(), copy.hashCode()); - } - - @Test - public void testBindings() { - assertTrue(Policy.newBuilder().build().getBindingsList().isEmpty()); - assertEquals(BINDINGS_WITH_CONDITIONS, FULL_POLICY_V3.getBindingsList()); - } - - @Test - public void testEtag() { - assertNotNull(FULL_POLICY_V3.getEtag()); - assertEquals("etag", FULL_POLICY_V3.getEtag()); - } - - @Test - public void testVersion() { - assertEquals(1, FULL_POLICY_V1.getVersion()); - assertEquals(3, FULL_POLICY_V3.getVersion()); - assertEquals(1, FULL_POLICY_V3_WITH_VERSION_1.getVersion()); - } - - @Test - public void testDefaultMarshaller() { - DefaultMarshaller marshaller = new DefaultMarshaller(); - Policy emptyPolicy = Policy.newBuilder().build(); - assertEquals(emptyPolicy, marshaller.fromPb(marshaller.toPb(emptyPolicy))); - assertEquals(FULL_POLICY_V3, marshaller.fromPb(marshaller.toPb(FULL_POLICY_V3))); - assertEquals(FULL_POLICY_V1, marshaller.fromPb(marshaller.toPb(FULL_POLICY_V1))); - com.google.iam.v1.Policy policyPb = com.google.iam.v1.Policy.getDefaultInstance(); - Policy policy = marshaller.fromPb(policyPb); - assertTrue(policy.getBindingsList().isEmpty()); - assertNull(policy.getEtag()); - assertEquals(0, policy.getVersion()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/RetryOptionTest.java b/google-cloud-core/src/test/java/com/google/cloud/RetryOptionTest.java deleted file mode 100644 index ebea89f2fc..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/RetryOptionTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2016 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; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import com.google.api.gax.retrying.RetrySettings; -import org.junit.Test; -import org.threeten.bp.Duration; - -public class RetryOptionTest { - - private static final RetryOption TOTAL_TIMEOUT = - RetryOption.totalTimeout(Duration.ofMillis(420L)); - private static final RetryOption INITIAL_RETRY_DELAY = - RetryOption.initialRetryDelay(Duration.ofMillis(42L)); - private static final RetryOption RETRY_DELAY_MULTIPLIER = RetryOption.retryDelayMultiplier(1.5); - private static final RetryOption MAX_RETRY_DELAY = - RetryOption.maxRetryDelay(Duration.ofMillis(100)); - private static final RetryOption MAX_ATTEMPTS = RetryOption.maxAttempts(100); - private static final RetryOption JITTERED = RetryOption.jittered(false); - - private static final RetrySettings retrySettings = - RetrySettings.newBuilder() - .setTotalTimeout(Duration.ofMillis(420L)) - .setInitialRetryDelay(Duration.ofMillis(42L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(100)) - .setMaxAttempts(100) - .setJittered(false) - .build(); - - @Test - public void testEqualsAndHashCode() { - assertEquals(TOTAL_TIMEOUT, TOTAL_TIMEOUT); - assertEquals(INITIAL_RETRY_DELAY, INITIAL_RETRY_DELAY); - assertEquals(RETRY_DELAY_MULTIPLIER, RETRY_DELAY_MULTIPLIER); - assertEquals(MAX_RETRY_DELAY, MAX_RETRY_DELAY); - assertEquals(MAX_ATTEMPTS, MAX_ATTEMPTS); - assertEquals(JITTERED, JITTERED); - - assertNotEquals(TOTAL_TIMEOUT, JITTERED); - assertNotEquals(INITIAL_RETRY_DELAY, TOTAL_TIMEOUT); - assertNotEquals(RETRY_DELAY_MULTIPLIER, INITIAL_RETRY_DELAY); - assertNotEquals(MAX_RETRY_DELAY, RETRY_DELAY_MULTIPLIER); - assertNotEquals(MAX_ATTEMPTS, MAX_RETRY_DELAY); - assertNotEquals(JITTERED, MAX_ATTEMPTS); - - RetryOption totalTimeout = RetryOption.totalTimeout(Duration.ofMillis(420L)); - RetryOption initialRetryDelay = RetryOption.initialRetryDelay(Duration.ofMillis(42L)); - RetryOption retryDelayMultiplier = RetryOption.retryDelayMultiplier(1.5); - RetryOption maxRetryDelay = RetryOption.maxRetryDelay(Duration.ofMillis(100)); - RetryOption maxAttempts = RetryOption.maxAttempts(100); - RetryOption jittered = RetryOption.jittered(false); - - assertEquals(TOTAL_TIMEOUT, totalTimeout); - assertEquals(INITIAL_RETRY_DELAY, initialRetryDelay); - assertEquals(RETRY_DELAY_MULTIPLIER, retryDelayMultiplier); - assertEquals(MAX_RETRY_DELAY, maxRetryDelay); - assertEquals(MAX_ATTEMPTS, maxAttempts); - assertEquals(JITTERED, jittered); - - assertEquals(TOTAL_TIMEOUT.hashCode(), totalTimeout.hashCode()); - assertEquals(INITIAL_RETRY_DELAY.hashCode(), initialRetryDelay.hashCode()); - assertEquals(RETRY_DELAY_MULTIPLIER.hashCode(), retryDelayMultiplier.hashCode()); - assertEquals(MAX_RETRY_DELAY.hashCode(), maxRetryDelay.hashCode()); - assertEquals(MAX_ATTEMPTS.hashCode(), maxAttempts.hashCode()); - assertEquals(JITTERED.hashCode(), jittered.hashCode()); - } - - @Test - public void testMergeToSettings() { - RetrySettings defRetrySettings = RetrySettings.newBuilder().build(); - - assertEquals(defRetrySettings, RetryOption.mergeToSettings(defRetrySettings)); - - RetrySettings mergedRetrySettings = - RetryOption.mergeToSettings( - defRetrySettings, - TOTAL_TIMEOUT, - INITIAL_RETRY_DELAY, - RETRY_DELAY_MULTIPLIER, - MAX_RETRY_DELAY, - MAX_ATTEMPTS, - JITTERED); - assertEquals(retrySettings, mergedRetrySettings); - - defRetrySettings = - defRetrySettings.toBuilder().setTotalTimeout(Duration.ofMillis(420L)).build(); - mergedRetrySettings = RetryOption.mergeToSettings(defRetrySettings, TOTAL_TIMEOUT); - assertEquals(defRetrySettings, mergedRetrySettings); - - defRetrySettings = - defRetrySettings.toBuilder().setMaxRetryDelay(Duration.ofMillis(100)).build(); - mergedRetrySettings = RetryOption.mergeToSettings(defRetrySettings, MAX_RETRY_DELAY); - assertEquals(defRetrySettings, mergedRetrySettings); - - defRetrySettings = - defRetrySettings.toBuilder().setInitialRetryDelay(Duration.ofMillis(42L)).build(); - mergedRetrySettings = RetryOption.mergeToSettings(defRetrySettings, INITIAL_RETRY_DELAY); - assertEquals(defRetrySettings, mergedRetrySettings); - - defRetrySettings = defRetrySettings.toBuilder().setRetryDelayMultiplier(1.5).build(); - mergedRetrySettings = RetryOption.mergeToSettings(defRetrySettings, RETRY_DELAY_MULTIPLIER); - assertEquals(defRetrySettings, mergedRetrySettings); - - defRetrySettings = defRetrySettings.toBuilder().setMaxAttempts(100).build(); - mergedRetrySettings = RetryOption.mergeToSettings(defRetrySettings, MAX_ATTEMPTS); - assertEquals(defRetrySettings, mergedRetrySettings); - - defRetrySettings = defRetrySettings.toBuilder().setJittered(false).build(); - mergedRetrySettings = RetryOption.mergeToSettings(defRetrySettings, JITTERED); - assertEquals(defRetrySettings, mergedRetrySettings); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/RoleTest.java b/google-cloud-core/src/test/java/com/google/cloud/RoleTest.java deleted file mode 100644 index d6fcdf8441..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/RoleTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2016 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; - -import static com.google.common.truth.Truth.assertThat; - -import org.junit.Test; - -public class RoleTest { - - private static final Role VIEWER = Role.of("viewer"); - private static final Role EDITOR = Role.of("editor"); - private static final Role OWNER = Role.of("owner"); - - @Test - public void testOf() { - assertThat(VIEWER.getValue()).isEqualTo("roles/viewer"); - assertThat(EDITOR.getValue()).isEqualTo("roles/editor"); - assertThat(OWNER.getValue()).isEqualTo("roles/owner"); - compareRoles(VIEWER, Role.of("roles/viewer")); - compareRoles(EDITOR, Role.of("roles/editor")); - compareRoles(OWNER, Role.of("roles/owner")); - - String customRole = "projects/foo/roles/bar"; - assertThat(Role.of(customRole).getValue()).isEqualTo(customRole); - } - - @Test - public void testViewer() { - assertThat(Role.viewer().getValue()).isEqualTo("roles/viewer"); - } - - @Test - public void testEditor() { - assertThat(Role.editor().getValue()).isEqualTo("roles/editor"); - } - - @Test - public void testOwner() { - assertThat(Role.owner().getValue()).isEqualTo("roles/owner"); - } - - @Test(expected = NullPointerException.class) - public void testOfNullValue() { - Role.of(null); - } - - private void compareRoles(Role expected, Role actual) { - assertThat(actual).isEqualTo(expected); - assertThat(actual.getValue()).isEqualTo(expected.getValue()); - assertThat(actual.hashCode()).isEqualTo(expected.hashCode()); - assertThat(actual.toString()).isEqualTo(expected.toString()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/SerializationTest.java b/google-cloud-core/src/test/java/com/google/cloud/SerializationTest.java deleted file mode 100644 index 6c35c665b5..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/SerializationTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2016 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; - -import com.google.api.gax.retrying.RetrySettings; -import com.google.cloud.BaseServiceException.ExceptionData; -import com.google.cloud.MonitoredResourceDescriptor.LabelDescriptor; -import com.google.cloud.MonitoredResourceDescriptor.LabelDescriptor.ValueType; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import java.io.Serializable; -import org.threeten.bp.Duration; - -public class SerializationTest extends BaseSerializationTest { - - private static final BaseServiceException BASE_SERVICE_EXCEPTION = - new BaseServiceException(ExceptionData.from(42, "message", "reason", false)); - private static final ExceptionHandler EXCEPTION_HANDLER = ExceptionHandler.getDefaultInstance(); - private static final Identity IDENTITY = Identity.allAuthenticatedUsers(); - private static final PageImpl PAGE = - new PageImpl<>(null, "cursor", ImmutableList.of("string1", "string2")); - private static final RetrySettings RETRY_SETTINGS = ServiceOptions.getDefaultRetrySettings(); - private static final Role SOME_ROLE = Role.viewer(); - private static final Policy SOME_IAM_POLICY = Policy.newBuilder().build(); - private static final RetryOption CHECKING_PERIOD = - RetryOption.initialRetryDelay(Duration.ofSeconds(42)); - private static final LabelDescriptor LABEL_DESCRIPTOR = - new LabelDescriptor("project_id", ValueType.STRING, "The project id"); - private static final MonitoredResourceDescriptor MONITORED_RESOURCE_DESCRIPTOR = - MonitoredResourceDescriptor.newBuilder("global") - .setLabels(ImmutableList.of(LABEL_DESCRIPTOR)) - .build(); - private static final MonitoredResource MONITORED_RESOURCE = - MonitoredResource.newBuilder("global") - .setLabels(ImmutableMap.of("project_id", "project")) - .build(); - private static final String JSON_KEY = - "{\n" - + " \"private_key_id\": \"somekeyid\",\n" - + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" - + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" - + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" - + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" - + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" - + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" - + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" - + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" - + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" - + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" - + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" - + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" - + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" - + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" - + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" - + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" - + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" - + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" - + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" - + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" - + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" - + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" - + " \"type\": \"service_account\"\n" - + "}"; - - @Override - protected Serializable[] serializableObjects() { - return new Serializable[] { - BASE_SERVICE_EXCEPTION, - EXCEPTION_HANDLER, - IDENTITY, - PAGE, - RETRY_SETTINGS, - SOME_ROLE, - SOME_IAM_POLICY, - CHECKING_PERIOD, - LABEL_DESCRIPTOR, - MONITORED_RESOURCE_DESCRIPTOR, - MONITORED_RESOURCE - }; - } - - @Override - protected Restorable[] restorableObjects() { - return null; - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/ServiceOptionsTest.java b/google-cloud-core/src/test/java/com/google/cloud/ServiceOptionsTest.java deleted file mode 100644 index bf75fca161..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/ServiceOptionsTest.java +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Copyright 2015 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; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertFalse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.api.client.http.HttpRequest; -import com.google.api.client.http.HttpResponse; -import com.google.api.client.http.HttpTransport; -import com.google.api.client.http.LowLevelHttpRequest; -import com.google.api.client.http.LowLevelHttpResponse; -import com.google.api.client.testing.http.HttpTesting; -import com.google.api.client.testing.http.MockHttpTransport; -import com.google.api.client.testing.http.MockLowLevelHttpRequest; -import com.google.api.client.testing.http.MockLowLevelHttpResponse; -import com.google.api.core.ApiClock; -import com.google.api.core.CurrentMillisClock; -import com.google.auth.oauth2.GoogleCredentials; -import com.google.cloud.spi.ServiceRpcFactory; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; -import com.google.common.io.Files; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; -import org.junit.Test; - -public class ServiceOptionsTest { - private static GoogleCredentials credentials; - private static GoogleCredentials credentialsWithProjectId; - private static GoogleCredentials credentialsWithQuotaProject; - - private static final String JSON_KEY = - "{\n" - + " \"private_key_id\": \"somekeyid\",\n" - + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" - + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" - + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" - + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" - + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" - + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" - + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" - + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" - + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" - + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" - + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" - + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" - + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" - + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" - + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" - + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" - + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" - + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" - + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" - + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" - + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" - + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" - + " \"type\": \"service_account\"\n" - + "}"; - - private static final String JSON_KEY_PROJECT_ID = - "{\n" - + " \"private_key_id\": \"somekeyid\",\n" - + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" - + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" - + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" - + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" - + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" - + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" - + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" - + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" - + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" - + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" - + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" - + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" - + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" - + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" - + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" - + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" - + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" - + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" - + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" - + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" - + " \"project_id\": \"someprojectid\",\n" - + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" - + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" - + " \"type\": \"service_account\"\n" - + "}"; - - private static final String JSON_KEY_QUOTA_PROJECT_ID = - "{\n" - + " \"private_key_id\": \"somekeyid\",\n" - + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" - + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" - + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" - + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" - + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" - + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" - + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" - + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" - + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" - + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" - + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" - + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" - + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" - + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" - + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" - + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" - + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" - + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" - + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" - + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" - + " \"project_id\": \"someprojectid\",\n" - + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" - + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" - + " \"type\": \"service_account\",\n" - + " \"quota_project_id\": \"some-quota-project-id\"\n" - + "}"; - - static { - credentials = loadCredentials(JSON_KEY); - credentialsWithProjectId = loadCredentials(JSON_KEY_PROJECT_ID); - credentialsWithQuotaProject = loadCredentials(JSON_KEY_QUOTA_PROJECT_ID); - } - - static GoogleCredentials loadCredentials(String credentialFile) { - try { - InputStream keyStream = new ByteArrayInputStream(credentialFile.getBytes()); - return GoogleCredentials.fromStream(keyStream); - } catch (IOException e) { - fail("Couldn't create fake JSON credentials."); - } - return null; - } - - private static final ApiClock TEST_CLOCK = new TestClock(); - private static final TestServiceOptions OPTIONS = - TestServiceOptions.newBuilder() - .setCredentials(credentials) - .setClock(TEST_CLOCK) - .setHost("host") - .setProjectId("project-id") - .setRetrySettings(ServiceOptions.getNoRetrySettings()) - .setQuotaProjectId("quota-project-id") - .build(); - private static final TestServiceOptions OPTIONS_NO_CREDENTIALS = - TestServiceOptions.newBuilder() - .setCredentials(NoCredentials.getInstance()) - .setClock(TEST_CLOCK) - .setHost("host") - .setProjectId("project-id") - .setRetrySettings(ServiceOptions.getNoRetrySettings()) - .setQuotaProjectId("quota-project-id") - .build(); - private static final TestServiceOptions DEFAULT_OPTIONS = - TestServiceOptions.newBuilder().setProjectId("project-id").build(); - private static final TestServiceOptions OPTIONS_COPY = OPTIONS.toBuilder().build(); - private static final String LIBRARY_NAME = "gcloud-java"; - private static final Pattern APPLICATION_NAME_PATTERN = Pattern.compile(LIBRARY_NAME + "/.*"); - - private static class TestClock implements ApiClock { - @Override - public long nanoTime() { - return 123_456_789_000_000L; - } - - @Override - public long millisTime() { - return 123_456_789L; - } - } - - interface TestService extends Service {} - - private static class TestServiceImpl extends BaseService - implements TestService { - private TestServiceImpl(TestServiceOptions options) { - super(options); - } - } - - public interface TestServiceFactory extends ServiceFactory {} - - private static class DefaultTestServiceFactory implements TestServiceFactory { - private static final TestServiceFactory INSTANCE = new DefaultTestServiceFactory(); - - @Override - public TestService create(TestServiceOptions options) { - return new TestServiceImpl(options); - } - } - - public interface TestServiceRpcFactory extends ServiceRpcFactory {} - - private static class DefaultTestServiceRpcFactory implements TestServiceRpcFactory { - private static final TestServiceRpcFactory INSTANCE = new DefaultTestServiceRpcFactory(); - - @Override - public TestServiceRpc create(TestServiceOptions options) { - return new DefaultTestServiceRpc(options); - } - } - - private interface TestServiceRpc extends ServiceRpc {} - - private static class DefaultTestServiceRpc implements TestServiceRpc { - DefaultTestServiceRpc(TestServiceOptions options) {} - } - - static class TestServiceOptions extends ServiceOptions { - private static class Builder - extends ServiceOptions.Builder { - private Builder() {} - - private Builder(TestServiceOptions options) { - super(options); - } - - @Override - protected TestServiceOptions build() { - return new TestServiceOptions(this); - } - } - - private TestServiceOptions(Builder builder) { - super( - TestServiceFactory.class, - TestServiceRpcFactory.class, - builder, - new TestServiceDefaults()); - } - - private static class TestServiceDefaults - implements ServiceDefaults { - - @Override - public TestServiceFactory getDefaultServiceFactory() { - return DefaultTestServiceFactory.INSTANCE; - } - - @Override - public TestServiceRpcFactory getDefaultRpcFactory() { - return DefaultTestServiceRpcFactory.INSTANCE; - } - - @Override - public TransportOptions getDefaultTransportOptions() { - return new TransportOptions() {}; - } - } - - @Override - protected Set getScopes() { - return null; - } - - @Override - public Builder toBuilder() { - return new Builder(this); - } - - private static Builder newBuilder() { - return new Builder(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof TestServiceOptions && baseEquals((TestServiceOptions) obj); - } - - @Override - public int hashCode() { - return baseHashCode(); - } - } - - @Test - public void testBuilder() { - assertSame(credentials, OPTIONS.getCredentials()); - assertSame(TEST_CLOCK, OPTIONS.getClock()); - assertEquals("host", OPTIONS.getHost()); - assertEquals("project-id", OPTIONS.getProjectId()); - assertSame(ServiceOptions.getNoRetrySettings(), OPTIONS.getRetrySettings()); - assertSame(CurrentMillisClock.getDefaultClock(), DEFAULT_OPTIONS.getClock()); - assertEquals("https://www.googleapis.com", DEFAULT_OPTIONS.getHost()); - assertSame(ServiceOptions.getDefaultRetrySettings(), DEFAULT_OPTIONS.getRetrySettings()); - } - - @Test - public void testBuilder_quotaProjectServiceOptionTakesPrecedence() { - TestServiceOptions noCredsWithQuotaProject = - TestServiceOptions.newBuilder() - .setCredentials(NoCredentials.getInstance()) - .setProjectId("project-id") - .setQuotaProjectId("quota-project-id") - .build(); - TestServiceOptions quotaProjectCredsWithQuotaProject = - TestServiceOptions.newBuilder() - .setQuotaProjectId("quota-project-id") - .setCredentials(credentialsWithQuotaProject) - .build(); - TestServiceOptions quotaProjectCredsWithQuotaProject2 = - TestServiceOptions.newBuilder() - .setCredentials(credentialsWithQuotaProject) - .setQuotaProjectId("quota-project-id") - .build(); - TestServiceOptions quotaProjectCreds = - TestServiceOptions.newBuilder().setCredentials(credentialsWithQuotaProject).build(); - TestServiceOptions none = - TestServiceOptions.newBuilder() - .setCredentials(NoCredentials.getInstance()) - .setProjectId("project-id") - .build(); - - assertEquals("quota-project-id", noCredsWithQuotaProject.getQuotaProjectId()); - assertEquals("quota-project-id", quotaProjectCredsWithQuotaProject.getQuotaProjectId()); - assertEquals("quota-project-id", quotaProjectCredsWithQuotaProject2.getQuotaProjectId()); - assertEquals("some-quota-project-id", quotaProjectCreds.getQuotaProjectId()); - assertEquals(null, none.getQuotaProjectId()); - } - - @Test - public void testBuilderNoCredentials() { - assertEquals(NoCredentials.getInstance(), OPTIONS_NO_CREDENTIALS.getCredentials()); - assertTrue(NoCredentials.getInstance().equals(OPTIONS_NO_CREDENTIALS.getCredentials())); - assertFalse(NoCredentials.getInstance().equals(OPTIONS.getCredentials())); - assertFalse(NoCredentials.getInstance().equals(null)); - assertSame(TEST_CLOCK, OPTIONS_NO_CREDENTIALS.getClock()); - assertEquals("host", OPTIONS_NO_CREDENTIALS.getHost()); - assertEquals("project-id", OPTIONS_NO_CREDENTIALS.getProjectId()); - assertSame(ServiceOptions.getNoRetrySettings(), OPTIONS_NO_CREDENTIALS.getRetrySettings()); - assertEquals("quota-project-id", OPTIONS.getQuotaProjectId()); - } - - @Test(expected = NullPointerException.class) - public void testBuilderNullCredentials() { - TestServiceOptions.newBuilder().setCredentials(null).build(); - } - - @Test - public void testBuilderServiceAccount_setsProjectId() { - TestServiceOptions options = - TestServiceOptions.newBuilder().setCredentials(credentialsWithProjectId).build(); - assertEquals("someprojectid", options.getProjectId()); - } - - @Test - public void testBuilderServiceAccount_explicitSetProjectIdBefore() { - TestServiceOptions options = - TestServiceOptions.newBuilder() - .setProjectId("override-project-id") - .setCredentials(credentialsWithProjectId) - .build(); - assertEquals("override-project-id", options.getProjectId()); - } - - @Test - public void testBuilderServiceAccount_explicitSetProjectIdAfter() { - TestServiceOptions options = - TestServiceOptions.newBuilder() - .setCredentials(credentialsWithProjectId) - .setProjectId("override-project-id") - .build(); - assertEquals("override-project-id", options.getProjectId()); - } - - @Test - public void testGetProjectIdRequired() { - assertTrue(OPTIONS.projectIdRequired()); - } - - @Test - public void testService() { - assertTrue(OPTIONS.getService() instanceof TestServiceImpl); - } - - @Test - public void testRpc() { - assertTrue(OPTIONS.getRpc() instanceof DefaultTestServiceRpc); - } - - @Test - public void testBaseEquals() { - assertEquals(OPTIONS, OPTIONS_COPY); - assertNotEquals(DEFAULT_OPTIONS, OPTIONS); - } - - @Test - public void testLibraryName() { - assertEquals(LIBRARY_NAME, ServiceOptions.getLibraryName()); - } - - @Test - public void testApplicationName() { - assertTrue(APPLICATION_NAME_PATTERN.matcher(OPTIONS.getApplicationName()).matches()); - } - - @Test - public void testBaseHashCode() { - assertEquals(OPTIONS.hashCode(), OPTIONS_COPY.hashCode()); - assertNotEquals(DEFAULT_OPTIONS.hashCode(), OPTIONS.hashCode()); - } - - @Test - public void testGetServiceAccountProjectId() throws Exception { - File credentialsFile = File.createTempFile("credentials", ".json"); - credentialsFile.deleteOnExit(); - Files.write("{\"project_id\":\"my-project-id\"}".getBytes(), credentialsFile); - - assertEquals( - "my-project-id", - ServiceOptions.getValueFromCredentialsFile(credentialsFile.getPath(), "project_id")); - } - - @Test - public void testGetServiceAccountProjectId_badJson() throws Exception { - File credentialsFile = File.createTempFile("credentials", ".json"); - credentialsFile.deleteOnExit(); - Files.write("asdfghj".getBytes(StandardCharsets.UTF_8), credentialsFile); - - String valueFromCredentialsFile = - ServiceOptions.getValueFromCredentialsFile(credentialsFile.getPath(), "project_id"); - assertNull(valueFromCredentialsFile); - } - - @Test - public void testGetServiceAccountProjectId_nonExistentFile() throws Exception { - File credentialsFile = new File("/doesnotexist"); - - assertNull(ServiceOptions.getValueFromCredentialsFile(credentialsFile.getPath(), "project_id")); - } - - @Test - public void testResponseHeaderContainsMetaDataFlavor() throws Exception { - Multimap headers = ArrayListMultimap.create(); - headers.put("Metadata-Flavor", "Google"); - HttpResponse httpResponse = createHttpResponseWithHeader(headers); - assertThat(ServiceOptions.headerContainsMetadataFlavor(httpResponse)).isTrue(); - } - - @Test - public void testResponseHeaderDoesNotContainMetaDataFlavor() throws Exception { - Multimap headers = ArrayListMultimap.create(); - HttpResponse httpResponse = createHttpResponseWithHeader(headers); - assertThat(ServiceOptions.headerContainsMetadataFlavor(httpResponse)).isFalse(); - } - - private HttpResponse createHttpResponseWithHeader(final Multimap headers) - throws Exception { - HttpTransport mockHttpTransport = - new MockHttpTransport() { - @Override - public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { - return new MockLowLevelHttpRequest() { - @Override - public LowLevelHttpResponse execute() throws IOException { - MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); - for (Map.Entry entry : headers.entries()) { - response.addHeader(entry.getKey(), entry.getValue()); - } - return response; - } - }; - } - }; - HttpRequest request = - mockHttpTransport.createRequestFactory().buildGetRequest(HttpTesting.SIMPLE_GENERIC_URL); - return request.execute(); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/StringEnumTest.java b/google-cloud-core/src/test/java/com/google/cloud/StringEnumTest.java deleted file mode 100644 index 781fbb8925..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/StringEnumTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2017 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; - -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import com.google.api.core.ApiFunction; -import com.google.common.testing.EqualsTester; -import java.util.Arrays; -import org.junit.Assert; -import org.junit.Test; - -public class StringEnumTest { - - public static class Letter extends StringEnumValue { - private static final long serialVersionUID = -1717976087182628526L; - - private Letter(String constant) { - super(constant); - } - - private static final ApiFunction CONSTRUCTOR = - new ApiFunction() { - @Override - public Letter apply(String constant) { - return new Letter(constant); - } - }; - - private static final StringEnumType type = - new StringEnumType(Letter.class, CONSTRUCTOR); - - public static final Letter A = type.createAndRegister("A"); - public static final Letter B = type.createAndRegister("B"); - public static final Letter C = type.createAndRegister("C"); - - public static Letter valueOfStrict(String constant) { - return type.valueOfStrict(constant); - } - - /** Get the StorageClass for the given String constant, and allow unrecognized values. */ - public static Letter valueOf(String constant) { - return type.valueOf(constant); - } - - /** Return the known values for StorageClass. */ - public static Letter[] values() { - return type.values(); - } - } - - @Test(expected = NullPointerException.class) - public void testNullClass() { - new StringEnumType(null, Letter.CONSTRUCTOR); - } - - @Test - public void testNullConstructor() { - try { - new StringEnumType(Letter.class, null); - Assert.fail(); - } catch (NullPointerException ex) { - assertNull(ex.getMessage()); - } - } - - @Test - public void testEnumInstances() { - assertThat(Letter.A.toString()).isEqualTo("A"); - } - - @Test - public void testValueOf() { - assertThat(Letter.valueOf("A")).isSameInstanceAs(Letter.A); - assertThat(Letter.valueOf("B")).isSameInstanceAs(Letter.B); - assertThat(Letter.valueOf("C")).isSameInstanceAs(Letter.C); - assertThat(Letter.valueOf("NonExistentLetter").toString()).isEqualTo("NonExistentLetter"); - } - - @Test - public void testValueOfStrict() { - assertThat(Letter.valueOfStrict("A")).isSameInstanceAs(Letter.A); - assertThat(Letter.valueOfStrict("B")).isSameInstanceAs(Letter.B); - assertThat(Letter.valueOfStrict("C")).isSameInstanceAs(Letter.C); - } - - @Test - public void testEquals() { - new EqualsTester() - .addEqualityGroup(Letter.A, Letter.valueOf("A"), Letter.valueOfStrict("A")) - .addEqualityGroup(Letter.B, Letter.valueOf("B"), Letter.valueOfStrict("B")) - .addEqualityGroup(Letter.C, Letter.valueOf("C"), Letter.valueOfStrict("C")) - .addEqualityGroup(Letter.valueOf("NonExistentLetter"), Letter.valueOf("NonExistentLetter")) - .testEquals(); - } - - @Test - public void testValueOfStrict_invalid() { - try { - Letter.valueOfStrict("NonExistentLetter"); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void testValues() { - assertThat( - Arrays.asList(Letter.values()).containsAll(Arrays.asList(Letter.A, Letter.B, Letter.C))) - .isTrue(); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/TimestampTest.java b/google-cloud-core/src/test/java/com/google/cloud/TimestampTest.java deleted file mode 100644 index 5eaeb0a894..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/TimestampTest.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 2017 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; - -import static com.google.common.testing.SerializableTester.reserializeAndAssert; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import com.google.common.testing.EqualsTester; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; -import java.util.concurrent.TimeUnit; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Unit tests for {@link com.google.cloud.Timestamp}. */ -@RunWith(JUnit4.class) -public class TimestampTest { - private static final String TEST_TIME_ISO = "2015-10-12T15:14:54Z"; - private static final long TEST_TIME_SECONDS = 1444662894L; - private static final long TEST_TIME_MICROSECONDS = 10000100L; - private static final long TEST_TIME_MILLISECONDS = - TimeUnit.SECONDS.toMillis(1444662894L) + TimeUnit.MICROSECONDS.toMillis(1234); - private static final long TEST_TIME_MILLISECONDS_NEGATIVE = -1000L; - private static final Date TEST_DATE = new Date(TEST_TIME_MILLISECONDS); - private static final Date TEST_DATE_PRE_EPOCH = new Date(TEST_TIME_MILLISECONDS_NEGATIVE); - - @Test - public void minValue() { - // MIN_VALUE is before the start of the Gregorian calendar... use magic value. - assertThat(Timestamp.MIN_VALUE.getSeconds()).isEqualTo(-62135596800L); - assertThat(Timestamp.MIN_VALUE.getNanos()).isEqualTo(0); - } - - @Test - public void maxValue() { - TimeZone tz = TimeZone.getTimeZone("UTC"); - GregorianCalendar calendar = new GregorianCalendar(tz); - calendar.set(9999, Calendar.DECEMBER, 31, 23, 59, 59); - java.sql.Timestamp expectedMin = new java.sql.Timestamp(calendar.getTimeInMillis()); - expectedMin.setNanos(999999999); - - assertThat(Timestamp.MAX_VALUE.getSeconds()).isEqualTo(calendar.getTimeInMillis() / 1000L); - assertThat(Timestamp.MAX_VALUE.getNanos()).isEqualTo(999999999); - } - - @Test - public void ofMicroseconds() { - Timestamp timestamp = Timestamp.ofTimeMicroseconds(TEST_TIME_MICROSECONDS); - assertThat(timestamp.getSeconds()).isEqualTo(TEST_TIME_MICROSECONDS / 1000000L); - assertThat(timestamp.getNanos()).isEqualTo(TEST_TIME_MICROSECONDS % 1000000L * 1000); - } - - @Test - public void ofDate() { - Timestamp timestamp = Timestamp.of(TEST_DATE); - Long expectedSeconds = TimeUnit.MILLISECONDS.toSeconds(TEST_TIME_MILLISECONDS); - Long expectedNanos = - TimeUnit.MILLISECONDS.toNanos(TEST_TIME_MILLISECONDS) - - TimeUnit.SECONDS.toNanos(expectedSeconds); - assertThat(timestamp.getSeconds()).isEqualTo(expectedSeconds); - assertThat(timestamp.getNanos()).isEqualTo(expectedNanos); - } - - @Test - public void testOf() { - String expectedTimestampString = "1970-01-01T00:00:12.345000000Z"; - java.sql.Timestamp input = new java.sql.Timestamp(12345); - Timestamp timestamp = Timestamp.of(input); - assertEquals(timestamp.toString(), expectedTimestampString); - } - - @Test - public void testOf_exactSecond() { - String expectedTimestampString = "1970-01-01T00:00:12Z"; - java.sql.Timestamp input = new java.sql.Timestamp(12000); - Timestamp timestamp = Timestamp.of(input); - assertEquals(timestamp.toString(), expectedTimestampString); - } - - @Test - public void testOf_preEpoch() { - String expectedTimestampString = "1969-12-31T23:59:47.655000000Z"; - java.sql.Timestamp input = new java.sql.Timestamp(-12345); - Timestamp timestamp = Timestamp.of(input); - assertEquals(timestamp.toString(), expectedTimestampString); - } - - @Test - public void testOf_onEpoch() { - String expectedTimestampString = "1970-01-01T00:00:00Z"; - java.sql.Timestamp input = new java.sql.Timestamp(0); - Timestamp timestamp = Timestamp.of(input); - assertEquals(timestamp.toString(), expectedTimestampString); - } - - @Test - public void testOf_preEpochExactSecond() { - String expectedTimestampString = "1969-12-31T23:59:59Z"; - java.sql.Timestamp input = new java.sql.Timestamp(-1000); - Timestamp timestamp = Timestamp.of(input); - assertEquals(timestamp.toString(), expectedTimestampString); - } - - @Test - public void ofDatePreEpoch() { - Timestamp timestamp = Timestamp.of(TEST_DATE_PRE_EPOCH); - long expectedSeconds = TEST_TIME_MILLISECONDS_NEGATIVE / 1_000; - int expectedNanos = (int) (TEST_TIME_MILLISECONDS_NEGATIVE % 1_000 * 1000_000); - if (expectedNanos < 0) { - expectedSeconds--; - expectedNanos += 1_000_000_000; - } - assertThat(timestamp.getSeconds()).isEqualTo(expectedSeconds); - assertThat(timestamp.getNanos()).isEqualTo(expectedNanos); - } - - @Test - public void toDate() { - Timestamp timestamp = Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 1234 * 1000); - Date date = timestamp.toDate(); - assertThat(TEST_TIME_MILLISECONDS).isEqualTo(date.getTime()); - } - - @Test - public void toFromSqlTimestamp() { - long seconds = TEST_TIME_SECONDS; - int nanos = 500000000; - - java.sql.Timestamp sqlTs = new java.sql.Timestamp(seconds * 1000); - sqlTs.setNanos(nanos); - - Timestamp ts = Timestamp.of(sqlTs); - assertThat(ts.getSeconds()).isEqualTo(seconds); - assertThat(ts.getNanos()).isEqualTo(nanos); - - assertThat(ts.toSqlTimestamp()).isEqualTo(sqlTs); - } - - @Test - public void boundsSecondsMin() { - try { - Timestamp.ofTimeSecondsAndNanos(Timestamp.MIN_VALUE.getSeconds() - 1, 999999999); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void boundsSecondsMax() { - try { - Timestamp.ofTimeSecondsAndNanos(Timestamp.MAX_VALUE.getSeconds() + 1, 0); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void boundsNanosMin() { - try { - Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, -1); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void boundsNanosMax() { - try { - Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 1000000000); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void boundsSqlTimestampMin() { - try { - Timestamp.of(new java.sql.Timestamp((Timestamp.MIN_VALUE.getSeconds() - 1) * 1000)); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void boundsSqlTimestampMax() { - try { - Timestamp.of(new java.sql.Timestamp((Timestamp.MAX_VALUE.getSeconds() + 1) * 1000)); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void equalsAndHashCode() { - EqualsTester tester = new EqualsTester(); - tester.addEqualityGroup( - Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0), - Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0), - Timestamp.of(new java.sql.Timestamp(TEST_TIME_SECONDS * 1000))); - tester.addEqualityGroup(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS + 1, 0)); - tester.addEqualityGroup(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 1)); - tester.testEquals(); - } - - @Test - public void testToString() { - assertThat(Timestamp.MIN_VALUE.toString()).isEqualTo("0001-01-01T00:00:00Z"); - assertThat(Timestamp.MAX_VALUE.toString()).isEqualTo("9999-12-31T23:59:59.999999999Z"); - assertThat(Timestamp.ofTimeSecondsAndNanos(0, 0).toString()).isEqualTo("1970-01-01T00:00:00Z"); - assertThat(Timestamp.ofTimeSecondsAndNanos(0, 100).toString()) - .isEqualTo("1970-01-01T00:00:00.000000100Z"); - assertThat(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0).toString()) - .isEqualTo(TEST_TIME_ISO); - } - - @Test - public void parseTimestamp() { - assertThat(Timestamp.parseTimestamp("0001-01-01T00:00:00Z")).isEqualTo(Timestamp.MIN_VALUE); - assertThat(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999Z")) - .isEqualTo(Timestamp.MAX_VALUE); - assertThat(Timestamp.parseTimestamp(TEST_TIME_ISO)) - .isEqualTo(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0)); - } - - @Test - public void parseTimestampWithoutTimeZoneOffset() { - assertThat(Timestamp.parseTimestamp("0001-01-01T00:00:00")).isEqualTo(Timestamp.MIN_VALUE); - assertThat(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999")) - .isEqualTo(Timestamp.MAX_VALUE); - assertThat(Timestamp.parseTimestamp("2015-10-12T15:14:54")) - .isEqualTo(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0)); - } - - @Test - public void parseTimestampWithTimeZoneOffset() { - assertThat(Timestamp.parseTimestamp("0001-01-01T00:00:00-00:00")) - .isEqualTo(Timestamp.MIN_VALUE); - assertThat(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999-00:00")) - .isEqualTo(Timestamp.MAX_VALUE); - assertThat(Timestamp.parseTimestamp("2020-12-06T19:21:12.123+05:30")) - .isEqualTo(Timestamp.ofTimeSecondsAndNanos(1607262672, 123000000)); - assertThat(Timestamp.parseTimestamp("2020-07-10T14:03:00-07:00")) - .isEqualTo(Timestamp.ofTimeSecondsAndNanos(1594414980, 0)); - } - - @Test - public void fromProto() { - com.google.protobuf.Timestamp proto = - com.google.protobuf.Timestamp.newBuilder().setSeconds(1234).setNanos(567).build(); - Timestamp timestamp = Timestamp.fromProto(proto); - assertThat(timestamp.getSeconds()).isEqualTo(1234); - assertThat(timestamp.getNanos()).isEqualTo(567); - } - - @Test - public void comparable() { - assertThat(Timestamp.MIN_VALUE).isLessThan(Timestamp.MAX_VALUE); - assertThat(Timestamp.MAX_VALUE).isGreaterThan(Timestamp.MIN_VALUE); - - assertThat(Timestamp.ofTimeSecondsAndNanos(100, 0)) - .isAtLeast(Timestamp.ofTimeSecondsAndNanos(100, 0)); - assertThat(Timestamp.ofTimeSecondsAndNanos(100, 0)) - .isAtMost(Timestamp.ofTimeSecondsAndNanos(100, 0)); - - assertThat(Timestamp.ofTimeSecondsAndNanos(100, 1000)) - .isLessThan(Timestamp.ofTimeSecondsAndNanos(101, 0)); - assertThat(Timestamp.ofTimeSecondsAndNanos(100, 1000)) - .isAtMost(Timestamp.ofTimeSecondsAndNanos(101, 0)); - - assertThat(Timestamp.ofTimeSecondsAndNanos(101, 0)) - .isGreaterThan(Timestamp.ofTimeSecondsAndNanos(100, 1000)); - assertThat(Timestamp.ofTimeSecondsAndNanos(101, 0)) - .isAtLeast(Timestamp.ofTimeSecondsAndNanos(100, 1000)); - } - - @Test - public void serialization() throws Exception { - reserializeAndAssert(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999Z")); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/BaseEmulatorHelperTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/BaseEmulatorHelperTest.java deleted file mode 100644 index b002a6198b..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/BaseEmulatorHelperTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import com.google.api.client.util.Charsets; -import com.google.cloud.ServiceOptions; -import com.google.cloud.testing.BaseEmulatorHelper.EmulatorRunner; -import com.google.common.collect.ImmutableList; -import java.io.ByteArrayInputStream; -import java.io.EOFException; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; -import java.util.List; -import java.util.concurrent.TimeoutException; -import java.util.logging.Logger; -import org.easymock.EasyMock; -import org.junit.Test; -import org.threeten.bp.Duration; - -public class BaseEmulatorHelperTest { - - private static final String BLOCK_UNTIL = "Block until"; - - private static class TestEmulatorHelper extends BaseEmulatorHelper { - - private final List runners; - private final String blockUntil; - - private TestEmulatorHelper(List runners, String blockUntil) { - super("emulator", 1, "project"); - this.runners = runners; - this.blockUntil = blockUntil; - } - - @Override - protected List getEmulatorRunners() { - return runners; - } - - @Override - protected Logger getLogger() { - return null; - } - - @Override - public ServiceOptions getOptions() { - return null; - } - - @Override - public void start() throws IOException, InterruptedException { - startProcess(blockUntil); - } - - @Override - public void stop(Duration timeout) throws IOException, InterruptedException, TimeoutException { - waitForProcess(timeout); - } - - @Override - public void reset() throws IOException { - // do nothing - } - } - - @Test - public void testEmulatorHelper() throws IOException, InterruptedException, TimeoutException { - Process process = EasyMock.createStrictMock(Process.class); - InputStream stream = new ByteArrayInputStream(BLOCK_UNTIL.getBytes(Charsets.UTF_8)); - EmulatorRunner emulatorRunner = EasyMock.createStrictMock(EmulatorRunner.class); - EasyMock.expect(process.getInputStream()).andReturn(stream); - EasyMock.expect(emulatorRunner.isAvailable()).andReturn(true); - emulatorRunner.start(); - EasyMock.expectLastCall(); - EasyMock.expect(emulatorRunner.getProcess()).andReturn(process); - emulatorRunner.waitFor(Duration.ofMinutes(1)); - EasyMock.expectLastCall().andReturn(0); - EasyMock.replay(process, emulatorRunner); - TestEmulatorHelper helper = - new TestEmulatorHelper(ImmutableList.of(emulatorRunner), BLOCK_UNTIL); - helper.start(); - helper.stop(Duration.ofMinutes(1)); - EasyMock.verify(); - } - - @Test - public void testEmulatorHelperDownloadWithRetries() - throws IOException, InterruptedException, TimeoutException { - String mockExternalForm = "mockExternalForm"; - String mockInputStream = "mockInputStream"; - String mockProtocol = "mockProtocol"; - String mockFile = "mockFile"; - String mockAccessToken = "mockAccessToken"; - String mockCommandText = "mockCommandText"; - - MockURLStreamHandler mockURLStreamHandler = EasyMock.createMock(MockURLStreamHandler.class); - URLConnection mockURLConnection = EasyMock.mock(URLConnection.class); - - EasyMock.expect(mockURLStreamHandler.toExternalForm(EasyMock.anyObject(URL.class))) - .andReturn(mockExternalForm) - .anyTimes(); - EasyMock.expect(mockURLConnection.getInputStream()) - .andReturn(new ByteArrayInputStream(mockInputStream.getBytes())) - .anyTimes(); - mockURLConnection.setRequestProperty("Authorization", "Bearer " + mockAccessToken); - EasyMock.expect(mockURLStreamHandler.openConnection(EasyMock.anyObject(URL.class))) - .andThrow(new EOFException()) - .times(1); - EasyMock.expect(mockURLStreamHandler.openConnection(EasyMock.anyObject(URL.class))) - .andReturn(mockURLConnection) - .times(1); - EasyMock.replay(mockURLStreamHandler, mockURLConnection); - - URL url = new URL(mockProtocol, null, 0, mockFile, mockURLStreamHandler); - BaseEmulatorHelper.DownloadableEmulatorRunner runner = - new BaseEmulatorHelper.DownloadableEmulatorRunner( - ImmutableList.of(mockCommandText), url, null, mockAccessToken); - - File cachedFile = new File(System.getProperty("java.io.tmpdir"), mockExternalForm); - cachedFile.delete(); // Clear the cached version so we're always testing the download - - runner.start(); - - EasyMock.verify(); - - cachedFile.delete(); // Cleanup - } - - @Test - public void testEmulatorHelperMultipleRunners() - throws IOException, InterruptedException, TimeoutException { - Process process = EasyMock.createStrictMock(Process.class); - InputStream stream = new ByteArrayInputStream(BLOCK_UNTIL.getBytes(Charsets.UTF_8)); - EmulatorRunner firstRunner = EasyMock.createStrictMock(EmulatorRunner.class); - EmulatorRunner secondRunner = EasyMock.createStrictMock(EmulatorRunner.class); - EasyMock.expect(process.getInputStream()).andReturn(stream); - EasyMock.expect(firstRunner.isAvailable()).andReturn(false); - EasyMock.expect(secondRunner.isAvailable()).andReturn(true); - secondRunner.start(); - EasyMock.expectLastCall(); - EasyMock.expect(secondRunner.getProcess()).andReturn(process); - secondRunner.waitFor(Duration.ofMinutes(1)); - EasyMock.expectLastCall().andReturn(0); - EasyMock.replay(process, secondRunner); - TestEmulatorHelper helper = - new TestEmulatorHelper(ImmutableList.of(firstRunner, secondRunner), BLOCK_UNTIL); - helper.start(); - helper.stop(Duration.ofMinutes(1)); - EasyMock.verify(); - } - - /** - * URLStreamHandler has a protected method which needs to be mocked, so we need our own - * implementation in this package - */ - private class MockURLStreamHandler extends URLStreamHandler { - @Override - protected URLConnection openConnection(URL u) throws IOException { - return null; - } - - @Override - protected String toExternalForm(URL u) { - return null; - } - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java deleted file mode 100644 index 56b406f963..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import static org.junit.Assert.assertEquals; - -import com.google.api.client.util.Charsets; -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Multimap; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.Timeout; - -public class BlockingProcessStreamReaderTest { - - private static final String BLOCK_UNTIL = "Dev App Server is now running"; - private static final String OUTPUT = "First Line\n" + "Second Line\n" + BLOCK_UNTIL; - private static final String OUTPUT_WITH_LOGS = - "First Line\n" - + BLOCK_UNTIL - + "\n" - + "Nov 08, 2016 2:05:44 PM io.netty.buffer.PooledByteBufAllocator \n" - + "INFO: log line 1\n" - + "log line 2\n" - + "Nov 08, 2016 2:05:44 PM io.netty.buffer.PooledByteBufAllocator \n" - + "FINE: log line 3\n"; - private static final String TAGGED_OUTPUT_WITH_LOGS = - "[emulator] First Line\n" - + "[emulator]" - + BLOCK_UNTIL - + "\n" - + "[emulator] Nov 08, 2016 2:05:44 PM io.netty.buffer.PooledByteBufAllocator \n" - + "[emulator] INFO: log line 1\n" - + "[emulator] log line 2\n" - + "[emulator] Nov 08, 2016 2:05:44 PM io.netty.buffer.PooledByteBufAllocator \n" - + "[emulator] FINE: log line 3\n"; - - @Rule public Timeout globalTimeout = Timeout.seconds(10); - - private static final class TestLogger extends Logger { - - private final Multimap logs = LinkedHashMultimap.create(); - - private TestLogger() { - super("text-logger", null); - } - - public void log(Level level, String msg) { - logs.put(level, msg); - } - - Multimap getLogs() { - return logs; - } - } - - @Test - public void testForwardLogEntry() throws IOException, InterruptedException { - TestLogger logger = new TestLogger(); - InputStream stream = new ByteArrayInputStream(OUTPUT_WITH_LOGS.getBytes(Charsets.UTF_8)); - BlockingProcessStreamReader.start("emulator", stream, BLOCK_UNTIL, logger).join(); - assertEquals( - "[emulator] log line 1" + System.lineSeparator() + "[emulator] log line 2", - logger.getLogs().get(Level.INFO).iterator().next()); - assertEquals("[emulator] log line 3", logger.getLogs().get(Level.FINE).iterator().next()); - stream.close(); - } - - @Test - public void testForwardAlreadyTaggedLogs() throws IOException, InterruptedException { - TestLogger logger = new TestLogger(); - InputStream stream = new ByteArrayInputStream(TAGGED_OUTPUT_WITH_LOGS.getBytes(Charsets.UTF_8)); - BlockingProcessStreamReader.start("emulator", stream, BLOCK_UNTIL, logger).join(); - assertEquals( - "[emulator] log line 1" + System.lineSeparator() + "[emulator] log line 2", - logger.getLogs().get(Level.INFO).iterator().next()); - assertEquals("[emulator] log line 3", logger.getLogs().get(Level.FINE).iterator().next()); - stream.close(); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/CommandWrapperTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/CommandWrapperTest.java deleted file mode 100644 index 88b246c754..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/CommandWrapperTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import com.google.common.collect.ImmutableList; -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import org.junit.Test; - -public class CommandWrapperTest { - - private static final List COMMAND = ImmutableList.of("my", "command"); - private static final List WIN_COMMAND = ImmutableList.of("cmd", "/C", "my", "command"); - private static final List UNIX_COMMAND = ImmutableList.of("bash", "my", "command"); - private static final Path DIRECTORY = Paths.get("my-path"); - private static final File WIN_NULL_FILE = new File("NUL:"); - private static final File UNIX_NULL_FILE = new File("/dev/null"); - - @Test - public void testCommandWrapperCommand() { - CommandWrapper commandWrapper = CommandWrapper.create(); - commandWrapper.setCommand(COMMAND); - ProcessBuilder processBuilder = commandWrapper.getBuilder(); - if (BaseEmulatorHelper.isWindows()) { - assertEquals(WIN_COMMAND, processBuilder.command()); - } else { - assertEquals(UNIX_COMMAND, processBuilder.command()); - } - assertNull(processBuilder.directory()); - assertFalse(processBuilder.redirectErrorStream()); - assertEquals(ProcessBuilder.Redirect.PIPE, processBuilder.redirectError()); - } - - @Test - public void testCommandWrapperRedirectErrorStream() { - CommandWrapper commandWrapper = CommandWrapper.create(); - commandWrapper.setCommand(COMMAND); - commandWrapper.setRedirectErrorStream(); - ProcessBuilder processBuilder = commandWrapper.getBuilder(); - if (BaseEmulatorHelper.isWindows()) { - assertEquals(WIN_COMMAND, processBuilder.command()); - } else { - assertEquals(UNIX_COMMAND, processBuilder.command()); - } - assertNull(processBuilder.directory()); - assertTrue(processBuilder.redirectErrorStream()); - assertEquals(ProcessBuilder.Redirect.PIPE, processBuilder.redirectError()); - } - - @Test - public void testCommandWrapperRedirectErrorInherit() { - CommandWrapper commandWrapper = CommandWrapper.create(); - commandWrapper.setCommand(COMMAND); - commandWrapper.setRedirectErrorInherit(); - ProcessBuilder processBuilder = commandWrapper.getBuilder(); - if (BaseEmulatorHelper.isWindows()) { - assertEquals(WIN_COMMAND, processBuilder.command()); - } else { - assertEquals(UNIX_COMMAND, processBuilder.command()); - } - assertNull(processBuilder.directory()); - assertFalse(processBuilder.redirectErrorStream()); - assertEquals(ProcessBuilder.Redirect.INHERIT, processBuilder.redirectError()); - } - - @Test - public void testCommandWrapperDirectory() { - CommandWrapper commandWrapper = CommandWrapper.create(); - commandWrapper.setCommand(COMMAND); - commandWrapper.setDirectory(DIRECTORY); - ProcessBuilder processBuilder = commandWrapper.getBuilder(); - if (BaseEmulatorHelper.isWindows()) { - assertEquals(WIN_COMMAND, processBuilder.command()); - } else { - assertEquals(UNIX_COMMAND, processBuilder.command()); - } - assertEquals(DIRECTORY, processBuilder.directory().toPath()); - assertFalse(processBuilder.redirectErrorStream()); - assertEquals(ProcessBuilder.Redirect.PIPE, processBuilder.redirectError()); - } - - @Test - public void testCommandWrapperRedirectOutputToNull() { - CommandWrapper commandWrapper = CommandWrapper.create(); - commandWrapper.setCommand(COMMAND); - commandWrapper.setRedirectOutputToNull(); - ProcessBuilder processBuilder = commandWrapper.getBuilder(); - if (BaseEmulatorHelper.isWindows()) { - assertEquals(WIN_COMMAND, processBuilder.command()); - assertEquals(ProcessBuilder.Redirect.to(WIN_NULL_FILE), processBuilder.redirectOutput()); - } else { - assertEquals(UNIX_COMMAND, processBuilder.command()); - assertEquals(ProcessBuilder.Redirect.to(UNIX_NULL_FILE), processBuilder.redirectOutput()); - } - assertNull(processBuilder.directory()); - assertFalse(processBuilder.redirectErrorStream()); - assertEquals(ProcessBuilder.Redirect.PIPE, processBuilder.redirectError()); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/VersionTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/VersionTest.java deleted file mode 100644 index fe65026b60..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/VersionTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2016 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.testing; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Assert; -import org.junit.Test; - -public class VersionTest { - - @Test - public void testFromString() { - Version version = Version.fromString("2016.01.13"); - assertEquals(2016, version.getMajor()); - assertEquals(1, version.getMinor()); - assertEquals(13, version.getPatch()); - version = Version.fromString("1.2.0"); - assertEquals(1, version.getMajor()); - assertEquals(2, version.getMinor()); - assertEquals(0, version.getPatch()); - } - - @Test - public void testFromStringWithAlphas() { - try { - Version.fromString("2016.01.hello"); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void testFromStringMissingPatch() { - try { - Version.fromString("2016.01"); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void testFromStringMissingMinor() { - try { - Version.fromString("2016"); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void testFromStringEmpty() { - try { - Version.fromString(""); - Assert.fail(); - } catch (IllegalArgumentException ex) { - assertNotNull(ex.getMessage()); - } - } - - @Test - public void testFromStringNull() { - try { - Version.fromString(null); - Assert.fail(); - } catch (NullPointerException ex) { - assertNull(ex.getMessage()); - } - } - - @Test - public void testCompare() { - Version version = Version.fromString("2016.01.13"); - Version sameVersion = Version.fromString("2016.01.13"); - Version olderVersion = Version.fromString("2015.12.01"); - Version newerVersion = Version.fromString("2016.08.12"); - assertEquals(0, version.compareTo(sameVersion)); - assertTrue(version.compareTo(olderVersion) > 0); - assertTrue(version.compareTo(newerVersion) < 0); - Version otherVersion = Version.fromString("1.2.0"); - assertTrue(version.compareTo(otherVersion) > 0); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/MultipleAttemptsRule.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/MultipleAttemptsRule.java deleted file mode 100644 index 86fd82c7b9..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/MultipleAttemptsRule.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.ArrayList; -import java.util.List; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.MultipleFailureException; -import org.junit.runners.model.Statement; - -/** - * A JUnit rule that allows multiple attempts of a test execution before ultimately reporting - * failure for the test. Attempts will be attempted with an exponential backoff which defaults to a - * starting duration of 1 second. - * - *

If after the maximum number of attempts the test has still not succeeded, all failures will be - * propagated as the result of the test allowing all errors to be visible (regardless if they are - * the same failure or different ones). - * - *

To use this rule add the field declaration to your JUnit 4 Test class: - * - *

Note: It is important that the field is public - * - *

{@code
- * @Rule
- * public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
- * }
- * - * @see org.junit.Rule - */ -public final class MultipleAttemptsRule implements TestRule { - private final long initialBackoffMillis; - private final int maxAttemptCount; - - /** - * Construct a {@link MultipleAttemptsRule} which will attempt a test up to {@code attemptCount} - * times before ultimately reporting failure of the test. - * - *

The initialBackoffMillis will be set to 1000L. - * - * @param maxAttemptCount max number of attempts before reporting failure, must be greater than 0 - * @see #MultipleAttemptsRule(int, long) - */ - public MultipleAttemptsRule(int maxAttemptCount) { - this(maxAttemptCount, 1000L); - } - - /** - * Construct a {@link MultipleAttemptsRule} which will attempt a test up to {@code attemptCount} - * times before ultimately reporting failure of the test. - * - *

The {@code initialBackoffMillis} will be used as the first pause duration before - * reattempting the test. - * - * @param maxAttemptCount max number of attempts before reporting failure, must be greater than 0 - * @param initialBackoffMillis initial duration in millis to wait between attempts, must be - * greater than or equal to 0 - */ - public MultipleAttemptsRule(int maxAttemptCount, long initialBackoffMillis) { - checkArgument(maxAttemptCount > 0, "attemptCount must be > 0"); - checkArgument(initialBackoffMillis >= 0, "initialBackoffMillis must be >= 0"); - this.initialBackoffMillis = initialBackoffMillis; - this.maxAttemptCount = maxAttemptCount; - } - - @Override - public Statement apply(final Statement base, Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - List failures = new ArrayList<>(); - - long retryIntervalMillis = initialBackoffMillis; - - for (int i = 1; i <= maxAttemptCount; i++) { - try { - base.evaluate(); - return; - } catch (Throwable t) { - failures.add(t); - Thread.sleep(retryIntervalMillis); - retryIntervalMillis *= 1.5f; - } - } - - MultipleFailureException.assertEmpty(failures); - } - }; - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdErrCaptureRule.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdErrCaptureRule.java deleted file mode 100644 index 1640d950e3..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdErrCaptureRule.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4; - -import java.io.PrintStream; -import org.junit.Rule; - -/** - * A JUnit rule that allows the capturing stderr (i.e. {@link System#err} during the scope of a - * test. - * - *

Note: If some part of the system holds a reference System.err before this rule is loaded - * into the test lifecycle there is no way for this rule to capture the output. Ensure this rule is - * declared as high in your test file as possible, and ordered using {@link Rule#order()} before - * other Rules if necessary. - * - *

To use this rule add the field declaration to your JUnit 4 Test class: - * - *

Note: It is important that the field is public - * - *

{@code
- * @Rule
- * public StdErrCaptureRule stdErrCaptureRule = new StdErrCaptureRule();
- * }
- * - * @see org.junit.Rule - * @see Rule#order() - */ -public final class StdErrCaptureRule extends StdXCaptureRule { - - public StdErrCaptureRule() {} - - @Override - protected PrintStream getOriginal() { - return System.err; - } - - @Override - protected void set(PrintStream ps) { - System.setErr(ps); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdOutCaptureRule.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdOutCaptureRule.java deleted file mode 100644 index 0a33997cde..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdOutCaptureRule.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4; - -import java.io.PrintStream; -import org.junit.Rule; - -/** - * A JUnit rule that allows the capturing stdout (i.e. {@link System#out} during the scope of a - * test. - * - *

Note: If some part of the system holds a reference System.out before this rule is loaded - * into the test lifecycle there is no way for this rule to capture the output. Ensure this rule is - * declared as high in your test file as possible, and ordered using {@link Rule#order()} before - * other Rules if necessary. - * - *

To use this rule add the field declaration to your JUnit 4 Test class: - * - *

Note: It is important that the field is public - * - *

{@code
- * @Rule
- * public StdOutCaptureRule stdOutCaptureRule = new StdOutCaptureRule();
- * }
- * - * @see org.junit.Rule - * @see Rule#order() - */ -public final class StdOutCaptureRule extends StdXCaptureRule { - - public StdOutCaptureRule() {} - - @Override - protected PrintStream getOriginal() { - return System.out; - } - - @Override - protected void set(PrintStream ps) { - System.setOut(ps); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRule.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRule.java deleted file mode 100644 index ba17e3e324..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRule.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4; - -import com.google.common.base.Charsets; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.UnsupportedEncodingException; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; - -abstract class StdXCaptureRule implements TestRule { - - private final ByteArrayOutputStream byteArrayOutputStream; - - public StdXCaptureRule() { - byteArrayOutputStream = new ByteArrayOutputStream(); - } - - protected abstract PrintStream getOriginal(); - - protected abstract void set(PrintStream ps); - - /** - * Get a handle to the raw bytes written during the running test so far. - * - * @return A read-only {@link ByteArrayOutputStream} representing the raw bytes written so far. - *

Note the following behavior of the return value: - *

    - *
  1. Calling any "write" method call will result in an {@link IllegalStateException} - *
  2. Calls to {@link ByteArrayOutputStream#toByteArray()} will result in a new copy of the - * underlying array up to that point - *
  3. Calls to {@link ByteArrayOutputStream#flush()} will be silently ignored - *
  4. Calls to {@link ByteArrayOutputStream#close()} will be silently ignored - *
- */ - public ByteArrayOutputStream getCapturedOutput() { - return new ReadOnlyByteArrayOutputStream(byteArrayOutputStream); - } - - /** - * Return a UTF-8 {@link String} of all bytes written during the running test so far. - * - * @return UTF-8 {@link String} of all bytes written - */ - public String getCapturedOutputAsUtf8String() { - return new String(byteArrayOutputStream.toByteArray(), Charsets.UTF_8); - } - - @Override - public Statement apply(final Statement base, Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - PrintStream originalOut = getOriginal(); - TeeOutputStream tee = new TeeOutputStream(System.out, byteArrayOutputStream); - boolean outReplaced = false; - try { - set(new PrintStream(tee)); - outReplaced = true; - base.evaluate(); - } finally { - if (outReplaced) { - set(originalOut); - } - } - } - }; - } - - private static final class TeeOutputStream extends OutputStream { - private final OutputStream left; - private final OutputStream right; - - public TeeOutputStream(OutputStream left, OutputStream right) { - this.left = left; - this.right = right; - } - - @Override - public void write(int b) throws IOException { - try { - left.write(b); - } finally { - right.write(b); - } - } - - @Override - public void flush() throws IOException { - try { - left.flush(); - } finally { - right.flush(); - } - } - } - - private static final class ReadOnlyByteArrayOutputStream extends ByteArrayOutputStream { - private final ByteArrayOutputStream delegate; - - public ReadOnlyByteArrayOutputStream(ByteArrayOutputStream delegate) { - this.delegate = delegate; - } - - @Override - public synchronized void write(int b) { - throw getIllegalStateException("write(b)"); - } - - @Override - public synchronized void write(byte[] b, int off, int len) { - throw getIllegalStateException("write(byte[], off, len)"); - } - - @Override - public synchronized void writeTo(OutputStream out) { - throw getIllegalStateException("writeOt(out)"); - } - - @Override - public synchronized void reset() { - throw getIllegalStateException("reset()"); - } - - @Override - public synchronized byte[] toByteArray() { - return delegate.toByteArray(); - } - - @Override - public void close() { - // ignore - } - - @Override - public synchronized int size() { - return delegate.size(); - } - - @Override - public synchronized String toString() { - return delegate.toString(); - } - - @Override - public synchronized String toString(String charsetName) throws UnsupportedEncodingException { - return delegate.toString(charsetName); - } - - @SuppressWarnings("deprecation") - @Override - public synchronized String toString(int hibyte) { - return delegate.toString(hibyte); - } - - @Override - public void flush() { - // ignore - } - - @Override - public void write(byte[] b) { - throw getIllegalStateException("write(byte[])"); - } - - private IllegalStateException getIllegalStateException(String desc) { - return new IllegalStateException(desc + " is forbidden"); - } - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRuleTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRuleTest.java deleted file mode 100644 index 17d167e1af..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/StdXCaptureRuleTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4; - -import static org.junit.Assert.*; - -import java.io.IOException; -import java.io.PrintStream; -import org.junit.Test; - -public final class StdXCaptureRuleTest { - - @Test(expected = IllegalStateException.class) - public void returnedByteArrayOutputStreamIsReadOnly_writeByte() { - getStdXCaptureRule().getCapturedOutput().write(0); - } - - @Test(expected = IllegalStateException.class) - public void returnedByteArrayOutputStreamIsReadOnly_writeByteArray() throws IOException { - getStdXCaptureRule().getCapturedOutput().write(new byte[] {0}); - } - - @Test(expected = IllegalStateException.class) - public void returnedByteArrayOutputStreamIsReadOnly_writeByteArrayRange() { - getStdXCaptureRule().getCapturedOutput().write(new byte[] {0}, 0, 1); - } - - @Test(expected = IllegalStateException.class) - public void returnedByteArrayOutputStreamIsReadOnly_writeTo() throws IOException { - getStdXCaptureRule().getCapturedOutput().writeTo(System.out); - } - - @Test(expected = IllegalStateException.class) - public void returnedByteArrayOutputStreamIsReadOnly_reset() { - getStdXCaptureRule().getCapturedOutput().reset(); - } - - @Test - public void returnedByteArrayOutputStreamIsReadOnly_close() throws IOException { - getStdXCaptureRule().getCapturedOutput().close(); - } - - @Test - public void returnedByteArrayOutputStreamIsReadOnly_flush() throws IOException { - getStdXCaptureRule().getCapturedOutput().flush(); - } - - private static StdXCaptureRule getStdXCaptureRule() { - return new StdXCaptureRule() { - @Override - protected PrintStream getOriginal() { - fail("unexpected call"); - return null; - } - - @Override - protected void set(PrintStream ps) { - fail("unexpected call"); - } - }; - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/MultipleAttemptsRuleTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/MultipleAttemptsRuleTest.java deleted file mode 100644 index e1c98b1953..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/MultipleAttemptsRuleTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4.tests; - -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import com.google.cloud.testing.junit4.MultipleAttemptsRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runners.model.MultipleFailureException; -import org.junit.runners.model.Statement; - -public final class MultipleAttemptsRuleTest { - - private static final int NUMBER_OF_ATTEMPTS = 5; - - @Rule public MultipleAttemptsRule rr = new MultipleAttemptsRule(NUMBER_OF_ATTEMPTS, 0); - - private int numberAttempted = 0; - - @Test - public void wontPassUntil5() { - numberAttempted += 1; - assertEquals(NUMBER_OF_ATTEMPTS, numberAttempted); - } - - @Test(expected = IllegalArgumentException.class) - public void errorConstructing_attemptLessThan1() { - new MultipleAttemptsRule(0); - } - - @Test - public void errorConstructing_attemptEquals1() { - new MultipleAttemptsRule(1); - } - - @Test(expected = IllegalArgumentException.class) - public void errorConstructing_attemptGreaterThanOrEqualTo1AndBackoffLessThan0() { - new MultipleAttemptsRule(1, -1); - } - - @Test - public void errorConstructing_attemptGreaterThanOrEqualTo1AndBackoffEqualTo0() { - new MultipleAttemptsRule(1, 0); - } - - @Test - public void allErrorPropagated() { - MultipleAttemptsRule rule = new MultipleAttemptsRule(3, 0); - Statement statement = - rule.apply( - new Statement() { - private int counter = 1; - - @Override - public void evaluate() { - fail("attempt " + counter++); - } - }, - null); - - try { - statement.evaluate(); - } catch (MultipleFailureException mfe) { - // pass - assertThat(mfe.getFailures()).hasSize(3); - } catch (Throwable throwable) { - fail("unexpected error: " + throwable.getMessage()); - } - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdErrCaptureRuleTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdErrCaptureRuleTest.java deleted file mode 100644 index 565bb08f12..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdErrCaptureRuleTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4.tests; - -import static org.junit.Assert.assertEquals; - -import com.google.cloud.testing.junit4.StdErrCaptureRule; -import org.junit.Rule; -import org.junit.Test; - -public class StdErrCaptureRuleTest { - - @Rule public StdErrCaptureRule stdOutCap = new StdErrCaptureRule(); - - @Test - public void captureSuccessful() { - System.err.println("err world"); - String expected = "err world" + System.lineSeparator(); - String actual = stdOutCap.getCapturedOutputAsUtf8String(); - assertEquals(expected, actual); - } -} diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdOutCaptureRuleTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdOutCaptureRuleTest.java deleted file mode 100644 index 8230debded..0000000000 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/tests/StdOutCaptureRuleTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ - -package com.google.cloud.testing.junit4.tests; - -import static org.junit.Assert.assertEquals; - -import com.google.cloud.testing.junit4.StdOutCaptureRule; -import org.junit.Rule; -import org.junit.Test; - -public class StdOutCaptureRuleTest { - - @Rule public StdOutCaptureRule stdOutCap = new StdOutCaptureRule(); - - @Test - public void captureSuccessful() { - System.out.println("hello world"); - String expected = "hello world" + System.lineSeparator(); - String actual = stdOutCap.getCapturedOutputAsUtf8String(); - assertEquals(expected, actual); - } -} diff --git a/java.header b/java.header deleted file mode 100644 index d0970ba7d3..0000000000 --- a/java.header +++ /dev/null @@ -1,15 +0,0 @@ -^/\*$ -^ \* Copyright \d\d\d\d,? Google (Inc\.|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$ -^ \*$ -^ \*[ ]+https?://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\.$ -^ \*/$ diff --git a/license-checks.xml b/license-checks.xml deleted file mode 100644 index 6597fced80..0000000000 --- a/license-checks.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 890c3909d2..0000000000 --- a/pom.xml +++ /dev/null @@ -1,396 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-core-parent - pom - 2.9.5-SNAPSHOT - Google Cloud Core Parent - https://github.com/googleapis/java-core - - Java idiomatic client for Google Cloud Platform services. - - - - com.google.cloud - google-cloud-shared-config - 1.5.5 - - - - - garrettjonesgoogle - Garrett Jones - garrettjones@google.com - Google - - Developer - - - - pongad - Michael Darakananda - pongad@google.com - Google - - Developer - - - - shinfan - Shin Fan - shinfan@google.com - Google - - Developer - - - - michaelbausor - Micheal Bausor - michaelbausor@google.com - Google - - Developer - - - - vam-google - Vadym Matsishevskyi - vam@google.com - Google - - Developer - - - - tswast - Tim Swast - tswast@google.com - Google - - Developer - - - - neozwu - Neo Wu - neowu@google.com - Google - - Developer - - - - lesv - Les Vogel - lesv@google.com - Google - - Developer - - - - schmidt_sebastian - Sebastian Schmidt - mrschmidt@google.com - Google - - Developer - - - - andreamlin - Andrea Lin - andrealin@google.com - - Developer - - - - hzyi-google - Hanzhen Yi - hzyi@google.com - - Developer - - - - - Google LLC - - - scm:git:git@github.com:googleapis/java-core.git - scm:git:git@github.com:googleapis/java-core.git - https://github.com/googleapis/java-core - HEAD - - - https://github.com/googleapis/java-core/issues - GitHub Issues - - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - Apache-2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - UTF-8 - github - google-cloud-core-parent - 2.22.0 - 2.5.0 - 2.13.0 - 1.8.0 - 1.14.0 - 2.1.2 - 1.42.3 - 1.52.1 - 3.21.12 - 0.31.1 - 1.3.2 - 31.1-jre - 4.13.2 - 1.1.3 - 5.1.0 - 3.0.2 - 1.6.5 - 3.3 - 2.18.0 - 2.10.1 - - - - - - com.google.cloud - google-cloud-core - ${project.version} - - - - com.google.auth - google-auth-library-bom - ${google.auth.version} - pom - import - - - com.google.api - gax-bom - ${gax.version} - pom - import - - - com.google.http-client - google-http-client-bom - ${google.http.version} - pom - import - - - com.google.api-client - google-api-client-bom - ${google.api.version} - pom - import - - - io.grpc - grpc-bom - ${grpc.version} - pom - import - - - com.google.protobuf - protobuf-bom - ${protobuf.version} - pom - import - - - com.google.guava - guava-bom - ${guava.version} - pom - import - - - com.google.api - api-common - ${google.api-common.version} - - - com.google.api.grpc - proto-google-common-protos - ${google.common-protos.version} - - - com.google.api.grpc - proto-google-iam-v1 - ${google.iam.version} - - - - io.opencensus - opencensus-api - ${opencensus.version} - - - io.opencensus - opencensus-contrib-http-util - ${opencensus.version} - - - - javax.annotation - javax.annotation-api - ${annotations-api.version} - - - com.google.code.findbugs - jsr305 - ${findbugs.version} - - - org.threeten - threetenbp - ${threetenbp.version} - - - com.google.errorprone - error_prone_annotations - ${errorprone.version} - - - com.google.code.gson - gson - ${gson.version} - - - - - com.google.truth - truth - ${truth.version} - test - - - org.checkerframework - checker-qual - - - - - junit - junit - ${junit.version} - test - - - org.easymock - easymock - ${easymock.version} - test - - - org.objenesis - objenesis - ${objenesis.version} - test - - - - - - google-cloud-core - google-cloud-core-http - google-cloud-core-grpc - google-cloud-core-bom - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.2 - - - - index - dependency-info - team - ci-management - issue-management - licenses - scm - dependency-management - distribution-management - summary - modules - - - - - true - ${site.installationModule} - jar - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.4.1 - - - html - - aggregate - javadoc - - - - - none - protected - true - ${project.build.directory}/javadoc - - - Test helpers packages - com.google.cloud.testing - - - SPI packages - com.google.cloud.spi* - - - - - https://grpc.io/grpc-java/javadoc/ - https://developers.google.com/protocol-buffers/docs/reference/java/ - https://googleapis.dev/java/google-auth-library/latest/ - https://googleapis.dev/java/gax/latest/ - https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ - - - - - - diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 8b2a5263ea..0000000000 --- a/renovate.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "enabled": false, - "extends": [ - ":separateMajorReleases", - ":combinePatchMinorReleases", - ":ignoreUnstable", - ":prImmediately", - ":updateNotScheduled", - ":automergeDisabled", - ":ignoreModulesAndTests", - ":maintainLockFilesDisabled", - ":autodetectPinVersions" - ], - "ignorePaths": [".kokoro/requirements.txt"], - "packageRules": [ - { - "packagePatterns": [ - "^com.google.guava:" - ], - "versionScheme": "docker" - }, - { - "packagePatterns": [ - "*" - ], - "semanticCommitType": "deps", - "semanticCommitScope": null - }, - { - "packagePatterns": [ - "^org.apache.maven", - "^org.jacoco:", - "^org.codehaus.mojo:", - "^org.sonatype.plugins:", - "^com.coveo:", - "^com.google.cloud:google-cloud-shared-config" - ], - "semanticCommitType": "build", - "semanticCommitScope": "deps" - }, - { - "packagePatterns": [ - "^com.google.cloud:google-cloud-core", - "^com.google.cloud:libraries-bom", - "^com.google.cloud.samples:shared-configuration" - ], - "semanticCommitType": "chore", - "semanticCommitScope": "deps" - }, - { - "packagePatterns": [ - "^junit:junit", - "^com.google.truth:truth", - "^org.mockito:mockito-core", - "^org.objenesis:objenesis", - "^com.google.cloud:google-cloud-conformance-tests" - ], - "semanticCommitType": "test", - "semanticCommitScope": "deps" - }, - { - "packagePatterns": [ - "^com.google.cloud:google-cloud-" - ], - "ignoreUnstable": false - }, - { - "packagePatterns": [ - "^com.fasterxml.jackson.core" - ], - "groupName": "jackson dependencies" - } - ], - "semanticCommits": true, - "dependencyDashboard": true -} diff --git a/versions.txt b/versions.txt deleted file mode 100644 index 1a9b45f82b..0000000000 --- a/versions.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Format: -# module:released-version:current-version - -google-cloud-core:2.9.4:2.9.5-SNAPSHOT From 6b5acad591bee3ee7ffd6cd347109effd1edb51c Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Wed, 27 Sep 2023 13:32:26 -0400 Subject: [PATCH 2/2] README update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36036916e2..0dc2eef155 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ A set of classes and utilities used in Google Cloud Java libraries. :bus: In January 2023, this library has moved to -[google-cloud-java/java-core]( -https://github.com/googleapis/google-cloud-java/tree/main/java-core). +[sdk-platform-java/java-core]( +https://github.com/googleapis/sdk-platform-java/tree/main/java-core). This repository will be archived in the future. Future releases will appear in the new repository (https://github.com/googleapis/google-cloud-java/releases). The Maven artifact coordinates (such as `com.google.cloud:google-cloud-core`) remain the same.