From 2b6f04da3aeebac778fb664c4564fb8b58bf3be4 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 30 Jan 2020 01:38:18 +0100 Subject: [PATCH 01/34] deps: update core transport dependencies to v1.34.1 (#43) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 05fc70031..bb962565e 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 1.30.7 1.92.2 1.53.0 - 1.34.0 + 1.34.1 28.2-android 4.13 1.17.0 From 52058636e10951e883523204f0f161db8a972d62 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 30 Jan 2020 03:05:29 +0100 Subject: [PATCH 02/34] deps: update dependency com.google.truth:truth to v1.0.1 (#32) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bb962565e..de2acbc9c 100644 --- a/pom.xml +++ b/pom.xml @@ -247,7 +247,7 @@ com.google.truth truth - 1.0 + 1.0.1 test From 18c3a1b069cb507a91d0320e64a8bf8ae8efe394 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 30 Jan 2020 03:41:13 +0100 Subject: [PATCH 03/34] deps: update core dependencies (#40) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index de2acbc9c..9e8bbdf4b 100644 --- a/pom.xml +++ b/pom.xml @@ -58,9 +58,9 @@ google-cloud-spanner-jdbc - 1.26.0 + 1.27.0 1.30.7 - 1.92.2 + 1.92.3 1.53.0 1.34.1 28.2-android @@ -72,7 +72,7 @@ 1.47.0 2.2 2.3.4 - 0.19.0 + 0.20.0 From 20ad5e9566ce76b30d6e83fa73e4e7b27fc3c13f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 31 Jan 2020 09:17:44 -0800 Subject: [PATCH 04/34] chore: group guava with other core dependencies --- renovate.json | 3 +- synth.metadata | 808 +------------------------------------------------ 2 files changed, 3 insertions(+), 808 deletions(-) diff --git a/renovate.json b/renovate.json index a5cdff45c..268a4669a 100644 --- a/renovate.json +++ b/renovate.json @@ -22,7 +22,8 @@ "^com.google.api:gax", "^com.google.auth:", "^com.google.cloud:google-cloud-core", - "^io.grpc:" + "^io.grpc:", + "^com.google.guava:" ], "groupName": "core dependencies" }, diff --git a/synth.metadata b/synth.metadata index 50195b614..832d4b675 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-01-16T09:11:16.210833Z", + "updateTime": "2020-01-31T09:14:17.375897Z", "sources": [ { "template": { @@ -8,811 +8,5 @@ "version": "2019.10.17" } } - ], - "newFiles": [ - { - "path": "pom.xml" - }, - { - "path": ".repo-metadata.json" - }, - { - "path": "java.header" - }, - { - "path": "CONTRIBUTING.md" - }, - { - "path": "synth.metadata" - }, - { - "path": "renovate.json" - }, - { - "path": "versions.txt" - }, - { - "path": "synth.py" - }, - { - "path": "license-checks.xml" - }, - { - "path": "CODE_OF_CONDUCT.md" - }, - { - "path": "LICENSE" - }, - { - "path": "codecov.yaml" - }, - { - "path": ".gitignore" - }, - { - "path": "README.md" - }, - { - "path": ".github/release-please.yml" - }, - { - "path": ".github/PULL_REQUEST_TEMPLATE.md" - }, - { - "path": ".github/ISSUE_TEMPLATE/feature_request.md" - }, - { - "path": ".github/ISSUE_TEMPLATE/support_request.md" - }, - { - "path": ".github/ISSUE_TEMPLATE/bug_report.md" - }, - { - "path": ".kokoro/build.sh" - }, - { - "path": ".kokoro/common.cfg" - }, - { - "path": ".kokoro/build.bat" - }, - { - "path": ".kokoro/linkage-monitor.sh" - }, - { - "path": ".kokoro/coerce_logs.sh" - }, - { - "path": ".kokoro/dependencies.sh" - }, - { - "path": ".kokoro/trampoline.sh" - }, - { - "path": ".kokoro/continuous/samples.cfg" - }, - { - "path": ".kokoro/continuous/java8.cfg" - }, - { - "path": ".kokoro/continuous/integration.cfg" - }, - { - "path": ".kokoro/continuous/java11.cfg" - }, - { - "path": ".kokoro/continuous/propose_release.cfg" - }, - { - "path": ".kokoro/continuous/common.cfg" - }, - { - "path": ".kokoro/continuous/propose_release.sh" - }, - { - "path": ".kokoro/continuous/java7.cfg" - }, - { - "path": ".kokoro/continuous/lint.cfg" - }, - { - "path": ".kokoro/continuous/java8-osx.cfg" - }, - { - "path": ".kokoro/continuous/dependencies.cfg" - }, - { - "path": ".kokoro/continuous/java8-win.cfg" - }, - { - "path": ".kokoro/nightly/samples.cfg" - }, - { - "path": ".kokoro/nightly/java8.cfg" - }, - { - "path": ".kokoro/nightly/integration.cfg" - }, - { - "path": ".kokoro/nightly/java11.cfg" - }, - { - "path": ".kokoro/nightly/common.cfg" - }, - { - "path": ".kokoro/nightly/java7.cfg" - }, - { - "path": ".kokoro/nightly/lint.cfg" - }, - { - "path": ".kokoro/nightly/java8-osx.cfg" - }, - { - "path": ".kokoro/nightly/dependencies.cfg" - }, - { - "path": ".kokoro/nightly/java8-win.cfg" - }, - { - "path": ".kokoro/release/publish_javadoc.cfg" - }, - { - "path": ".kokoro/release/common.sh" - }, - { - "path": ".kokoro/release/promote.sh" - }, - { - "path": ".kokoro/release/common.cfg" - }, - { - "path": ".kokoro/release/publish_javadoc.sh" - }, - { - "path": ".kokoro/release/drop.sh" - }, - { - "path": ".kokoro/release/stage.sh" - }, - { - "path": ".kokoro/release/promote.cfg" - }, - { - "path": ".kokoro/release/snapshot.cfg" - }, - { - "path": ".kokoro/release/bump_snapshot.cfg" - }, - { - "path": ".kokoro/release/drop.cfg" - }, - { - "path": ".kokoro/release/bump_snapshot.sh" - }, - { - "path": ".kokoro/release/stage.cfg" - }, - { - "path": ".kokoro/release/snapshot.sh" - }, - { - "path": ".kokoro/presubmit/samples.cfg" - }, - { - "path": ".kokoro/presubmit/java8.cfg" - }, - { - "path": ".kokoro/presubmit/integration.cfg" - }, - { - "path": ".kokoro/presubmit/java11.cfg" - }, - { - "path": ".kokoro/presubmit/linkage-monitor.cfg" - }, - { - "path": ".kokoro/presubmit/common.cfg" - }, - { - "path": ".kokoro/presubmit/java7.cfg" - }, - { - "path": ".kokoro/presubmit/lint.cfg" - }, - { - "path": ".kokoro/presubmit/java8-osx.cfg" - }, - { - "path": ".kokoro/presubmit/dependencies.cfg" - }, - { - "path": ".kokoro/presubmit/clirr.cfg" - }, - { - "path": ".kokoro/presubmit/java8-win.cfg" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AutocommitDmlModeConverterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/StatementResultImplTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionGeneratedSqlScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcDriverTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionStatementExecutorTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcPreparedStatementTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ReplaceableForwardingResultSetTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcParameterStoreTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetMetaDataTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcDatabaseMetaDataWithMockedServerTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcTypeConverterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AbstractSqlScriptVerifier.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcGrpcErrorTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionImplTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AbstractJdbcWrapperTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SqlScriptVerifier.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SetReadOnlyStalenessSqlScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionOptionsTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcDatabaseMetaDataTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ITConnectionImpl.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SingleUseTransactionTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ITAbstractJdbcTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcArrayTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SpannerExceptionMatcher.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcBlobTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/DurationConverterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ReadOnlyTransactionTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SqlTestScriptsGenerator.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionStatementWithOneParameterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionImplAutocommitReadWriteTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/DmlBatchTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionImplTransactionalReadWriteTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AbstractJdbcResultSetTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AbortedTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcAbortedTransactionTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SpannerPoolTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/RandomResultSetGenerator.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ReadOnlyStalenessTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcExceptionMatcher.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/TransactionModeConverterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/DirectExecuteResultSetTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SpannerJdbcExceptionMatcher.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/DdlBatchTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ReadOnlyStalenessUtilTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcClobTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/DdlClientTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AbstractConnectionImplTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionImplGeneratedSqlScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionImplTransactionalReadOnlyTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/StatementTimeoutTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionStatementWithNoParametersTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcTimeoutSqlTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcStatementTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/JdbcSqlScriptVerifier.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ClientSideStatementsTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/CredentialsServiceTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/BooleanConverterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ConnectionImplAutocommitReadOnlyTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/StatementParserTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ITAbstractSpannerTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ReadOnlyStalenessConverterTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/SetStatementTimeoutSqlScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/AutocommitDmlModeTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/ReadWriteTransactionTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITBulkConnectionTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcConnectTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDdlTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSqlScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITTransactionModeTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcPreparedStatementTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSqlMusicScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadWriteAutocommitTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSimpleStatementsTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITSqlScriptTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITDdlTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITTransactionRetryTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITReadWriteAutocommitSpannerTest.java" - }, - { - "path": "src/test/java/com/google/cloud/spanner/jdbc/it/ITSqlMusicScriptTest.java" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestSetStatements.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestStatementTimeout.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/test-key-cloud-storage.json" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/CommentsTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestAutocommitReadOnly.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/TimeoutSqlScriptTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/test-key-app-default.json" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestInvalidStatements.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestReadOnlyStaleness.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/test-key.json" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_InsertTestData.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestTransactionMode_ReadOnly.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITTransactionModeTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/SetStatementTimeoutTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ClientSideStatementsTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestAutocommitDmlMode.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest_CreateTables.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlMusicScriptTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestGetReadTimestamp.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestGetCommitTimestamp.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_CreateTables.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ConnectionImplGeneratedSqlScriptTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITDdlTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestTransactionMode.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/SetReadOnlyStalenessTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITSqlScriptTest_TestTemporaryTransactions.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/ITReadWriteAutocommitSpannerTest.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/it/Songs.txt" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/it/Singers.txt" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/it/Albums.txt" - }, - { - "path": "src/test/resources/com/google/cloud/spanner/jdbc/it/Concerts.txt" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ConnectionStatementExecutorImpl.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatement.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcBlob.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/RetriableUpdate.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatements.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcResultSet.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ReadOnlyStalenessUtil.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcWrapper.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ConnectionImpl.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcStatement.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcPreparedStatement.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcSqlException.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatementSetExecutor.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/StatementExecutionInterceptor.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ConnectionStatementExecutor.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ConnectionPreconditions.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcPreparedStatement.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/TransactionMode.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcStatement.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcConnection.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/DmlBatch.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcParameterMetaData.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/DdlClient.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractMultiUseTransaction.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcConnection.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AnalyzeMode.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatementImpl.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/StatementParser.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSetMetaData.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcPreconditions.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatementValueConverter.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcConstants.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcDataSource.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcDriver.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatementNoParamExecutor.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ConnectionOptions.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcClob.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/TransactionRetryListener.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/SingleUseTransaction.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/StatementExecutor.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ChecksumResultSet.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/StatementResultImpl.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AutocommitDmlMode.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/RetriableBatchUpdate.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/Connection.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcArray.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcDatabaseMetaData.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcTypeConverter.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcSqlExceptionFactory.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/DdlBatch.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/SpannerPool.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/CloudSpannerJdbcConnection.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/UnitOfWork.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/FailedBatchUpdate.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/StatementResult.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcParameterStore.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatementExecutor.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/CredentialsService.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ReadOnlyTransaction.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/FailedQuery.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ReadWriteTransaction.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/FailedUpdate.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/JdbcDataType.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ReplaceableForwardingResultSet.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/AbstractBaseUnitOfWork.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/ClientSideStatementValueConverters.java" - }, - { - "path": "src/main/java/com/google/cloud/spanner/jdbc/DirectExecuteResultSet.java" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetImportedKeys.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetExportedKeys.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/ClientSideStatements.json" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetPrimaryKeys.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetIndexInfo.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetCrossReferences.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetColumns.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetTables.sql" - }, - { - "path": "src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetSchemas.sql" - }, - { - "path": "src/main/resources/META-INF/services/java.sql.Driver" - } ] } \ No newline at end of file From e9cfe1446ecf3cd876f74c481d96f9a9923dc9ba Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 3 Feb 2020 10:13:18 -0800 Subject: [PATCH 05/34] chore: linkage monitor check should skipp clirr and enforcer --- .kokoro/linkage-monitor.sh | 7 ++++++- synth.metadata | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.kokoro/linkage-monitor.sh b/.kokoro/linkage-monitor.sh index a3e5ab30e..651c7b5eb 100755 --- a/.kokoro/linkage-monitor.sh +++ b/.kokoro/linkage-monitor.sh @@ -23,7 +23,12 @@ cd github/java-spanner-jdbc/ java -version echo ${JOB_TYPE} -mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V +mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true # Kokoro job cloud-opensource-java/ubuntu/linkage-monitor-gcs creates this JAR JAR=linkage-monitor-latest-all-deps.jar diff --git a/synth.metadata b/synth.metadata index 832d4b675..a627f8ae9 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-01-31T09:14:17.375897Z", + "updateTime": "2020-02-01T09:13:43.890088Z", "sources": [ { "template": { From 0779fcb0bfe935c3c302fa8442f733c7e3629761 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 3 Feb 2020 21:26:07 +0100 Subject: [PATCH 06/34] deps: update protobuf.version to v3.11.3 (#48) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9e8bbdf4b..a3d30a59e 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 28.2-android 4.13 1.17.0 - 3.11.1 + 3.11.3 1.4.1 1.8.1 1.47.0 From ef891b000045d1f39f91b6a0ed3abaab19c5f05e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 3 Feb 2020 21:26:27 +0100 Subject: [PATCH 07/34] deps: update dependency com.google.api-client:google-api-client-bom to v1.30.8 (#46) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3d30a59e..04b12bf5c 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ google-cloud-spanner-jdbc 1.27.0 - 1.30.7 + 1.30.8 1.92.3 1.53.0 1.34.1 From 1ae098e924c2a488cfddd0a3aee9511274b7a515 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 4 Feb 2020 00:59:19 +0100 Subject: [PATCH 08/34] deps: update core dependencies --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 04b12bf5c..8e1751e84 100644 --- a/pom.xml +++ b/pom.xml @@ -60,8 +60,8 @@ google-cloud-spanner-jdbc 1.27.0 1.30.8 - 1.92.3 - 1.53.0 + 1.92.4 + 1.53.1 1.34.1 28.2-android 4.13 From aad4ecf96e40769dfee99a130c79ae9d333f2fca Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2020 13:59:16 +1100 Subject: [PATCH 09/34] chore: release 1.13.1-SNAPSHOT (#51) * updated versions.txt [ci skip] * updated pom.xml [ci skip] --- pom.xml | 2 +- versions.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8e1751e84..150ca2696 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 google-cloud-spanner-jdbc - 1.13.0 + 1.13.1-SNAPSHOT jar Google Cloud Spanner JDBC https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-spanner-jdbc diff --git a/versions.txt b/versions.txt index 72036a35b..72f0ebd53 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-spanner-jdbc:1.13.0:1.13.0 +google-cloud-spanner-jdbc:1.13.0:1.13.1-SNAPSHOT From ce291395cc1766b2a814cac16cfb4953a83af531 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Tue, 11 Feb 2020 11:50:48 -0800 Subject: [PATCH 10/34] chore: only allow renovate-bot for trusted-contribution auto-labeling --- .github/trusted-contribution.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/trusted-contribution.yml diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 000000000..f247d5c78 --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,2 @@ +trustedContributors: +- renovate-bot \ No newline at end of file From 41236c4f06735fb943ec78c6d4fdbd19878ae253 Mon Sep 17 00:00:00 2001 From: David Supplee Date: Wed, 12 Feb 2020 14:30:13 -0800 Subject: [PATCH 11/34] chore: update github url (#56) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 150ca2696..8b8e5d5ec 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ 1.13.1-SNAPSHOT jar Google Cloud Spanner JDBC - https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-spanner-jdbc + https://github.com/googleapis/java-spanner-jdbc JDBC driver for Google Cloud Spanner. From 1c676f4216ef913b6ca7bac77273087871296404 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 13 Feb 2020 05:01:36 +0100 Subject: [PATCH 12/34] build(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.2.2 (#55) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8b8e5d5ec..7b7d6b1ac 100644 --- a/pom.xml +++ b/pom.xml @@ -371,7 +371,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.2.2 From 604ee2b75204ad52eaf724c3fb71e8c13540af7c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 13 Feb 2020 05:02:13 +0100 Subject: [PATCH 13/34] deps: update core dependencies to v1.92.5 (#53) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7b7d6b1ac..cfb91d6bf 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ google-cloud-spanner-jdbc 1.27.0 1.30.8 - 1.92.4 + 1.92.5 1.53.1 1.34.1 28.2-android From a34bfc0ff1c2ddeef077dbfae4c56bdd53febcb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Wed, 19 Feb 2020 01:57:14 +0100 Subject: [PATCH 14/34] fix: include Spanner gRPC test dependencies (#63) * fix: include Spanner gRPC test dependencies * fix: add grpc dependencies as ignored dependencies --- pom.xml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cfb91d6bf..d0ea8f26b 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ 3.11.3 1.4.1 1.8.1 - 1.47.0 + 1.49.2 2.2 2.3.4 0.20.0 @@ -244,6 +244,24 @@ test-jar test + + com.google.api.grpc + grpc-google-cloud-spanner-v1 + ${spanner.version} + test + + + com.google.api.grpc + grpc-google-cloud-spanner-admin-instance-v1 + ${spanner.version} + test + + + com.google.api.grpc + grpc-google-cloud-spanner-admin-database-v1 + ${spanner.version} + test + com.google.truth truth @@ -321,7 +339,12 @@ org.apache.maven.plugins maven-dependency-plugin - com.google.api:gax-grpc + + com.google.api:gax-grpc + com.google.api.grpc:grpc-google-cloud-spanner-v1 + com.google.api.grpc:grpc-google-cloud-spanner-admin-instance-v1 + com.google.api.grpc:grpc-google-cloud-spanner-admin-database-v1 + From 181991bda1f66de707d27dad9658b9177626595a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 20 Feb 2020 02:52:47 +0100 Subject: [PATCH 15/34] deps: update core dependencies to v1.27.1 (#61) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d0ea8f26b..fc8f12e5f 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ google-cloud-spanner-jdbc - 1.27.0 + 1.27.1 1.30.8 1.92.5 1.53.1 From 8739015f62289adb92fd55b19a5bff8762da20a9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 20 Feb 2020 02:53:19 +0100 Subject: [PATCH 16/34] deps: update core transport dependencies to v1.34.2 (#62) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fc8f12e5f..3552c7b08 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 1.30.8 1.92.5 1.53.1 - 1.34.1 + 1.34.2 28.2-android 4.13 1.17.0 From e6ec261803cbdfd2f82aa8d524de1cbed2fae44e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 21 Feb 2020 15:47:08 -0800 Subject: [PATCH 17/34] chore: update common templates This PR was generated using Autosynth. :rainbow: Commits in this repo since last synth: 8739015f62289adb92fd55b19a5bff8762da20a9 deps: update core transport dependencies to v1.34.2 (#62) 181991bda1f66de707d27dad9658b9177626595a deps: update core dependencies to v1.27.1 (#61) a34bfc0ff1c2ddeef077dbfae4c56bdd53febcb2 fix: include Spanner gRPC test dependencies (#63) 604ee2b75204ad52eaf724c3fb71e8c13540af7c deps: update core dependencies to v1.92.5 (#53) 1c676f4216ef913b6ca7bac77273087871296404 build(deps): update dependency org.apache.maven.plugins:maven-shade-plugin to v3.2.2 (#55) 41236c4f06735fb943ec78c6d4fdbd19878ae253 chore: update github url (#56) ce291395cc1766b2a814cac16cfb4953a83af531 chore: only allow renovate-bot for trusted-contribution auto-labeling aad4ecf96e40769dfee99a130c79ae9d333f2fca chore: release 1.13.1-SNAPSHOT (#51) 1ae098e924c2a488cfddd0a3aee9511274b7a515 deps: update core dependencies ef891b000045d1f39f91b6a0ed3abaab19c5f05e deps: update dependency com.google.api-client:google-api-client-bom to v1.30.8 (#46) 0779fcb0bfe935c3c302fa8442f733c7e3629761 deps: update protobuf.version to v3.11.3 (#48)
Log from Synthtool ``` synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py. On branch autosynth nothing to commit, working tree clean HEAD detached at FETCH_HEAD nothing to commit, working tree clean .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/release-please.yml .kokoro/build.bat .kokoro/build.sh .kokoro/coerce_logs.sh .kokoro/common.cfg .kokoro/continuous/common.cfg .kokoro/continuous/dependencies.cfg .kokoro/continuous/integration.cfg .kokoro/continuous/java11.cfg .kokoro/continuous/java7.cfg .kokoro/continuous/java8-osx.cfg .kokoro/continuous/java8-win.cfg .kokoro/continuous/java8.cfg .kokoro/continuous/lint.cfg .kokoro/continuous/propose_release.cfg .kokoro/continuous/propose_release.sh .kokoro/continuous/samples.cfg .kokoro/dependencies.sh .kokoro/linkage-monitor.sh .kokoro/nightly/common.cfg .kokoro/nightly/dependencies.cfg .kokoro/nightly/integration.cfg .kokoro/nightly/java11.cfg .kokoro/nightly/java7.cfg .kokoro/nightly/java8-osx.cfg .kokoro/nightly/java8-win.cfg .kokoro/nightly/java8.cfg .kokoro/nightly/lint.cfg .kokoro/nightly/samples.cfg .kokoro/presubmit/clirr.cfg .kokoro/presubmit/common.cfg .kokoro/presubmit/dependencies.cfg .kokoro/presubmit/integration.cfg .kokoro/presubmit/java11.cfg .kokoro/presubmit/java7.cfg .kokoro/presubmit/java8-osx.cfg .kokoro/presubmit/java8-win.cfg .kokoro/presubmit/java8.cfg .kokoro/presubmit/linkage-monitor.cfg .kokoro/presubmit/lint.cfg .kokoro/presubmit/samples.cfg .kokoro/release/bump_snapshot.cfg .kokoro/release/bump_snapshot.sh .kokoro/release/common.cfg .kokoro/release/common.sh .kokoro/release/drop.cfg .kokoro/release/drop.sh .kokoro/release/promote.cfg .kokoro/release/promote.sh .kokoro/release/publish_javadoc.cfg .kokoro/release/publish_javadoc.sh .kokoro/release/snapshot.cfg .kokoro/release/snapshot.sh .kokoro/release/stage.cfg .kokoro/release/stage.sh .kokoro/trampoline.sh CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md codecov.yaml java.header license-checks.xml renovate.json synthtool > Wrote metadata to synth.metadata. ```
--- .kokoro/build.sh | 23 +++++++++++++++-------- renovate.json | 7 +++++++ synth.metadata | 18 ++++++++++++++++-- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index f1ae58408..d11958c5a 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -62,14 +62,21 @@ integration) bash .kokoro/coerce_logs.sh ;; samples) - mvn -B \ - -Penable-samples \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - bash .kokoro/coerce_logs.sh + if [[ -f samples/pom.xml ]] + then + pushd samples + mvn -B \ + -Penable-samples \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + bash .kokoro/coerce_logs.sh + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi ;; clirr) mvn -B -Denforcer.skip=true clirr:check diff --git a/renovate.json b/renovate.json index 268a4669a..fc6412701 100644 --- a/renovate.json +++ b/renovate.json @@ -54,6 +54,13 @@ "semanticCommitType": "build", "semanticCommitScope": "deps" }, + { + "packagePatterns": [ + "^com.google.cloud:libraries-bom" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, { "packagePatterns": [ "^com.google.cloud:google-cloud-" diff --git a/synth.metadata b/synth.metadata index a627f8ae9..2a500865b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,11 +1,25 @@ { - "updateTime": "2020-02-01T09:13:43.890088Z", + "updateTime": "2020-02-21T23:11:00.093008Z", "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/java-spanner-jdbc.git", + "sha": "8739015f62289adb92fd55b19a5bff8762da20a9" + } + }, + { + "git": { + "name": "synthtool", + "remote": "rpc://devrel/cloud/libraries/tools/autosynth", + "sha": "706a38c26db42299845396cdae55db635c38794a" + } + }, { "template": { "name": "java_library", "origin": "synthtool.gcp", - "version": "2019.10.17" + "version": "2020.2.4" } } ] From c99864bbb07b957cc9896e516c724f8adc3b7b97 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 24 Feb 2020 10:37:56 -0800 Subject: [PATCH 18/34] chore: update common templates --- .kokoro/build.sh | 24 +++++++++++++++++++++--- synth.metadata | 4 ++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index d11958c5a..284a0def7 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -37,19 +37,24 @@ if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTI export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS}) fi +RETURN_CODE=0 +set +e + case ${JOB_TYPE} in test) mvn test -B -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? bash ${KOKORO_GFILE_DIR}/codecov.sh - bash .kokoro/coerce_logs.sh ;; lint) mvn \ -Penable-samples \ com.coveo:fmt-maven-plugin:check + RETURN_CODE=$? ;; javadoc) mvn javadoc:javadoc javadoc:test-javadoc + RETURN_CODE=$? ;; integration) mvn -B ${INTEGRATION_TEST_ARGS} \ @@ -59,7 +64,7 @@ integration) -Denforcer.skip=true \ -fae \ verify - bash .kokoro/coerce_logs.sh + RETURN_CODE=$? ;; samples) if [[ -f samples/pom.xml ]] @@ -72,7 +77,7 @@ samples) -Denforcer.skip=true \ -fae \ verify - bash .kokoro/coerce_logs.sh + RETURN_CODE=$? popd else echo "no sample pom.xml found - skipping sample tests" @@ -80,7 +85,20 @@ samples) ;; clirr) mvn -B -Denforcer.skip=true clirr:check + RETURN_CODE=$? ;; *) ;; esac + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_BUILD_COP}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/buildcop + ${KOKORO_GFILE_DIR}/linux_amd64/buildcop -repo=googleapis/java-spanner-jdbc +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} \ No newline at end of file diff --git a/synth.metadata b/synth.metadata index 2a500865b..ce57fd2f8 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,11 +1,11 @@ { - "updateTime": "2020-02-21T23:11:00.093008Z", + "updateTime": "2020-02-22T10:16:10.861561Z", "sources": [ { "git": { "name": ".", "remote": "https://github.com/googleapis/java-spanner-jdbc.git", - "sha": "8739015f62289adb92fd55b19a5bff8762da20a9" + "sha": "e6ec261803cbdfd2f82aa8d524de1cbed2fae44e" } }, { From 384089f192dc775d7f4fd191d86a2515c2ce5d8b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 25 Feb 2020 10:21:39 -0800 Subject: [PATCH 19/34] chore: update common templates --- .kokoro/build.sh | 8 ++++++-- .kokoro/continuous/java8.cfg | 5 +++++ .kokoro/nightly/integration.cfg | 14 ++++++++++++++ .kokoro/nightly/java8.cfg | 5 +++++ .kokoro/nightly/samples.cfg | 21 +++++++++++++-------- .kokoro/presubmit/java8.cfg | 5 +++++ synth.metadata | 16 +--------------- 7 files changed, 49 insertions(+), 25 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 284a0def7..414656e37 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -44,7 +44,6 @@ case ${JOB_TYPE} in test) mvn test -B -Dclirr.skip=true -Denforcer.skip=true RETURN_CODE=$? - bash ${KOKORO_GFILE_DIR}/codecov.sh ;; lint) mvn \ @@ -91,6 +90,11 @@ clirr) ;; esac +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + # fix output location of logs bash .kokoro/coerce_logs.sh @@ -101,4 +105,4 @@ then fi echo "exiting with ${RETURN_CODE}" -exit ${RETURN_CODE} \ No newline at end of file +exit ${RETURN_CODE} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg index 3b017fc80..495cc7bac 100644 --- a/.kokoro/continuous/java8.cfg +++ b/.kokoro/continuous/java8.cfg @@ -5,3 +5,8 @@ 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/integration.cfg b/.kokoro/nightly/integration.cfg index 3b017fc80..8bf59c02e 100644 --- a/.kokoro/nightly/integration.cfg +++ b/.kokoro/nightly/integration.cfg @@ -5,3 +5,17 @@ env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java8" } + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "java_it_service_account" + } + } +} diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg index 3b017fc80..495cc7bac 100644 --- a/.kokoro/nightly/java8.cfg +++ b/.kokoro/nightly/java8.cfg @@ -5,3 +5,8 @@ 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 index 9a9102490..b4b051cd0 100644 --- a/.kokoro/nightly/samples.cfg +++ b/.kokoro/nightly/samples.cfg @@ -2,23 +2,28 @@ # Configure the docker image for kokoro-trampoline. env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" } env_vars: { - key: "JOB_TYPE" - value: "samples" + key: "JOB_TYPE" + value: "samples" } env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" + key: "GCLOUD_PROJECT" + value: "gcloud-devel" } env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "keystore/73713_java_it_service_account" + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "keystore/73713_java_it_service_account" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" } before_action { diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg index 3b017fc80..495cc7bac 100644 --- a/.kokoro/presubmit/java8.cfg +++ b/.kokoro/presubmit/java8.cfg @@ -5,3 +5,8 @@ env_vars: { key: "TRAMPOLINE_IMAGE" value: "gcr.io/cloud-devrel-kokoro-resources/java8" } + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/synth.metadata b/synth.metadata index ce57fd2f8..796dab977 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,20 +1,6 @@ { - "updateTime": "2020-02-22T10:16:10.861561Z", + "updateTime": "2020-02-24T23:15:28.206977Z", "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/java-spanner-jdbc.git", - "sha": "e6ec261803cbdfd2f82aa8d524de1cbed2fae44e" - } - }, - { - "git": { - "name": "synthtool", - "remote": "rpc://devrel/cloud/libraries/tools/autosynth", - "sha": "706a38c26db42299845396cdae55db635c38794a" - } - }, { "template": { "name": "java_library", From f485cfffa0de27ce35f5d16c689c31c6ea22138e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 27 Feb 2020 05:23:46 +0100 Subject: [PATCH 20/34] deps: update protobuf.version to v3.11.4 (#64) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3552c7b08..56db8f870 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 28.2-android 4.13 1.17.0 - 3.11.3 + 3.11.4 1.4.1 1.8.1 1.49.2 From 12425fcb4382449e4a7a0edad4c812b7ce15aa71 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 27 Feb 2020 05:24:30 +0100 Subject: [PATCH 21/34] deps: update core dependencies to v1.27.2 (#71) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 56db8f870..a9559130a 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ google-cloud-spanner-jdbc - 1.27.1 + 1.27.2 1.30.8 1.92.5 1.53.1 From 567602177e05fa198eaa011fbca05cfe4b72fb13 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 27 Feb 2020 21:35:32 +0100 Subject: [PATCH 22/34] deps: update core dependencies to v1.54.0 (#72) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a9559130a..ae0613d64 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,7 @@ 1.27.2 1.30.8 1.92.5 - 1.53.1 + 1.54.0 1.34.2 28.2-android 4.13 From 3b622999b9f9645a6086e5efd3206f4d7b0806bc Mon Sep 17 00:00:00 2001 From: skuruppu Date: Thu, 5 Mar 2020 14:41:04 +1100 Subject: [PATCH 23/34] deps: update dependency com.google.api-client:google-api-client-bom to v1.30.9 (#74) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ae0613d64..9002c7e2d 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ google-cloud-spanner-jdbc 1.27.2 - 1.30.8 + 1.30.9 1.92.5 1.54.0 1.34.2 From 3d6f35669671194e6772fe327ce48f27e5bf4643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Mon, 9 Mar 2020 16:21:28 +0100 Subject: [PATCH 24/34] =?UTF-8?q?fix:=20add=20missing=20netty-shaded=20lib?= =?UTF-8?q?=20for=20=C3=BCber-jar=20(#80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 9002c7e2d..6d3ce9547 100644 --- a/pom.xml +++ b/pom.xml @@ -181,6 +181,11 @@ grpc-api ${grpc.version}
+ + io.grpc + grpc-netty-shaded + ${grpc.version} + com.google.api api-common @@ -286,12 +291,6 @@ ${junit.version} test - - io.grpc - grpc-netty-shaded - ${grpc.version} - test - com.google.api gax-grpc From 9e770f281c03a1e9c034e5ff3ddee44fa20a7b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Mon, 9 Mar 2020 16:25:30 +0100 Subject: [PATCH 25/34] feat: add support for foreign keys (#78) Google Cloud Spanner now supports Foreign Key Constraints. These now also show up in the corresponding DatabaseMetaData methods. Fixes #77 --- .../DatabaseMetaData_GetCrossReferences.sql | 50 ++-- .../jdbc/DatabaseMetaData_GetExportedKeys.sql | 53 ++-- .../jdbc/DatabaseMetaData_GetImportedKeys.sql | 53 ++-- .../jdbc/it/ITJdbcDatabaseMetaDataTest.java | 275 +++++++++++++++++- .../spanner/jdbc/it/CreateMusicTables.sql | 14 +- 5 files changed, 383 insertions(+), 62 deletions(-) diff --git a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetCrossReferences.sql b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetCrossReferences.sql index 175edc4e1..7d362ca58 100644 --- a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetCrossReferences.sql +++ b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetCrossReferences.sql @@ -14,21 +14,35 @@ * limitations under the License. */ -SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, PARENT.TABLE_NAME AS PKTABLE_NAME, - PARENT.COLUMN_NAME AS PKCOLUMN_NAME, CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, - CHILD.TABLE_NAME AS FKTABLE_NAME, CHILD.COLUMN_NAME AS FKCOLUMN_NAME, CHILD.ORDINAL_POSITION AS KEY_SEQ, 3 AS UPDATE_RULE, - CASE WHEN TABLES.ON_DELETE_ACTION='CASCADE' THEN 0 ELSE 3 END AS DELETE_RULE, NULL AS FK_NAME, 'PRIMARY_KEY' AS PK_NAME, - 7 AS DEFERRABILITY, TABLES.ON_DELETE_ACTION -FROM INFORMATION_SCHEMA.INDEX_COLUMNS PARENT -INNER JOIN INFORMATION_SCHEMA.INDEXES PARENT_INDEX ON PARENT.INDEX_NAME=PARENT_INDEX.INDEX_NAME AND PARENT.TABLE_NAME=PARENT_INDEX.TABLE_NAME AND PARENT.TABLE_SCHEMA=PARENT_INDEX.TABLE_SCHEMA AND PARENT.TABLE_CATALOG=PARENT_INDEX.TABLE_CATALOG AND PARENT_INDEX.INDEX_TYPE='PRIMARY_KEY' -INNER JOIN INFORMATION_SCHEMA.INDEX_COLUMNS CHILD ON NOT PARENT.TABLE_NAME=CHILD.TABLE_NAME AND PARENT.COLUMN_NAME=CHILD.COLUMN_NAME -INNER JOIN INFORMATION_SCHEMA.INDEXES CHILD_INDEX ON CHILD.INDEX_NAME=CHILD_INDEX.INDEX_NAME AND CHILD.TABLE_NAME=CHILD_INDEX.TABLE_NAME AND CHILD.TABLE_SCHEMA=CHILD_INDEX.TABLE_SCHEMA AND CHILD.TABLE_CATALOG=CHILD_INDEX.TABLE_CATALOG AND CHILD_INDEX.INDEX_TYPE='PRIMARY_KEY' -INNER JOIN INFORMATION_SCHEMA.TABLES ON CHILD.TABLE_CATALOG=TABLES.TABLE_CATALOG AND CHILD.TABLE_SCHEMA=TABLES.TABLE_SCHEMA AND CHILD.TABLE_NAME=TABLES.TABLE_NAME AND PARENT.TABLE_NAME=TABLES.PARENT_TABLE_NAME -WHERE PARENT_INDEX.INDEX_TYPE='PRIMARY_KEY' AND CHILD.ORDINAL_POSITION IS NOT NULL -AND UPPER(PARENT.TABLE_CATALOG) LIKE ? -AND UPPER(PARENT.TABLE_SCHEMA) LIKE ? -AND UPPER(PARENT.TABLE_NAME) LIKE ? -AND UPPER(CHILD.TABLE_CATALOG) LIKE ? -AND UPPER(CHILD.TABLE_SCHEMA) LIKE ? -AND UPPER(CHILD.TABLE_NAME) LIKE ? -ORDER BY CHILD.TABLE_CATALOG, CHILD.TABLE_SCHEMA, CHILD.TABLE_NAME, CHILD.ORDINAL_POSITION \ No newline at end of file +SELECT * +FROM ( + SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, PARENT.TABLE_NAME AS PKTABLE_NAME, + PARENT.COLUMN_NAME AS PKCOLUMN_NAME, CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, + CHILD.TABLE_NAME AS FKTABLE_NAME, CHILD.COLUMN_NAME AS FKCOLUMN_NAME, CHILD.ORDINAL_POSITION AS KEY_SEQ, 3 AS UPDATE_RULE, + CASE WHEN TABLES.ON_DELETE_ACTION='CASCADE' THEN 0 ELSE 3 END AS DELETE_RULE, NULL AS FK_NAME, 'PRIMARY_KEY' AS PK_NAME, + 7 AS DEFERRABILITY + FROM INFORMATION_SCHEMA.INDEX_COLUMNS PARENT + INNER JOIN INFORMATION_SCHEMA.INDEXES PARENT_INDEX ON PARENT.INDEX_NAME=PARENT_INDEX.INDEX_NAME AND PARENT.TABLE_NAME=PARENT_INDEX.TABLE_NAME AND PARENT.TABLE_SCHEMA=PARENT_INDEX.TABLE_SCHEMA AND PARENT.TABLE_CATALOG=PARENT_INDEX.TABLE_CATALOG AND PARENT_INDEX.INDEX_TYPE='PRIMARY_KEY' + INNER JOIN INFORMATION_SCHEMA.INDEX_COLUMNS CHILD ON NOT PARENT.TABLE_NAME=CHILD.TABLE_NAME AND PARENT.COLUMN_NAME=CHILD.COLUMN_NAME + INNER JOIN INFORMATION_SCHEMA.INDEXES CHILD_INDEX ON CHILD.INDEX_NAME=CHILD_INDEX.INDEX_NAME AND CHILD.TABLE_NAME=CHILD_INDEX.TABLE_NAME AND CHILD.TABLE_SCHEMA=CHILD_INDEX.TABLE_SCHEMA AND CHILD.TABLE_CATALOG=CHILD_INDEX.TABLE_CATALOG AND CHILD_INDEX.INDEX_TYPE='PRIMARY_KEY' + INNER JOIN INFORMATION_SCHEMA.TABLES ON CHILD.TABLE_CATALOG=TABLES.TABLE_CATALOG AND CHILD.TABLE_SCHEMA=TABLES.TABLE_SCHEMA AND CHILD.TABLE_NAME=TABLES.TABLE_NAME AND PARENT.TABLE_NAME=TABLES.PARENT_TABLE_NAME + WHERE PARENT_INDEX.INDEX_TYPE='PRIMARY_KEY' AND CHILD.ORDINAL_POSITION IS NOT NULL + + UNION ALL + + SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, PARENT.TABLE_NAME AS PKTABLE_NAME, + PARENT.COLUMN_NAME AS PKCOLUMN_NAME, CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, + CHILD.TABLE_NAME AS FKTABLE_NAME, CHILD.COLUMN_NAME AS FKCOLUMN_NAME, CHILD.ORDINAL_POSITION AS KEY_SEQ, 3 AS UPDATE_RULE, + 3 AS DELETE_RULE, CONSTRAINTS.CONSTRAINT_NAME AS FK_NAME, CONSTRAINTS.UNIQUE_CONSTRAINT_NAME AS PK_NAME, + 7 AS DEFERRABILITY + FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS CONSTRAINTS + INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CHILD ON CONSTRAINTS.CONSTRAINT_CATALOG=CHILD.CONSTRAINT_CATALOG AND CONSTRAINTS.CONSTRAINT_SCHEMA= CHILD.CONSTRAINT_SCHEMA AND CONSTRAINTS.CONSTRAINT_NAME= CHILD.CONSTRAINT_NAME + INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE PARENT ON CONSTRAINTS.UNIQUE_CONSTRAINT_CATALOG=PARENT.CONSTRAINT_CATALOG AND CONSTRAINTS.UNIQUE_CONSTRAINT_SCHEMA=PARENT.CONSTRAINT_SCHEMA AND CONSTRAINTS.UNIQUE_CONSTRAINT_NAME=PARENT.CONSTRAINT_NAME AND PARENT.ORDINAL_POSITION=CHILD.POSITION_IN_UNIQUE_CONSTRAINT +) AS CROSS_REF +WHERE UPPER(PKTABLE_CAT) LIKE ? +AND UPPER(PKTABLE_SCHEM) LIKE ? +AND UPPER(PKTABLE_NAME) LIKE ? +AND UPPER(FKTABLE_CAT) LIKE ? +AND UPPER(FKTABLE_SCHEM) LIKE ? +AND UPPER(FKTABLE_NAME) LIKE ? +ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ diff --git a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetExportedKeys.sql b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetExportedKeys.sql index d83bf67da..631886d71 100644 --- a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetExportedKeys.sql +++ b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetExportedKeys.sql @@ -14,21 +14,38 @@ * limitations under the License. */ -SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, - PARENT.TABLE_NAME AS PKTABLE_NAME, PARENT_INDEX_COLUMNS.COLUMN_NAME AS PKCOLUMN_NAME, - CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, - CHILD.TABLE_NAME AS FKTABLE_NAME, PARENT_INDEX_COLUMNS.COLUMN_NAME AS FKCOLUMN_NAME, - PARENT_INDEX_COLUMNS.ORDINAL_POSITION AS KEY_SEQ, - 1 AS UPDATE_RULE, -- 1 = importedKeyRestrict - CASE WHEN CHILD.ON_DELETE_ACTION='CASCADE' THEN 0 ELSE 1 END AS DELETE_RULE, -- 0 = cascade - NULL AS FK_NAME, 'PRIMARY_KEY' AS PK_NAME, - 7 AS DEFERRABILITY -- 7 = importedKeyNotDeferrable -FROM INFORMATION_SCHEMA.TABLES PARENT -INNER JOIN INFORMATION_SCHEMA.TABLES CHILD ON CHILD.PARENT_TABLE_NAME=PARENT.TABLE_NAME -INNER JOIN INFORMATION_SCHEMA.INDEX_COLUMNS PARENT_INDEX_COLUMNS ON - PARENT_INDEX_COLUMNS.TABLE_NAME=PARENT.TABLE_NAME - AND PARENT_INDEX_COLUMNS.INDEX_NAME='PRIMARY_KEY' -WHERE UPPER(PARENT.TABLE_CATALOG) LIKE ? - AND UPPER(PARENT.TABLE_SCHEMA) LIKE ? - AND UPPER(PARENT.TABLE_NAME) LIKE ? -ORDER BY CHILD.TABLE_CATALOG, CHILD.TABLE_SCHEMA, CHILD.TABLE_NAME, PARENT_INDEX_COLUMNS.ORDINAL_POSITION +SELECT * +FROM ( + SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, + PARENT.TABLE_NAME AS PKTABLE_NAME, PARENT_INDEX_COLUMNS.COLUMN_NAME AS PKCOLUMN_NAME, + CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, + CHILD.TABLE_NAME AS FKTABLE_NAME, PARENT_INDEX_COLUMNS.COLUMN_NAME AS FKCOLUMN_NAME, + PARENT_INDEX_COLUMNS.ORDINAL_POSITION AS KEY_SEQ, + 1 AS UPDATE_RULE, -- 1 = importedKeyRestrict + CASE WHEN CHILD.ON_DELETE_ACTION='CASCADE' THEN 0 ELSE 1 END AS DELETE_RULE, -- 0 = cascade + NULL AS FK_NAME, 'PRIMARY_KEY' AS PK_NAME, + 7 AS DEFERRABILITY -- 7 = importedKeyNotDeferrable + FROM INFORMATION_SCHEMA.TABLES PARENT + INNER JOIN INFORMATION_SCHEMA.TABLES CHILD ON CHILD.PARENT_TABLE_NAME=PARENT.TABLE_NAME + INNER JOIN INFORMATION_SCHEMA.INDEX_COLUMNS PARENT_INDEX_COLUMNS ON + PARENT_INDEX_COLUMNS.TABLE_NAME=PARENT.TABLE_NAME + AND PARENT_INDEX_COLUMNS.INDEX_NAME='PRIMARY_KEY' + + UNION ALL + + SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, PARENT.TABLE_NAME AS PKTABLE_NAME, + PARENT.COLUMN_NAME AS PKCOLUMN_NAME, CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, + CHILD.TABLE_NAME AS FKTABLE_NAME, CHILD.COLUMN_NAME AS FKCOLUMN_NAME, + CHILD.ORDINAL_POSITION AS KEY_SEQ, + 1 AS UPDATE_RULE, -- 1 = importedKeyRestrict + 1 AS DELETE_RULE, -- 1 = importedKeyRestrict + CONSTRAINTS.CONSTRAINT_NAME AS FK_NAME, CONSTRAINTS.UNIQUE_CONSTRAINT_NAME AS PK_NAME, + 7 AS DEFERRABILITY -- 7 = importedKeyNotDeferrable + FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS CONSTRAINTS + INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CHILD ON CONSTRAINTS.CONSTRAINT_CATALOG=CHILD.CONSTRAINT_CATALOG AND CONSTRAINTS.CONSTRAINT_SCHEMA= CHILD.CONSTRAINT_SCHEMA AND CONSTRAINTS.CONSTRAINT_NAME= CHILD.CONSTRAINT_NAME + INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE PARENT ON CONSTRAINTS.UNIQUE_CONSTRAINT_CATALOG=PARENT.CONSTRAINT_CATALOG AND CONSTRAINTS.UNIQUE_CONSTRAINT_SCHEMA=PARENT.CONSTRAINT_SCHEMA AND CONSTRAINTS.UNIQUE_CONSTRAINT_NAME=PARENT.CONSTRAINT_NAME AND PARENT.ORDINAL_POSITION=CHILD.POSITION_IN_UNIQUE_CONSTRAINT +) EXPORTED_KEYS +WHERE UPPER(PKTABLE_CAT) LIKE ? + AND UPPER(PKTABLE_SCHEM) LIKE ? + AND UPPER(PKTABLE_NAME) LIKE ? +ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ diff --git a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetImportedKeys.sql b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetImportedKeys.sql index 4e7dc7aa4..50994a55b 100644 --- a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetImportedKeys.sql +++ b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetImportedKeys.sql @@ -14,21 +14,38 @@ * limitations under the License. */ -SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, - PARENT.TABLE_NAME AS PKTABLE_NAME, COL.COLUMN_NAME AS PKCOLUMN_NAME, - CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, - CHILD.TABLE_NAME AS FKTABLE_NAME, COL.COLUMN_NAME FKCOLUMN_NAME, - COL.ORDINAL_POSITION AS KEY_SEQ, - 1 AS UPDATE_RULE, -- 1 = importedKeyRestrict - CASE WHEN CHILD.ON_DELETE_ACTION = 'CASCADE' THEN 0 ELSE 1 END AS DELETE_RULE, -- 0 = cascade - NULL AS FK_NAME, INDEXES.INDEX_NAME AS PK_NAME, - 7 AS DEFERRABILITY -- 7 = importedKeyNotDeferrable -FROM INFORMATION_SCHEMA.TABLES CHILD -INNER JOIN INFORMATION_SCHEMA.TABLES PARENT ON CHILD.TABLE_CATALOG=PARENT.TABLE_CATALOG AND CHILD.TABLE_SCHEMA=PARENT.TABLE_SCHEMA AND CHILD.PARENT_TABLE_NAME=PARENT.TABLE_NAME -INNER JOIN INFORMATION_SCHEMA.INDEXES ON PARENT.TABLE_CATALOG=INDEXES.TABLE_CATALOG AND PARENT.TABLE_SCHEMA=INDEXES.TABLE_SCHEMA AND PARENT.TABLE_NAME=INDEXES.TABLE_NAME AND INDEXES.INDEX_TYPE='PRIMARY_KEY' -INNER JOIN INFORMATION_SCHEMA.INDEX_COLUMNS COL ON INDEXES.TABLE_CATALOG=COL.TABLE_CATALOG AND INDEXES.TABLE_SCHEMA=COL.TABLE_SCHEMA AND INDEXES.TABLE_NAME=COL.TABLE_NAME AND INDEXES.INDEX_NAME=COL.INDEX_NAME -WHERE CHILD.PARENT_TABLE_NAME IS NOT NULL - AND UPPER(CHILD.TABLE_CATALOG) LIKE ? - AND UPPER(CHILD.TABLE_SCHEMA) LIKE ? - AND UPPER(CHILD.TABLE_NAME) LIKE ? -ORDER BY PARENT.TABLE_CATALOG, PARENT.TABLE_SCHEMA, PARENT.TABLE_NAME, COL.ORDINAL_POSITION \ No newline at end of file +SELECT * +FROM ( + SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, + PARENT.TABLE_NAME AS PKTABLE_NAME, PARENT_INDEX_COLUMNS.COLUMN_NAME AS PKCOLUMN_NAME, + CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, + CHILD.TABLE_NAME AS FKTABLE_NAME, PARENT_INDEX_COLUMNS.COLUMN_NAME AS FKCOLUMN_NAME, + PARENT_INDEX_COLUMNS.ORDINAL_POSITION AS KEY_SEQ, + 1 AS UPDATE_RULE, -- 1 = importedKeyRestrict + CASE WHEN CHILD.ON_DELETE_ACTION='CASCADE' THEN 0 ELSE 1 END AS DELETE_RULE, -- 0 = cascade + NULL AS FK_NAME, 'PRIMARY_KEY' AS PK_NAME, + 7 AS DEFERRABILITY -- 7 = importedKeyNotDeferrable + FROM INFORMATION_SCHEMA.TABLES PARENT + INNER JOIN INFORMATION_SCHEMA.TABLES CHILD ON CHILD.PARENT_TABLE_NAME=PARENT.TABLE_NAME + INNER JOIN INFORMATION_SCHEMA.INDEX_COLUMNS PARENT_INDEX_COLUMNS ON + PARENT_INDEX_COLUMNS.TABLE_NAME=PARENT.TABLE_NAME + AND PARENT_INDEX_COLUMNS.INDEX_NAME='PRIMARY_KEY' + + UNION ALL + + SELECT PARENT.TABLE_CATALOG AS PKTABLE_CAT, PARENT.TABLE_SCHEMA AS PKTABLE_SCHEM, PARENT.TABLE_NAME AS PKTABLE_NAME, + PARENT.COLUMN_NAME AS PKCOLUMN_NAME, CHILD.TABLE_CATALOG AS FKTABLE_CAT, CHILD.TABLE_SCHEMA AS FKTABLE_SCHEM, + CHILD.TABLE_NAME AS FKTABLE_NAME, CHILD.COLUMN_NAME AS FKCOLUMN_NAME, + CHILD.ORDINAL_POSITION AS KEY_SEQ, + 1 AS UPDATE_RULE, -- 1 = importedKeyRestrict + 1 AS DELETE_RULE, -- 1 = importedKeyRestrict + CONSTRAINTS.CONSTRAINT_NAME AS FK_NAME, CONSTRAINTS.UNIQUE_CONSTRAINT_NAME AS PK_NAME, + 7 AS DEFERRABILITY -- 7 = importedKeyNotDeferrable + FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS CONSTRAINTS + INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CHILD ON CONSTRAINTS.CONSTRAINT_CATALOG=CHILD.CONSTRAINT_CATALOG AND CONSTRAINTS.CONSTRAINT_SCHEMA= CHILD.CONSTRAINT_SCHEMA AND CONSTRAINTS.CONSTRAINT_NAME= CHILD.CONSTRAINT_NAME + INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE PARENT ON CONSTRAINTS.UNIQUE_CONSTRAINT_CATALOG=PARENT.CONSTRAINT_CATALOG AND CONSTRAINTS.UNIQUE_CONSTRAINT_SCHEMA=PARENT.CONSTRAINT_SCHEMA AND CONSTRAINTS.UNIQUE_CONSTRAINT_NAME=PARENT.CONSTRAINT_NAME AND PARENT.ORDINAL_POSITION=CHILD.POSITION_IN_UNIQUE_CONSTRAINT +) IMPORTED_KEYS +WHERE UPPER(FKTABLE_CAT) LIKE ? + AND UPPER(FKTABLE_SCHEM) LIKE ? + AND UPPER(FKTABLE_NAME) LIKE ? +ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, KEY_SEQ diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java index a43f83c48..27d7a12f7 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java @@ -18,6 +18,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; @@ -44,7 +45,9 @@ public class ITJdbcDatabaseMetaDataTest extends ITAbstractJdbcTest { private static final String SINGERS_TABLE = "Singers"; private static final String ALBUMS_TABLE = "Albums"; private static final String SONGS_TABLE = "Songs"; + private static final String CONCERTS_TABLE = "Concerts"; private static final String TABLE_WITH_ALL_COLS = "TableWithAllColumnTypes"; + private static final String TABLE_WITH_REF = "TableWithRef"; @Override protected boolean doCreateMusicTables() { @@ -276,6 +279,109 @@ public void testGetCrossReferences() throws SQLException { rs.getShort("DEFERRABILITY"), is(equalTo((short) DatabaseMetaData.importedKeyNotDeferrable))); } + + try (ResultSet rs = + connection + .getMetaData() + .getCrossReference( + DEFAULT_CATALOG, + DEFAULT_SCHEMA, + SINGERS_TABLE, + DEFAULT_CATALOG, + DEFAULT_SCHEMA, + CONCERTS_TABLE)) { + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo("Singers"))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo("Concerts"))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 1))); + assertThat( + rs.getShort("UPDATE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat( + rs.getShort("DELETE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat(rs.getString("FK_NAME"), is(equalTo("Fk_Concerts_Singer"))); + assertThat(rs.getString("PK_NAME"), is(equalTo("PK_Singers"))); + assertThat( + rs.getShort("DEFERRABILITY"), + is(equalTo((short) DatabaseMetaData.importedKeyNotDeferrable))); + assertThat(rs.next(), is(false)); + } + + try (ResultSet rs = + connection + .getMetaData() + .getCrossReference( + DEFAULT_CATALOG, + DEFAULT_SCHEMA, + TABLE_WITH_ALL_COLS, + DEFAULT_CATALOG, + DEFAULT_SCHEMA, + TABLE_WITH_REF)) { + + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(TABLE_WITH_ALL_COLS))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("ColFloat64"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(TABLE_WITH_REF))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("RefFloat"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 1))); + assertThat( + rs.getShort("UPDATE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat( + rs.getShort("DELETE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat(rs.getString("FK_NAME"), is(equalTo("Fk_TableWithRef_TableWithAllColumnTypes"))); + assertThat( + rs.getShort("DEFERRABILITY"), + is(equalTo((short) DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(TABLE_WITH_ALL_COLS))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("ColString"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(TABLE_WITH_REF))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("RefString"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 2))); + assertThat( + rs.getShort("UPDATE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat( + rs.getShort("DELETE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat(rs.getString("FK_NAME"), is(equalTo("Fk_TableWithRef_TableWithAllColumnTypes"))); + assertThat( + rs.getShort("DEFERRABILITY"), + is(equalTo((short) DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(TABLE_WITH_ALL_COLS))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("ColDate"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(""))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(TABLE_WITH_REF))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("RefDate"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 3))); + assertThat( + rs.getShort("UPDATE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat( + rs.getShort("DELETE_RULE"), is(equalTo((short) DatabaseMetaData.importedKeyNoAction))); + assertThat(rs.getString("FK_NAME"), is(equalTo("Fk_TableWithRef_TableWithAllColumnTypes"))); + assertThat( + rs.getShort("DEFERRABILITY"), + is(equalTo((short) DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(false)); + } // try getting self-references try (ResultSet rs = connection @@ -292,7 +398,7 @@ public void testGetCrossReferences() throws SQLException { // try getting all cross-references in the database try (ResultSet rs = connection.getMetaData().getCrossReference(null, null, null, null, null, null)) { - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 7; i++) { assertThat(rs.next(), is(true)); } assertThat(rs.next(), is(false)); @@ -334,6 +440,13 @@ private IndexInfo( new IndexInfo("Concerts", false, "PRIMARY_KEY", 1, "VenueId", "A"), new IndexInfo("Concerts", false, "PRIMARY_KEY", 2, "SingerId", "A"), new IndexInfo("Concerts", false, "PRIMARY_KEY", 3, "ConcertDate", "A"), + new IndexInfo( + "Concerts", + true, + "FOREIGN_KEY", + 1, + "SingerId", + "A"), // Index automatically added by Cloud Spanner for the referencing column. new IndexInfo("Singers", false, "PRIMARY_KEY", 1, "SingerId", "A"), new IndexInfo("Singers", true, "SingersByFirstLastName", 1, "FirstName", "A"), new IndexInfo("Singers", true, "SingersByFirstLastName", 2, "LastName", "A"), @@ -344,7 +457,20 @@ private IndexInfo( new IndexInfo("Songs", false, "SongsBySingerAlbumSongNameDesc", 2, "AlbumId", "A"), new IndexInfo("Songs", false, "SongsBySingerAlbumSongNameDesc", 3, "SongName", "D"), new IndexInfo("Songs", true, "SongsBySongName", 1, "SongName", "A"), - new IndexInfo("TableWithAllColumnTypes", false, "PRIMARY_KEY", 1, "ColInt64", "A")); + new IndexInfo( + "TableWithAllColumnTypes", + false, + "GENERATED", + 1, + "ColFloat64", + "A"), // Index automatically added by Cloud Spanner for the referencing foreign key. + new IndexInfo("TableWithAllColumnTypes", false, "GENERATED", 2, "ColString", "A"), + new IndexInfo("TableWithAllColumnTypes", false, "GENERATED", 3, "ColDate", "A"), + new IndexInfo("TableWithAllColumnTypes", false, "PRIMARY_KEY", 1, "ColInt64", "A"), + new IndexInfo("TableWithRef", false, "PRIMARY_KEY", 1, "Id", "A"), + new IndexInfo("TableWithRef", true, "FOREIGN_KEY", 1, "RefFloat", "A"), + new IndexInfo("TableWithRef", true, "FOREIGN_KEY", 2, "RefString", "A"), + new IndexInfo("TableWithRef", true, "FOREIGN_KEY", 3, "RefDate", "A")); @Test public void testGetIndexInfo() throws SQLException { @@ -361,7 +487,10 @@ public void testGetIndexInfo() throws SQLException { assertThat(rs.getString("TABLE_NAME"), is(equalTo(index.tableName))); assertThat(rs.getBoolean("NON_UNIQUE"), is(index.nonUnique)); assertThat(rs.getString("INDEX_QUALIFIER"), is(equalTo(DEFAULT_CATALOG))); - assertThat(rs.getString("INDEX_NAME"), is(equalTo(index.indexName))); + // Foreign key index names are automatically generated. + if (!"FOREIGN_KEY".equals(index.indexName) && !"GENERATED".equals(index.indexName)) { + assertThat(rs.getString("INDEX_NAME"), is(equalTo(index.indexName))); + } if (index.indexName.equals("PRIMARY_KEY")) { assertThat(rs.getShort("TYPE"), is(equalTo(DatabaseMetaData.tableIndexClustered))); } else { @@ -390,7 +519,7 @@ public void testGetExportedKeys() throws SQLException { connection .getMetaData() .getExportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, SINGERS_TABLE)) { - assertKeysSingersAlbums(rs); + assertExportedKeysSingers(rs); } try (ResultSet rs = connection.getMetaData().getExportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, ALBUMS_TABLE)) { @@ -402,18 +531,92 @@ public void testGetExportedKeys() throws SQLException { @Test public void testGetImportedKeys() throws SQLException { try (Connection connection = createConnection()) { + try (ResultSet rs = + connection + .getMetaData() + .getImportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, SINGERS_TABLE)) { + assertImportedKeysSingers(rs); + } try (ResultSet rs = connection.getMetaData().getImportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, ALBUMS_TABLE)) { - assertKeysSingersAlbums(rs); + assertImportedKeysAlbums(rs); + } + try (ResultSet rs = + connection + .getMetaData() + .getImportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, CONCERTS_TABLE)) { + assertImportedKeysConcerts(rs); } try (ResultSet rs = connection.getMetaData().getImportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, SONGS_TABLE)) { assertKeysAlbumsSongs(rs); } + try (ResultSet rs = + connection + .getMetaData() + .getImportedKeys(DEFAULT_CATALOG, DEFAULT_SCHEMA, TABLE_WITH_REF)) { + assertImportedKeysTableWithRef(rs); + } } } - private void assertKeysSingersAlbums(ResultSet rs) throws SQLException { + private void assertImportedKeysSingers(ResultSet rs) throws SQLException { + assertThat(rs.next(), is(false)); + } + + private void assertImportedKeysTableWithRef(ResultSet rs) throws SQLException { + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(TABLE_WITH_ALL_COLS))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("ColFloat64"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(TABLE_WITH_REF))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("RefFloat"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 1))); + assertThat(rs.getInt("UPDATE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getInt("DELETE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getString("FK_NAME"), is("Fk_TableWithRef_TableWithAllColumnTypes")); + assertThat(rs.getString("PK_NAME"), is(notNullValue())); // Index name is generated. + assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(TABLE_WITH_ALL_COLS))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("ColString"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(TABLE_WITH_REF))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("RefString"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 2))); + assertThat(rs.getInt("UPDATE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getInt("DELETE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getString("FK_NAME"), is("Fk_TableWithRef_TableWithAllColumnTypes")); + assertThat(rs.getString("PK_NAME"), is(notNullValue())); // Index name is generated. + assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(TABLE_WITH_ALL_COLS))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("ColDate"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(TABLE_WITH_REF))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("RefDate"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 3))); + assertThat(rs.getInt("UPDATE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getInt("DELETE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getString("FK_NAME"), is("Fk_TableWithRef_TableWithAllColumnTypes")); + assertThat(rs.getString("PK_NAME"), is(notNullValue())); // Index name is generated. + assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(false)); + } + + private void assertImportedKeysAlbums(ResultSet rs) throws SQLException { assertThat(rs.next(), is(true)); assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); @@ -429,6 +632,63 @@ private void assertKeysSingersAlbums(ResultSet rs) throws SQLException { assertThat(rs.getString("FK_NAME"), is(nullValue())); assertThat(rs.getString("PK_NAME"), is(equalTo("PRIMARY_KEY"))); assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(false)); + } + + private void assertImportedKeysConcerts(ResultSet rs) throws SQLException { + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(SINGERS_TABLE))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(CONCERTS_TABLE))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 1))); + assertThat(rs.getInt("UPDATE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getInt("DELETE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getString("FK_NAME"), is("Fk_Concerts_Singer")); + assertThat(rs.getString("PK_NAME"), is(equalTo("PK_Singers"))); + assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(false)); + } + + private void assertExportedKeysSingers(ResultSet rs) throws SQLException { + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(SINGERS_TABLE))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(ALBUMS_TABLE))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 1))); + assertThat(rs.getInt("UPDATE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getInt("DELETE_RULE"), is(equalTo(DatabaseMetaData.importedKeyCascade))); + assertThat(rs.getString("FK_NAME"), is(nullValue())); + assertThat(rs.getString("PK_NAME"), is(equalTo("PRIMARY_KEY"))); + assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + + assertThat(rs.next(), is(true)); + assertThat(rs.getString("PKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("PKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("PKTABLE_NAME"), is(equalTo(SINGERS_TABLE))); + assertThat(rs.getString("PKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getString("FKTABLE_CAT"), is(equalTo(DEFAULT_CATALOG))); + assertThat(rs.getString("FKTABLE_SCHEM"), is(equalTo(DEFAULT_SCHEMA))); + assertThat(rs.getString("FKTABLE_NAME"), is(equalTo(CONCERTS_TABLE))); + assertThat(rs.getString("FKCOLUMN_NAME"), is(equalTo("SingerId"))); + assertThat(rs.getShort("KEY_SEQ"), is(equalTo((short) 1))); + assertThat(rs.getInt("UPDATE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getInt("DELETE_RULE"), is(equalTo(DatabaseMetaData.importedKeyRestrict))); + assertThat(rs.getString("FK_NAME"), is("Fk_Concerts_Singer")); + assertThat(rs.getString("PK_NAME"), is(equalTo("PK_Singers"))); + assertThat(rs.getInt("DEFERRABILITY"), is(equalTo(DatabaseMetaData.importedKeyNotDeferrable))); + assertThat(rs.next(), is(false)); } @@ -533,7 +793,8 @@ private Table(String name) { new Table("Concerts"), new Table("Singers"), new Table("Songs"), - new Table("TableWithAllColumnTypes")); + new Table("TableWithAllColumnTypes"), + new Table("TableWithRef")); @Test public void testGetTables() throws SQLException { diff --git a/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql b/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql index 896b8b9cb..5bbb90f6b 100644 --- a/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql +++ b/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql @@ -58,7 +58,8 @@ CREATE TABLE Concerts ( ConcertDate DATE NOT NULL, BeginTime TIMESTAMP, EndTime TIMESTAMP, - TicketPrices ARRAY + TicketPrices ARRAY, + CONSTRAINT Fk_Concerts_Singer FOREIGN KEY (SingerId) REFERENCES Singers (SingerId) ) PRIMARY KEY(VenueId, SingerId, ConcertDate); CREATE TABLE TableWithAllColumnTypes ( @@ -85,4 +86,15 @@ CREATE TABLE TableWithAllColumnTypes ( ) PRIMARY KEY (ColInt64) ; +CREATE TABLE TableWithRef ( + Id INT64 NOT NULL, + RefFloat FLOAT64 NOT NULL, + RefString STRING(100) NOT NULL, + RefDate DATE NOT NULL, + CONSTRAINT Fk_TableWithRef_TableWithAllColumnTypes + FOREIGN KEY (RefFloat, RefString, RefDate) + REFERENCES TableWithAllColumnTypes (ColFloat64, ColString, ColDate) +) PRIMARY KEY (Id) +; + RUN BATCH; \ No newline at end of file From a5e031d3183f8fe88a621500f235ca2b0242f50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Tue, 10 Mar 2020 06:25:24 +0100 Subject: [PATCH 26/34] fix: fix deprecation warnings in JDBC (test) files (#81) * fix: fix deprecation warnings in JDBC files * fix: fix typo in test case * fix: remove commented line of code --- .../jdbc/AbstractJdbcPreparedStatement.java | 1 + .../cloud/spanner/jdbc/JdbcResultSet.java | 4 + .../jdbc/JdbcAbortedTransactionTest.java | 103 +++++---- .../spanner/jdbc/JdbcConnectionTest.java | 129 ++++++------ .../cloud/spanner/jdbc/JdbcGrpcErrorTest.java | 116 ++++++---- .../jdbc/JdbcPreparedStatementTest.java | 5 +- .../cloud/spanner/jdbc/JdbcResultSetTest.java | 91 +++++--- .../cloud/spanner/jdbc/JdbcStatementTest.java | 198 ++++++++++-------- .../spanner/jdbc/it/ITJdbcReadOnlyTest.java | 4 - .../it/ITJdbcReadWriteAutocommitTest.java | 4 - .../jdbc/it/ITJdbcSimpleStatementsTest.java | 57 +++-- 11 files changed, 392 insertions(+), 320 deletions(-) diff --git a/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcPreparedStatement.java b/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcPreparedStatement.java index ef0c5af4b..52ac32c9c 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcPreparedStatement.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcPreparedStatement.java @@ -169,6 +169,7 @@ public void setAsciiStream(int parameterIndex, InputStream value, int length) } @Override + @Deprecated public void setUnicodeStream(int parameterIndex, InputStream value, int length) throws SQLException { checkClosed(); diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java b/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java index 00c6361ff..e9532554d 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java @@ -215,6 +215,7 @@ public InputStream getAsciiStream(int columnIndex) throws SQLException { } @Override + @Deprecated public InputStream getUnicodeStream(int columnIndex) throws SQLException { checkClosedAndValidRow(); return getInputStream(getString(columnIndex), StandardCharsets.UTF_16LE); @@ -314,6 +315,7 @@ public InputStream getAsciiStream(String columnLabel) throws SQLException { } @Override + @Deprecated public InputStream getUnicodeStream(String columnLabel) throws SQLException { checkClosedAndValidRow(); return getInputStream(getString(columnLabel), StandardCharsets.UTF_16LE); @@ -406,12 +408,14 @@ public BigDecimal getBigDecimal(String columnLabel) throws SQLException { } @Override + @Deprecated public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { checkClosedAndValidRow(); return getBigDecimal(columnIndex, true, scale); } @Override + @Deprecated public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { checkClosedAndValidRow(); return getBigDecimal(spanner.getColumnIndex(columnLabel) + 1, true, scale); diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcAbortedTransactionTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcAbortedTransactionTest.java index 7b9c4d050..681f60528 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcAbortedTransactionTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcAbortedTransactionTest.java @@ -16,11 +16,7 @@ package com.google.cloud.spanner.jdbc; -import static org.hamcrest.CoreMatchers.endsWith; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import com.google.cloud.Timestamp; @@ -53,9 +49,7 @@ import java.util.List; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; @@ -110,8 +104,6 @@ public void retryFinished( @Parameter(0) public boolean retryAbortsInternally; - @Rule public ExpectedException expected = ExpectedException.none(); - @Parameters(name = "retryAbortsInternally = {0}") public static Collection data() { List params = new ArrayList<>(); @@ -175,7 +167,7 @@ public void testAutocommitUpdateAborted() throws SQLException { try (java.sql.Connection connection = createConnection()) { mockSpanner.abortNextStatement(); int updateCount = connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); - assertThat(updateCount, is(equalTo(UPDATE_COUNT))); + assertThat(updateCount).isEqualTo(UPDATE_COUNT); } } @@ -183,15 +175,17 @@ public void testAutocommitUpdateAborted() throws SQLException { public void testTransactionalUpdateAborted() throws SQLException { // Updates in transactional mode are automatically retried by default, but this can be switched // off. - if (!retryAbortsInternally) { - expected.expect(JdbcAbortedException.class); - } try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); mockSpanner.abortNextStatement(); int updateCount = connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); - assertThat(updateCount, is(equalTo(UPDATE_COUNT))); - assertThat(getRetryCount(connection), is(equalTo(1))); + if (!retryAbortsInternally) { + fail("missing expected exception"); + } + assertThat(updateCount).isEqualTo(UPDATE_COUNT); + assertThat(getRetryCount(connection)).isEqualTo(1); + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } @@ -203,16 +197,13 @@ public void testAutocommitBatchUpdateAborted() throws SQLException { statement.addBatch(UPDATE_STATEMENT.getSql()); statement.addBatch(UPDATE_STATEMENT.getSql()); int[] updateCounts = statement.executeBatch(); - assertThat(updateCounts, is(equalTo(new int[] {UPDATE_COUNT, UPDATE_COUNT}))); + assertThat(updateCounts).asList().containsExactly(UPDATE_COUNT, UPDATE_COUNT); } } } @Test public void testTransactionalBatchUpdateAborted() throws SQLException { - if (!retryAbortsInternally) { - expected.expect(JdbcAbortedException.class); - } try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); mockSpanner.abortNextStatement(); @@ -220,8 +211,13 @@ public void testTransactionalBatchUpdateAborted() throws SQLException { statement.addBatch(UPDATE_STATEMENT.getSql()); statement.addBatch(UPDATE_STATEMENT.getSql()); int[] updateCounts = statement.executeBatch(); - assertThat(updateCounts, is(equalTo(new int[] {UPDATE_COUNT, UPDATE_COUNT}))); - assertThat(getRetryCount(connection), is(equalTo(1))); + if (!retryAbortsInternally) { + fail("missing expected exception"); + } + assertThat(updateCounts).asList().containsExactly(UPDATE_COUNT, UPDATE_COUNT); + assertThat(getRetryCount(connection)).isEqualTo(1); + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } } @@ -233,7 +229,7 @@ public void testAutocommitSelectAborted() throws SQLException { mockSpanner.abortNextStatement(); try (ResultSet rs = connection.createStatement().executeQuery(SELECT1.getSql())) { while (rs.next()) { - assertThat(rs.getLong(1), is(equalTo(1L))); + assertThat(rs.getLong(1)).isEqualTo(1L); } } } @@ -241,30 +237,27 @@ public void testAutocommitSelectAborted() throws SQLException { @Test public void testTransactionalSelectAborted() throws SQLException { - if (!retryAbortsInternally) { - expected.expect(JdbcAbortedException.class); - } try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); mockSpanner.abortNextStatement(); try (ResultSet rs = connection.createStatement().executeQuery(SELECT1.getSql())) { while (rs.next()) { - assertThat(rs.getLong(1), is(equalTo(1L))); + if (!retryAbortsInternally) { + fail("missing expected exception"); + } + assertThat(rs.getLong(1)).isEqualTo(1L); } } - assertThat(getRetryCount(connection), is(equalTo(1))); + assertThat(getRetryCount(connection)).isEqualTo(1); + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } @Test public void testTransactionalUpdateWithConcurrentModificationsAborted() throws SQLException { - if (retryAbortsInternally) { - // As the transaction does a random select, the retry will always see different data than the - // original attempt. - expected.expect(JdbcAbortedDueToConcurrentModificationException.class); - } else { - expected.expect(JdbcAbortedException.class); - } + // As the transaction does a random select, the retry will always see different data than the + // original attempt. try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); // Set a random answer. @@ -281,14 +274,15 @@ public void testTransactionalUpdateWithConcurrentModificationsAborted() throws S // This will abort and start an internal retry. connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); fail("missing expected aborted exception"); + } catch (JdbcAbortedDueToConcurrentModificationException e) { + assertThat(retryAbortsInternally).isTrue(); + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } @Test public void testTransactionalUpdateWithErrorOnOriginalAndRetry() throws SQLException { - if (!retryAbortsInternally) { - expected.expect(JdbcAbortedException.class); - } final String sql = "UPDATE SOMETHING SET OTHER=1"; mockSpanner.putStatementResult( StatementResult.exception( @@ -298,7 +292,7 @@ public void testTransactionalUpdateWithErrorOnOriginalAndRetry() throws SQLExcep connection.setAutoCommit(false); try (ResultSet rs = connection.createStatement().executeQuery(SELECT1.getSql())) { while (rs.next()) { - assertThat(rs.getLong(1), is(equalTo(1L))); + assertThat(rs.getLong(1)).isEqualTo(1L); } } try { @@ -309,16 +303,16 @@ public void testTransactionalUpdateWithErrorOnOriginalAndRetry() throws SQLExcep } mockSpanner.abortNextStatement(); connection.commit(); + if (!retryAbortsInternally) { + fail("missing expected exception"); + } + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } @Test public void testTransactionalUpdateWithErrorOnRetryAndNotOnOriginal() throws SQLException { - if (retryAbortsInternally) { - expected.expect(JdbcAbortedDueToConcurrentModificationException.class); - } else { - expected.expect(JdbcAbortedException.class); - } final String sql = "UPDATE SOMETHING SET OTHER=1"; try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); @@ -335,20 +329,17 @@ public void testTransactionalUpdateWithErrorOnRetryAndNotOnOriginal() throws SQL connection.commit(); fail("missing expected aborted exception"); } catch (JdbcAbortedDueToConcurrentModificationException e) { - assertThat( - e.getDatabaseErrorDuringRetry().getErrorCode(), is(equalTo(ErrorCode.INVALID_ARGUMENT))); - assertThat(e.getDatabaseErrorDuringRetry().getMessage(), endsWith("test")); - throw e; + assertThat(retryAbortsInternally).isTrue(); + assertThat(e.getDatabaseErrorDuringRetry().getErrorCode()) + .isEqualTo(ErrorCode.INVALID_ARGUMENT); + assertThat(e.getDatabaseErrorDuringRetry().getMessage()).endsWith("test"); + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } @Test public void testTransactionalUpdateWithErrorOnOriginalAndNotOnRetry() throws SQLException { - if (retryAbortsInternally) { - expected.expect(JdbcAbortedDueToConcurrentModificationException.class); - } else { - expected.expect(JdbcAbortedException.class); - } final String sql = "UPDATE SOMETHING SET OTHER=1"; mockSpanner.putStatementResult( StatementResult.exception( @@ -358,7 +349,7 @@ public void testTransactionalUpdateWithErrorOnOriginalAndNotOnRetry() throws SQL connection.setAutoCommit(false); try (ResultSet rs = connection.createStatement().executeQuery(SELECT1.getSql())) { while (rs.next()) { - assertThat(rs.getLong(1), is(equalTo(1L))); + assertThat(rs.getLong(1)).isEqualTo(1L); } } try { @@ -373,8 +364,10 @@ public void testTransactionalUpdateWithErrorOnOriginalAndNotOnRetry() throws SQL connection.commit(); fail("missing expected aborted exception"); } catch (JdbcAbortedDueToConcurrentModificationException e) { - assertThat(e.getDatabaseErrorDuringRetry(), is(nullValue())); - throw e; + assertThat(retryAbortsInternally).isTrue(); + assertThat(e.getDatabaseErrorDuringRetry()).isNull(); + } catch (JdbcAbortedException e) { + assertThat(retryAbortsInternally).isFalse(); } } } diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java index 3d9c77caf..8d49440a5 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcConnectionTest.java @@ -16,11 +16,8 @@ package com.google.cloud.spanner.jdbc; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -48,15 +45,12 @@ import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class JdbcConnectionTest { - @Rule public final ExpectedException exception = ExpectedException.none(); private static final com.google.cloud.spanner.ResultSet SELECT1_RESULTSET = ResultSets.forRows( Type.struct(StructField.of("", Type.int64())), @@ -76,14 +70,14 @@ public void testAutoCommit() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); when(options.isAutocommit()).thenReturn(true); try (Connection connection = createConnection(options)) { - assertThat(connection.getAutoCommit(), is(true)); + assertThat(connection.getAutoCommit()).isTrue(); connection.setAutoCommit(false); - assertThat(connection.getAutoCommit(), is(false)); + assertThat(connection.getAutoCommit()).isFalse(); // execute a query that will start a transaction connection.createStatement().executeQuery(AbstractConnectionImplTest.SELECT); // setting autocommit will automatically commit the transaction connection.setAutoCommit(true); - assertThat(connection.getAutoCommit(), is(true)); + assertThat(connection.getAutoCommit()).isTrue(); } } @@ -93,14 +87,16 @@ public void testReadOnly() throws SQLException { when(options.isAutocommit()).thenReturn(true); when(options.isReadOnly()).thenReturn(true); try (Connection connection = createConnection(options)) { - assertThat(connection.isReadOnly(), is(true)); + assertThat(connection.isReadOnly()).isTrue(); connection.setReadOnly(false); - assertThat(connection.isReadOnly(), is(false)); + assertThat(connection.isReadOnly()).isFalse(); // start a transaction connection.createStatement().execute("begin transaction"); // setting readonly should no longer be allowed - exception.expect(JdbcExceptionMatcher.matchCode(Code.FAILED_PRECONDITION)); connection.setReadOnly(true); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(JdbcExceptionMatcher.matchCode(Code.FAILED_PRECONDITION).matches(e)).isTrue(); } } @@ -109,17 +105,17 @@ public void testCommit() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); try (JdbcConnection connection = createConnection(options)) { // verify that there is no transaction started - assertThat(connection.getSpannerConnection().isTransactionStarted(), is(false)); + assertThat(connection.getSpannerConnection().isTransactionStarted()).isFalse(); // start a transaction connection.createStatement().execute(AbstractConnectionImplTest.SELECT); // verify that we did start a transaction - assertThat(connection.getSpannerConnection().isTransactionStarted(), is(true)); + assertThat(connection.getSpannerConnection().isTransactionStarted()).isTrue(); // do a commit connection.commit(); // verify that there is no transaction started anymore - assertThat(connection.getSpannerConnection().isTransactionStarted(), is(false)); + assertThat(connection.getSpannerConnection().isTransactionStarted()).isFalse(); // verify that there is a commit timestamp - assertThat(connection.getSpannerConnection().getCommitTimestamp(), is(notNullValue())); + assertThat(connection.getSpannerConnection().getCommitTimestamp()).isNotNull(); } } @@ -128,20 +124,20 @@ public void testRollback() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); try (JdbcConnection connection = createConnection(options)) { // verify that there is no transaction started - assertThat(connection.getSpannerConnection().isTransactionStarted(), is(false)); + assertThat(connection.getSpannerConnection().isTransactionStarted()).isFalse(); // start a transaction connection.createStatement().execute(AbstractConnectionImplTest.SELECT); // verify that we did start a transaction - assertThat(connection.getSpannerConnection().isTransactionStarted(), is(true)); + assertThat(connection.getSpannerConnection().isTransactionStarted()).isTrue(); // do a rollback connection.rollback(); // verify that there is no transaction started anymore - assertThat(connection.getSpannerConnection().isTransactionStarted(), is(false)); + assertThat(connection.getSpannerConnection().isTransactionStarted()).isFalse(); // verify that there is no commit timestamp try (ResultSet rs = connection.createStatement().executeQuery("show variable commit_timestamp")) { - assertThat(rs.next(), is(true)); - assertThat(rs.getTimestamp("COMMIT_TIMESTAMP"), is(nullValue())); + assertThat(rs.next()).isTrue(); + assertThat(rs.getTimestamp("COMMIT_TIMESTAMP")).isNull(); } } } @@ -310,18 +306,17 @@ private void testInvokeMethodOnClosedConnection(Method method, Object... args) valid = true; } } - assertThat( - "Method did not throw exception on closed connection: " + method.getName(), - valid, - is(true)); + assertWithMessage("Method did not throw exception on closed connection: " + method.getName()) + .that(valid) + .isTrue(); } @Test public void testTransactionIsolation() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); try (JdbcConnection connection = createConnection(options)) { - assertThat( - connection.getTransactionIsolation(), is(equalTo(Connection.TRANSACTION_SERIALIZABLE))); + assertThat(connection.getTransactionIsolation()) + .isEqualTo(Connection.TRANSACTION_SERIALIZABLE); // assert that setting it to this value is ok. connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); // assert that setting it to something else is not ok. @@ -347,7 +342,7 @@ public void testTransactionIsolation() throws SQLException { && ((JdbcSqlException) e).getCode() == Code.UNIMPLEMENTED); } } - assertThat(exception, is(true)); + assertThat(exception).isTrue(); } } } @@ -356,7 +351,7 @@ public void testTransactionIsolation() throws SQLException { public void testHoldability() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); try (JdbcConnection connection = createConnection(options)) { - assertThat(connection.getHoldability(), is(equalTo(ResultSet.CLOSE_CURSORS_AT_COMMIT))); + assertThat(connection.getHoldability()).isEqualTo(ResultSet.CLOSE_CURSORS_AT_COMMIT); // assert that setting it to this value is ok. connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT); // assert that setting it to something else is not ok. @@ -376,7 +371,7 @@ public void testHoldability() throws SQLException { && ((JdbcSqlException) e).getCode() == Code.UNIMPLEMENTED); } } - assertThat(exception, is(true)); + assertThat(exception).isTrue(); } } } @@ -385,24 +380,24 @@ public void testHoldability() throws SQLException { public void testWarnings() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); try (JdbcConnection connection = createConnection(options)) { - assertThat(connection.getWarnings(), is(nullValue())); + assertThat((Object) connection.getWarnings()).isNull(); // Push one warning and get it twice. connection.pushWarning(new SQLWarning("test")); - assertThat(connection.getWarnings().getMessage(), is(equalTo("test"))); - assertThat(connection.getWarnings().getMessage(), is(equalTo("test"))); + assertThat(connection.getWarnings().getMessage()).isEqualTo("test"); + assertThat(connection.getWarnings().getMessage()).isEqualTo("test"); // Clear warnings and push two warnings and get them both. connection.clearWarnings(); connection.pushWarning(new SQLWarning("test 1")); connection.pushWarning(new SQLWarning("test 2")); - assertThat(connection.getWarnings().getMessage(), is(equalTo("test 1"))); - assertThat(connection.getWarnings().getMessage(), is(equalTo("test 1"))); - assertThat(connection.getWarnings().getNextWarning().getMessage(), is(equalTo("test 2"))); + assertThat(connection.getWarnings().getMessage()).isEqualTo("test 1"); + assertThat(connection.getWarnings().getMessage()).isEqualTo("test 1"); + assertThat(connection.getWarnings().getNextWarning().getMessage()).isEqualTo("test 2"); // Clear warnings. connection.clearWarnings(); - assertThat(connection.getWarnings(), is(nullValue())); + assertThat((Object) connection.getWarnings()).isNull(); } } @@ -410,23 +405,21 @@ public void testWarnings() throws SQLException { public void testSetClientInfo() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); try (JdbcConnection connection = createConnection(options)) { - assertThat(connection.getWarnings(), is(nullValue())); + assertThat((Object) connection.getWarnings()).isNull(); connection.setClientInfo("test", "foo"); - assertThat(connection.getWarnings(), is(notNullValue())); - assertThat( - connection.getWarnings().getMessage(), - is(equalTo(AbstractJdbcConnection.CLIENT_INFO_NOT_SUPPORTED))); + assertThat((Object) connection.getWarnings()).isNotNull(); + assertThat(connection.getWarnings().getMessage()) + .isEqualTo(AbstractJdbcConnection.CLIENT_INFO_NOT_SUPPORTED); connection.clearWarnings(); - assertThat(connection.getWarnings(), is(nullValue())); + assertThat((Object) connection.getWarnings()).isNull(); Properties props = new Properties(); props.setProperty("test", "foo"); connection.setClientInfo(props); - assertThat(connection.getWarnings(), is(notNullValue())); - assertThat( - connection.getWarnings().getMessage(), - is(equalTo(AbstractJdbcConnection.CLIENT_INFO_NOT_SUPPORTED))); + assertThat((Object) connection.getWarnings()).isNotNull(); + assertThat(connection.getWarnings().getMessage()) + .isEqualTo(AbstractJdbcConnection.CLIENT_INFO_NOT_SUPPORTED); } } @@ -442,13 +435,13 @@ public void testIsValid() throws SQLException { // Verify that an opened connection that returns a result set is valid. try (JdbcConnection connection = new JdbcConnection("url", options)) { when(spannerConnection.executeQuery(statement)).thenReturn(SELECT1_RESULTSET); - assertThat(connection.isValid(1), is(true)); + assertThat(connection.isValid(1)).isTrue(); try { // Invalid timeout value. connection.isValid(-1); fail("missing expected exception"); } catch (JdbcSqlExceptionImpl e) { - assertThat(e.getCode(), is(equalTo(Code.INVALID_ARGUMENT))); + assertThat(e.getCode()).isEqualTo(Code.INVALID_ARGUMENT); } // Now let the query return an error. isValid should now return false. @@ -456,7 +449,7 @@ public void testIsValid() throws SQLException { .thenThrow( SpannerExceptionFactory.newSpannerException( ErrorCode.ABORTED, "the current transaction has been aborted")); - assertThat(connection.isValid(1), is(false)); + assertThat(connection.isValid(1)).isFalse(); } } @@ -464,7 +457,7 @@ public void testIsValid() throws SQLException { public void testIsValidOnClosedConnection() throws SQLException { Connection connection = createConnection(mock(ConnectionOptions.class)); connection.close(); - assertThat(connection.isValid(1), is(false)); + assertThat(connection.isValid(1)).isFalse(); } @Test @@ -483,8 +476,8 @@ public void testCreateStatement() throws SQLException { { java.sql.Statement statement = connection.createStatement(resultSetType, resultSetConcurrency); - assertThat(statement.getResultSetType(), is(equalTo(resultSetType))); - assertThat(statement.getResultSetConcurrency(), is(equalTo(resultSetConcurrency))); + assertThat(statement.getResultSetType()).isEqualTo(resultSetType); + assertThat(statement.getResultSetConcurrency()).isEqualTo(resultSetConcurrency); } else { assertCreateStatementFails(connection, resultSetType, resultSetConcurrency); } @@ -499,9 +492,9 @@ public void testCreateStatement() throws SQLException { java.sql.Statement statement = connection.createStatement( resultSetType, resultSetConcurrency, resultSetHoldability); - assertThat(statement.getResultSetType(), is(equalTo(resultSetType))); - assertThat(statement.getResultSetConcurrency(), is(equalTo(resultSetConcurrency))); - assertThat(statement.getResultSetHoldability(), is(equalTo(resultSetHoldability))); + assertThat(statement.getResultSetType()).isEqualTo(resultSetType); + assertThat(statement.getResultSetConcurrency()).isEqualTo(resultSetConcurrency); + assertThat(statement.getResultSetHoldability()).isEqualTo(resultSetHoldability); } else { assertCreateStatementFails( connection, resultSetType, resultSetConcurrency, resultSetHoldability); @@ -557,8 +550,8 @@ public void testPrepareStatement() throws SQLException { { PreparedStatement ps = connection.prepareStatement("SELECT 1", resultSetType, resultSetConcurrency); - assertThat(ps.getResultSetType(), is(equalTo(resultSetType))); - assertThat(ps.getResultSetConcurrency(), is(equalTo(resultSetConcurrency))); + assertThat(ps.getResultSetType()).isEqualTo(resultSetType); + assertThat(ps.getResultSetConcurrency()).isEqualTo(resultSetConcurrency); } else { assertPrepareStatementFails(connection, resultSetType, resultSetConcurrency); } @@ -573,9 +566,9 @@ public void testPrepareStatement() throws SQLException { PreparedStatement ps = connection.prepareStatement( "SELECT 1", resultSetType, resultSetConcurrency, resultSetHoldability); - assertThat(ps.getResultSetType(), is(equalTo(resultSetType))); - assertThat(ps.getResultSetConcurrency(), is(equalTo(resultSetConcurrency))); - assertThat(ps.getResultSetHoldability(), is(equalTo(resultSetHoldability))); + assertThat(ps.getResultSetType()).isEqualTo(resultSetType); + assertThat(ps.getResultSetConcurrency()).isEqualTo(resultSetConcurrency); + assertThat(ps.getResultSetHoldability()).isEqualTo(resultSetHoldability); } else { assertPrepareStatementFails( connection, resultSetType, resultSetConcurrency, resultSetHoldability); @@ -623,7 +616,7 @@ public void testPrepareStatementWithAutoGeneratedKeys() throws SQLException { PreparedStatement statement = connection.prepareStatement(sql, java.sql.Statement.NO_GENERATED_KEYS); ResultSet rs = statement.getGeneratedKeys(); - assertThat(rs.next(), is(false)); + assertThat(rs.next()).isFalse(); try { statement = connection.prepareStatement(sql, java.sql.Statement.RETURN_GENERATED_KEYS); fail("missing expected SQLFeatureNotSupportedException"); @@ -638,7 +631,7 @@ public void testCatalog() throws SQLException { ConnectionOptions options = mock(ConnectionOptions.class); when(options.getDatabaseName()).thenReturn("test"); try (JdbcConnection connection = createConnection(options)) { - assertThat(connection.getCatalog(), is(equalTo("test"))); + assertThat(connection.getCatalog()).isEqualTo("test"); // This should be allowed. connection.setCatalog(""); try { @@ -646,7 +639,7 @@ public void testCatalog() throws SQLException { connection.setCatalog("other"); fail("missing expected exception"); } catch (JdbcSqlExceptionImpl e) { - assertThat(e.getCode(), is(equalTo(Code.INVALID_ARGUMENT))); + assertThat(e.getCode()).isEqualTo(Code.INVALID_ARGUMENT); } } } @@ -654,7 +647,7 @@ public void testCatalog() throws SQLException { @Test public void testSchema() throws SQLException { try (JdbcConnection connection = createConnection(mock(ConnectionOptions.class))) { - assertThat(connection.getSchema(), is(equalTo(""))); + assertThat(connection.getSchema()).isEqualTo(""); // This should be allowed. connection.setSchema(""); try { @@ -662,7 +655,7 @@ public void testSchema() throws SQLException { connection.setSchema("other"); fail("missing expected exception"); } catch (JdbcSqlExceptionImpl e) { - assertThat(e.getCode(), is(equalTo(Code.INVALID_ARGUMENT))); + assertThat(e.getCode()).isEqualTo(Code.INVALID_ARGUMENT); } } } diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcGrpcErrorTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcGrpcErrorTest.java index 06ea2a343..a902207b8 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcGrpcErrorTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcGrpcErrorTest.java @@ -16,6 +16,9 @@ package com.google.cloud.spanner.jdbc; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + import com.google.cloud.spanner.MockSpannerServiceImpl; import com.google.cloud.spanner.MockSpannerServiceImpl.SimulatedExecutionTime; import com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult; @@ -43,9 +46,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -84,7 +85,6 @@ public class JdbcGrpcErrorTest { private static Server server; private static InetSocketAddress address; - @Rule public ExpectedException expected = ExpectedException.none(); // FAILED_PRECONDITION is chosen as the test error code as it should never be retryable. private final Exception serverException = Status.FAILED_PRECONDITION.withDescription("test exception").asRuntimeException(); @@ -143,87 +143,100 @@ private Connection createConnection() throws SQLException { @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void autocommitBeginTransaction() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitBeginTransaction() { mockSpanner.setBeginTransactionExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void autocommitBeginPDMLTransaction() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitBeginPDMLTransaction() { mockSpanner.setBeginTransactionExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().execute("SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'"); connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void transactionalBeginTransaction() throws SQLException { - expected.expect(testExceptionMatcher); + public void transactionalBeginTransaction() { mockSpanner.setBeginTransactionExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void readOnlyBeginTransaction() throws SQLException { - expected.expect(testExceptionMatcher); + public void readOnlyBeginTransaction() { mockSpanner.setBeginTransactionExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.setReadOnly(true); connection.createStatement().executeQuery(SELECT1.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void autocommitExecuteSql() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitExecuteSql() { mockSpanner.setExecuteSqlExecutionTime(SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void autocommitPDMLExecuteSql() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitPDMLExecuteSql() { mockSpanner.setExecuteSqlExecutionTime(SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().execute("SET AUTOCOMMIT_DML_MODE='PARTITIONED_NON_ATOMIC'"); connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void transactionalExecuteSql() throws SQLException { - expected.expect(testExceptionMatcher); + public void transactionalExecuteSql() { mockSpanner.setExecuteSqlExecutionTime(SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test public void autocommitExecuteBatchDml() throws SQLException { - expected.expect(testExceptionMatcher); mockSpanner.setExecuteBatchDmlExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { @@ -231,13 +244,15 @@ public void autocommitExecuteBatchDml() throws SQLException { statement.addBatch(UPDATE_STATEMENT.getSql()); statement.addBatch(UPDATE_STATEMENT.getSql()); statement.executeBatch(); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } } @Test public void transactionalExecuteBatchDml() throws SQLException { - expected.expect(testExceptionMatcher); mockSpanner.setExecuteBatchDmlExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { @@ -246,40 +261,51 @@ public void transactionalExecuteBatchDml() throws SQLException { statement.addBatch(UPDATE_STATEMENT.getSql()); statement.addBatch(UPDATE_STATEMENT.getSql()); statement.executeBatch(); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } } @Test - public void autocommitCommit() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitCommit() { mockSpanner.setCommitExecutionTime(SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void transactionalCommit() throws SQLException { - expected.expect(testExceptionMatcher); + public void transactionalCommit() { mockSpanner.setCommitExecutionTime(SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); connection.commit(); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void autocommitRollback() throws SQLException { + public void autocommitRollback() { // The JDBC driver should throw the exception of the SQL statement and ignore any errors from // the rollback() method. - expected.expect( - SpannerJdbcExceptionMatcher.matchCodeAndMessage( - JdbcSqlExceptionImpl.class, Code.NOT_FOUND, "Unknown table name")); mockSpanner.setRollbackExecutionTime(SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().executeUpdate(INVALID_UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + SpannerJdbcExceptionMatcher.matchCodeAndMessage( + JdbcSqlExceptionImpl.class, Code.NOT_FOUND, "Unknown table name") + .matches(e)) + .isTrue(); } } @@ -296,74 +322,86 @@ public void transactionalRollback() throws SQLException { } @Test - public void autocommitExecuteStreamingSql() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitExecuteStreamingSql() { mockSpanner.setExecuteStreamingSqlExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().executeQuery(SELECT1.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void transactionalExecuteStreamingSql() throws SQLException { - expected.expect(testExceptionMatcher); + public void transactionalExecuteStreamingSql() { mockSpanner.setExecuteStreamingSqlExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.createStatement().executeQuery(SELECT1.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Test - public void readOnlyExecuteStreamingSql() throws SQLException { - expected.expect(testExceptionMatcher); + public void readOnlyExecuteStreamingSql() { mockSpanner.setExecuteStreamingSqlExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.setReadOnly(true); connection.createStatement().executeQuery(SELECT1.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void autocommitCreateSession() throws SQLException { - expected.expect(testExceptionMatcher); + public void autocommitCreateSession() { mockSpanner.setBatchCreateSessionsExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void transactionalCreateSession() throws SQLException { - expected.expect(testExceptionMatcher); + public void transactionalCreateSession() { mockSpanner.setBatchCreateSessionsExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.createStatement().executeUpdate(UPDATE_STATEMENT.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } @Ignore( "This can only be guaranteed with MinSessions=0. Re-enable when MinSessions is configurable for JDBC.") @Test - public void readOnlyCreateSession() throws SQLException { - expected.expect(testExceptionMatcher); + public void readOnlyCreateSession() { mockSpanner.setBatchCreateSessionsExecutionTime( SimulatedExecutionTime.ofException(serverException)); try (java.sql.Connection connection = createConnection()) { connection.setAutoCommit(false); connection.setReadOnly(true); connection.createStatement().executeQuery(SELECT1.getSql()); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(testExceptionMatcher.matches(e)).isTrue(); } } } diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcPreparedStatementTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcPreparedStatementTest.java index c72db1ec4..9b829e54e 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcPreparedStatementTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcPreparedStatementTest.java @@ -50,16 +50,12 @@ import java.util.Calendar; import java.util.TimeZone; import org.junit.Assert; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class JdbcPreparedStatementTest { - @Rule public final ExpectedException thrown = ExpectedException.none(); - private String generateSqlWithParameters(int numberOfParams) { StringBuilder sql = new StringBuilder("INSERT INTO FOO ("); boolean first = true; @@ -100,6 +96,7 @@ private JdbcConnection createMockConnection(Connection spanner) throws SQLExcept return connection; } + @SuppressWarnings("deprecation") @Test public void testParameters() throws SQLException, MalformedURLException { final int numberOfParams = 48; diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java index d564ad0f2..44eefa970 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java @@ -16,12 +16,14 @@ package com.google.cloud.spanner.jdbc; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; 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 static org.mockito.Mockito.mock; import com.google.cloud.ByteArray; @@ -33,6 +35,7 @@ import com.google.cloud.spanner.Type; import com.google.cloud.spanner.Type.StructField; import com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory.JdbcSqlExceptionImpl; +import io.grpc.Status.Code; import java.io.IOException; import java.io.InputStream; import java.io.Reader; @@ -50,9 +53,7 @@ import java.util.HashMap; import java.util.Map; import java.util.TimeZone; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -111,8 +112,6 @@ public class JdbcResultSetTest { private static final int URL_COLINDEX_NULL = 19; private static final int URL_COLINDEX_NOTNULL = 20; - @Rule public ExpectedException thrown = ExpectedException.none(); - private JdbcResultSet subject; static ResultSet getMockResultSet() { @@ -262,10 +261,19 @@ public void testGetURLIndex() throws SQLException, MalformedURLException { } @Test - public void testGetURLIndexInvalid() throws SQLException, MalformedURLException { - thrown.expect(JdbcSqlExceptionImpl.class); - thrown.expectMessage("Invalid URL"); - assertNotNull(subject.getURL(STRING_COLINDEX_NOTNULL)); + public void testGetURLIndexInvalid() throws SQLException { + try { + subject.getURL(STRING_COLINDEX_NOTNULL); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + SpannerJdbcExceptionMatcher.matchCodeAndMessage( + JdbcSqlExceptionImpl.class, + Code.INVALID_ARGUMENT, + "Invalid URL: " + subject.getString(STRING_COLINDEX_NOTNULL)) + .matches(e)) + .isTrue(); + } } @Test @@ -294,6 +302,7 @@ public void testGetDoubleIndex() throws SQLException { assertTrue(subject.wasNull()); } + @SuppressWarnings("deprecation") @Test public void testGetBigDecimalIndexAndScale() throws SQLException { assertNotNull(subject.getBigDecimal(DOUBLE_COLINDEX_NOTNULL, 2)); @@ -376,9 +385,18 @@ public void testGetURLLabel() throws SQLException { @Test public void testGetURLLabelInvalid() throws SQLException { - thrown.expect(JdbcSqlExceptionImpl.class); - thrown.expectMessage("Invalid URL"); - assertNotNull(subject.getURL(STRING_COL_NOT_NULL)); + try { + subject.getURL(STRING_COL_NOT_NULL); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + SpannerJdbcExceptionMatcher.matchCodeAndMessage( + JdbcSqlExceptionImpl.class, + Code.INVALID_ARGUMENT, + "Invalid URL: " + subject.getString(STRING_COL_NOT_NULL)) + .matches(e)) + .isTrue(); + } } @Test @@ -407,6 +425,7 @@ public void testGetDoubleLabel() throws SQLException { assertTrue(subject.wasNull()); } + @SuppressWarnings("deprecation") @Test public void testGetBigDecimalLabelAndScale() throws SQLException { assertNotNull(subject.getBigDecimal(DOUBLE_COL_NOT_NULL, 2)); @@ -839,6 +858,7 @@ public void testGetAsciiStreamIndex() throws SQLException, IOException { assertTrue(subject.wasNull()); } + @SuppressWarnings("deprecation") @Test public void testGetUnicodeStreamIndex() throws SQLException, IOException { assertNotNull(subject.getUnicodeStream(STRING_COLINDEX_NOTNULL)); @@ -861,7 +881,7 @@ public void testGetBinaryStreamIndex() throws SQLException, IOException { assertArrayEquals(BYTES_VALUE.toByteArray(), cbuf); assertEquals(3, len); assertFalse(subject.wasNull()); - assertNull(subject.getUnicodeStream(BYTES_COLINDEX_NULL)); + assertNull(subject.getBinaryStream(BYTES_COLINDEX_NULL)); assertTrue(subject.wasNull()); } @@ -878,6 +898,7 @@ public void testGetAsciiStreamLabel() throws SQLException, IOException { assertTrue(subject.wasNull()); } + @SuppressWarnings("deprecation") @Test public void testGetUnicodeStreamLabel() throws SQLException, IOException { assertNotNull(subject.getUnicodeStream(STRING_COL_NOT_NULL)); @@ -900,39 +921,59 @@ public void testGetBinaryStreamLabel() throws SQLException, IOException { assertArrayEquals(ByteArray.copyFrom("FOO").toByteArray(), cbuf); assertEquals(3, len); assertFalse(subject.wasNull()); - assertNull(subject.getUnicodeStream(BYTES_COL_NULL)); + assertNull(subject.getBinaryStream(BYTES_COL_NULL)); assertTrue(subject.wasNull()); } @Test - public void testGetBeforeNext() throws SQLException { + public void testGetBeforeNext() { try (JdbcResultSet rs = JdbcResultSet.of(mock(Statement.class), getMockResultSet())) { - thrown.expect(SQLException.class); - thrown.expectMessage( - "FAILED_PRECONDITION: ResultSet is before first row. Call next() first."); rs.getBigDecimal(LONG_COLINDEX_NOTNULL); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + SpannerJdbcExceptionMatcher.matchCodeAndMessage( + JdbcSqlExceptionImpl.class, + Code.FAILED_PRECONDITION, + "ResultSet is before first row. Call next() first.") + .matches(e)) + .isTrue(); } } @Test - public void testGetAfterLast() throws SQLException { + public void testGetAfterLast() { try (JdbcResultSet rs = JdbcResultSet.of(mock(Statement.class), getMockResultSet())) { while (rs.next()) { // do nothing } - thrown.expect(SQLException.class); - thrown.expectMessage( - "FAILED_PRECONDITION: ResultSet is after last row. There is no more data available."); rs.getBigDecimal(LONG_COLINDEX_NOTNULL); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + SpannerJdbcExceptionMatcher.matchCodeAndMessage( + JdbcSqlExceptionImpl.class, + Code.FAILED_PRECONDITION, + "ResultSet is after last row. There is no more data available.") + .matches(e)) + .isTrue(); } } @Test public void testFindIllegalColumnName() throws SQLException { - thrown.expect(SQLException.class); - thrown.expectMessage("INVALID_ARGUMENT: no column with label " + UNKNOWN_COLUMN + " found"); - int index = subject.findColumn(UNKNOWN_COLUMN); - assertEquals(0, index); + try { + subject.findColumn(UNKNOWN_COLUMN); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + SpannerJdbcExceptionMatcher.matchCodeAndMessage( + JdbcSqlExceptionImpl.class, + Code.INVALID_ARGUMENT, + "no column with label " + UNKNOWN_COLUMN + " found") + .matches(e)) + .isTrue(); + } } @Test diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcStatementTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcStatementTest.java index 28bb25849..12e0921e3 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcStatementTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcStatementTest.java @@ -16,11 +16,7 @@ package com.google.cloud.spanner.jdbc; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -39,9 +35,7 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Matchers; @@ -50,14 +44,11 @@ @RunWith(JUnit4.class) public class JdbcStatementTest { - @Rule public final ExpectedException thrown = ExpectedException.none(); private static final String SELECT = "SELECT 1"; private static final String UPDATE = "UPDATE FOO SET BAR=1 WHERE BAZ=2"; private static final String LARGE_UPDATE = "UPDATE FOO SET BAR=1 WHERE 1=1"; private static final String DDL = "CREATE INDEX FOO ON BAR(ID)"; - @Rule public final ExpectedException expected = ExpectedException.none(); - private JdbcStatement createStatement() { Connection spanner = mock(Connection.class); @@ -140,13 +131,13 @@ public void testQueryTimeout() throws SQLException { when(result.getResultSet()).thenReturn(mock(com.google.cloud.spanner.ResultSet.class)); when(spanner.execute(com.google.cloud.spanner.Statement.of(select))).thenReturn(result); try (Statement statement = new JdbcStatement(connection)) { - assertThat(statement.getQueryTimeout(), is(equalTo(0))); + assertThat(statement.getQueryTimeout()).isEqualTo(0); statement.setQueryTimeout(1); - assertThat(statement.getQueryTimeout(), is(equalTo(1))); + assertThat(statement.getQueryTimeout()).isEqualTo(1); statement.setQueryTimeout(99); - assertThat(statement.getQueryTimeout(), is(equalTo(99))); + assertThat(statement.getQueryTimeout()).isEqualTo(99); statement.setQueryTimeout(0); - assertThat(statement.getQueryTimeout(), is(equalTo(0))); + assertThat(statement.getQueryTimeout()).isEqualTo(0); } when(spanner.getStatementTimeout(TimeUnit.SECONDS)).thenReturn(1L); @@ -155,7 +146,7 @@ public void testQueryTimeout() throws SQLException { when(spanner.getStatementTimeout(TimeUnit.NANOSECONDS)).thenReturn(1000000000L); when(spanner.hasStatementTimeout()).thenReturn(true); try (Statement statement = new JdbcStatement(connection)) { - assertThat(statement.getQueryTimeout(), is(equalTo(0))); + assertThat(statement.getQueryTimeout()).isEqualTo(0); statement.execute(select); // statement has no timeout, so it should also not be set on the connection verify(spanner, never()).setStatementTimeout(1L, TimeUnit.SECONDS); @@ -175,12 +166,12 @@ public void testQueryTimeout() throws SQLException { public void testExecuteWithSelectStatement() throws SQLException { Statement statement = createStatement(); boolean res = statement.execute(SELECT); - assertThat(res, is(true)); - assertThat(statement.getUpdateCount(), is(equalTo(JdbcConstants.STATEMENT_RESULT_SET))); + assertThat(res).isTrue(); + assertThat(statement.getUpdateCount()).isEqualTo(JdbcConstants.STATEMENT_RESULT_SET); try (ResultSet rs = statement.getResultSet()) { - assertThat(rs, is(notNullValue())); - assertThat(rs.next(), is(true)); - assertThat(rs.getLong(1), is(equalTo(1L))); + assertThat(rs).isNotNull(); + assertThat(rs.next()).isTrue(); + assertThat(rs.getLong(1)).isEqualTo(1L); } } @@ -188,16 +179,16 @@ public void testExecuteWithSelectStatement() throws SQLException { public void testExecuteWithUpdateStatement() throws SQLException { Statement statement = createStatement(); boolean res = statement.execute(UPDATE); - assertThat(res, is(false)); - assertThat(statement.getResultSet(), is(nullValue())); - assertThat(statement.getUpdateCount(), is(equalTo(1))); + assertThat(res).isFalse(); + assertThat(statement.getResultSet()).isNull(); + assertThat(statement.getUpdateCount()).isEqualTo(1); try { - assertThat(statement.execute(LARGE_UPDATE), is(false)); - assertThat(statement.getResultSet(), is(nullValue())); + assertThat(statement.execute(LARGE_UPDATE)).isFalse(); + assertThat(statement.getResultSet()).isNull(); statement.getUpdateCount(); fail("missing expected exception"); } catch (JdbcSqlExceptionImpl e) { - assertThat(e.getCode(), is(equalTo(Code.OUT_OF_RANGE))); + assertThat(e.getCode()).isEqualTo(Code.OUT_OF_RANGE); } } @@ -205,17 +196,17 @@ public void testExecuteWithUpdateStatement() throws SQLException { public void testExecuteWithDdlStatement() throws SQLException { Statement statement = createStatement(); boolean res = statement.execute(DDL); - assertThat(res, is(false)); - assertThat(statement.getResultSet(), is(nullValue())); - assertThat(statement.getUpdateCount(), is(equalTo(JdbcConstants.STATEMENT_NO_RESULT))); + assertThat(res).isFalse(); + assertThat(statement.getResultSet()).isNull(); + assertThat(statement.getUpdateCount()).isEqualTo(JdbcConstants.STATEMENT_NO_RESULT); } @Test public void testExecuteWithGeneratedKeys() throws SQLException { Statement statement = createStatement(); - assertThat(statement.execute(UPDATE, Statement.NO_GENERATED_KEYS), is(false)); + assertThat(statement.execute(UPDATE, Statement.NO_GENERATED_KEYS)).isFalse(); ResultSet keys = statement.getGeneratedKeys(); - assertThat(keys.next(), is(false)); + assertThat(keys.next()).isFalse(); try { statement.execute(UPDATE, Statement.RETURN_GENERATED_KEYS); fail("missing expected exception"); @@ -228,59 +219,79 @@ public void testExecuteWithGeneratedKeys() throws SQLException { public void testExecuteQuery() throws SQLException { Statement statement = createStatement(); try (ResultSet rs = statement.executeQuery(SELECT)) { - assertThat(rs, is(notNullValue())); - assertThat(rs.next(), is(true)); - assertThat(rs.getLong(1), is(equalTo(1L))); + assertThat(rs).isNotNull(); + assertThat(rs.next()).isTrue(); + assertThat(rs.getLong(1)).isEqualTo(1L); } } @Test - public void testExecuteQueryWithUpdateStatement() throws SQLException { + public void testExecuteQueryWithUpdateStatement() { Statement statement = createStatement(); - expected.expect(JdbcExceptionMatcher.matchCodeAndMessage(Code.INVALID_ARGUMENT, "not a query")); - statement.executeQuery(UPDATE); + try { + statement.executeQuery(UPDATE); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + JdbcExceptionMatcher.matchCodeAndMessage(Code.INVALID_ARGUMENT, "not a query") + .matches(e)) + .isTrue(); + } } @Test - public void testExecuteQueryWithDdlStatement() throws SQLException { + public void testExecuteQueryWithDdlStatement() { Statement statement = createStatement(); - expected.expect(JdbcExceptionMatcher.matchCodeAndMessage(Code.INVALID_ARGUMENT, "not a query")); - statement.executeQuery(DDL); + try { + statement.executeQuery(DDL); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + JdbcExceptionMatcher.matchCodeAndMessage(Code.INVALID_ARGUMENT, "not a query") + .matches(e)) + .isTrue(); + } } @Test public void testExecuteUpdate() throws SQLException { Statement statement = createStatement(); - assertThat(statement.executeUpdate(UPDATE), is(equalTo(1))); + assertThat(statement.executeUpdate(UPDATE)).isEqualTo(1); try { statement.executeUpdate(LARGE_UPDATE); fail("missing expected exception"); } catch (JdbcSqlExceptionImpl e) { - assertThat(e.getCode(), is(equalTo(Code.OUT_OF_RANGE))); + assertThat(e.getCode()).isEqualTo(Code.OUT_OF_RANGE); } } @Test public void testExecuteUpdateWithSelectStatement() throws SQLException { Statement statement = createStatement(); - expected.expect( - JdbcExceptionMatcher.matchCodeAndMessage( - Code.INVALID_ARGUMENT, "The statement is not an update or DDL statement")); - statement.executeUpdate(SELECT); + try { + statement.executeUpdate(SELECT); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + JdbcExceptionMatcher.matchCodeAndMessage( + Code.INVALID_ARGUMENT, "The statement is not an update or DDL statement") + .matches(e)) + .isTrue(); + } } @Test public void testExecuteUpdateWithDdlStatement() throws SQLException { Statement statement = createStatement(); - assertThat(statement.executeUpdate(DDL), is(equalTo(0))); + assertThat(statement.executeUpdate(DDL)).isEqualTo(0); } @Test public void testExecuteUpdateWithGeneratedKeys() throws SQLException { Statement statement = createStatement(); - assertThat(statement.executeUpdate(UPDATE, Statement.NO_GENERATED_KEYS), is(equalTo(1))); + assertThat(statement.executeUpdate(UPDATE, Statement.NO_GENERATED_KEYS)).isEqualTo(1); ResultSet keys = statement.getGeneratedKeys(); - assertThat(keys.next(), is(false)); + assertThat(keys.next()).isFalse(); try { statement.executeUpdate(UPDATE, Statement.RETURN_GENERATED_KEYS); fail("missing expected exception"); @@ -292,36 +303,46 @@ public void testExecuteUpdateWithGeneratedKeys() throws SQLException { @Test public void testMoreResults() throws SQLException { Statement statement = createStatement(); - assertThat(statement.execute(SELECT), is(true)); + assertThat(statement.execute(SELECT)).isTrue(); ResultSet rs = statement.getResultSet(); - assertThat(statement.getMoreResults(), is(false)); - assertThat(statement.getResultSet(), is(nullValue())); - assertThat(rs.isClosed(), is(true)); + assertThat(statement.getMoreResults()).isFalse(); + assertThat(statement.getResultSet()).isNull(); + assertThat(rs.isClosed()).isTrue(); - assertThat(statement.execute(SELECT), is(true)); + assertThat(statement.execute(SELECT)).isTrue(); rs = statement.getResultSet(); - assertThat(statement.getMoreResults(Statement.KEEP_CURRENT_RESULT), is(false)); - assertThat(statement.getResultSet(), is(nullValue())); - assertThat(rs.isClosed(), is(false)); + assertThat(statement.getMoreResults(Statement.KEEP_CURRENT_RESULT)).isFalse(); + assertThat(statement.getResultSet()).isNull(); + assertThat(rs.isClosed()).isFalse(); } @Test - public void testNoBatchMixing() throws SQLException { - thrown.expect(SQLException.class); - thrown.expectMessage("Mixing DML and DDL statements in a batch is not allowed."); + public void testNoBatchMixing() { try (Statement statement = createStatement()) { statement.addBatch("INSERT INTO FOO (ID, NAME) VALUES (1, 'FOO')"); statement.addBatch("CREATE TABLE FOO (ID INT64, NAME STRING(100)) PRIMARY KEY (ID)"); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat( + JdbcExceptionMatcher.matchCodeAndMessage( + Code.INVALID_ARGUMENT, + "Mixing DML and DDL statements in a batch is not allowed.") + .matches(e)) + .isTrue(); } } @Test - public void testNoBatchQuery() throws SQLException { - thrown.expect(SQLException.class); - thrown.expectMessage( - "The statement is not suitable for batching. Only DML and DDL statements are allowed for batching."); + public void testNoBatchQuery() { try (Statement statement = createStatement()) { statement.addBatch("SELECT * FROM FOO"); + } catch (SQLException e) { + assertThat( + JdbcExceptionMatcher.matchCodeAndMessage( + Code.INVALID_ARGUMENT, + "The statement is not suitable for batching. Only DML and DDL statements are allowed for batching.") + .matches(e)) + .isTrue(); } } @@ -333,7 +354,7 @@ public void testDmlBatch() throws SQLException { statement.addBatch("INSERT INTO FOO (ID, NAME) VALUES (1, 'TEST')"); statement.addBatch("INSERT INTO FOO (ID, NAME) VALUES (2, 'TEST')"); statement.addBatch("INSERT INTO FOO (ID, NAME) VALUES (3, 'TEST')"); - assertThat(statement.executeBatch(), is(equalTo(new int[] {1, 1, 1}))); + assertThat(statement.executeBatch()).asList().containsExactly(1, 1, 1); } } } @@ -342,12 +363,14 @@ public void testDmlBatch() throws SQLException { public void testConvertUpdateCounts() throws SQLException { try (JdbcStatement statement = new JdbcStatement(mock(JdbcConnection.class))) { int[] updateCounts = statement.convertUpdateCounts(new long[] {1L, 2L, 3L}); - assertThat(updateCounts, is(equalTo(new int[] {1, 2, 3}))); + assertThat(updateCounts).asList().containsExactly(1, 2, 3); updateCounts = statement.convertUpdateCounts(new long[] {0L, 0L, 0L}); - assertThat(updateCounts, is(equalTo(new int[] {0, 0, 0}))); + assertThat(updateCounts).asList().containsExactly(0, 0, 0); - expected.expect(JdbcExceptionMatcher.matchCode(Code.OUT_OF_RANGE)); statement.convertUpdateCounts(new long[] {1L, Integer.MAX_VALUE + 1L}); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(JdbcExceptionMatcher.matchCode(Code.OUT_OF_RANGE).matches(e)).isTrue(); } } @@ -356,35 +379,28 @@ public void testConvertUpdateCountsToSuccessNoInfo() throws SQLException { try (JdbcStatement statement = new JdbcStatement(mock(JdbcConnection.class))) { int[] updateCounts = new int[3]; statement.convertUpdateCountsToSuccessNoInfo(new long[] {1L, 2L, 3L}, updateCounts); - assertThat( - updateCounts, - is( - equalTo( - new int[] { - Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO - }))); + assertThat(updateCounts) + .asList() + .containsExactly( + Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO); statement.convertUpdateCountsToSuccessNoInfo(new long[] {0L, 0L, 0L}, updateCounts); - assertThat( - updateCounts, - is( - equalTo( - new int[] { - Statement.EXECUTE_FAILED, Statement.EXECUTE_FAILED, Statement.EXECUTE_FAILED - }))); + assertThat(updateCounts) + .asList() + .containsExactly( + Statement.EXECUTE_FAILED, Statement.EXECUTE_FAILED, Statement.EXECUTE_FAILED); statement.convertUpdateCountsToSuccessNoInfo(new long[] {1L, 0L, 2L}, updateCounts); - assertThat( - updateCounts, - is( - equalTo( - new int[] { - Statement.SUCCESS_NO_INFO, Statement.EXECUTE_FAILED, Statement.SUCCESS_NO_INFO - }))); - - expected.expect(JdbcExceptionMatcher.matchCode(Code.OUT_OF_RANGE)); + assertThat(updateCounts) + .asList() + .containsExactly( + Statement.SUCCESS_NO_INFO, Statement.EXECUTE_FAILED, Statement.SUCCESS_NO_INFO); + statement.convertUpdateCountsToSuccessNoInfo( new long[] {1L, Integer.MAX_VALUE + 1L}, updateCounts); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(JdbcExceptionMatcher.matchCode(Code.OUT_OF_RANGE).matches(e)).isTrue(); } } } diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java index 8e083f592..061f2e8de 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java @@ -29,10 +29,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -42,8 +40,6 @@ public class ITJdbcReadOnlyTest extends ITAbstractJdbcTest { private static final long TEST_ROWS_COUNT = 1000L; - @Rule public ExpectedException exception = ExpectedException.none(); - @Override protected void appendConnectionUri(StringBuilder url) { url.append(";readOnly=true"); diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadWriteAutocommitTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadWriteAutocommitTest.java index dba6764fc..fdc8bb890 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadWriteAutocommitTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadWriteAutocommitTest.java @@ -27,10 +27,8 @@ import com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier; import com.google.cloud.spanner.jdbc.SqlScriptVerifier; import org.junit.FixMethodOrder; -import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.junit.runners.MethodSorters; @@ -40,8 +38,6 @@ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ITJdbcReadWriteAutocommitTest extends ITAbstractJdbcTest { - @Rule public ExpectedException exception = ExpectedException.none(); - @Override protected void appendConnectionUri(StringBuilder uri) { uri.append(";autocommit=true"); diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSimpleStatementsTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSimpleStatementsTest.java index a1130f2b6..15f25b919 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSimpleStatementsTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcSimpleStatementsTest.java @@ -16,9 +16,8 @@ package com.google.cloud.spanner.jdbc.it; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.jdbc.ITAbstractJdbcTest; @@ -27,10 +26,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -38,15 +35,13 @@ @RunWith(JUnit4.class) @Category(IntegrationTest.class) public class ITJdbcSimpleStatementsTest extends ITAbstractJdbcTest { - @Rule public final ExpectedException expected = ExpectedException.none(); - @Test public void testSelect1() throws SQLException { try (Connection connection = createConnection()) { try (ResultSet rs = connection.createStatement().executeQuery("select 1")) { - assertThat(rs.next(), is(true)); - assertThat(rs.getInt(1), is(equalTo(1))); - assertThat(rs.next(), is(false)); + assertThat(rs.next()).isTrue(); + assertThat(rs.getInt(1)).isEqualTo(1); + assertThat(rs.next()).isFalse(); } } } @@ -56,9 +51,9 @@ public void testSelect1PreparedStatement() throws SQLException { try (Connection connection = createConnection()) { try (PreparedStatement ps = connection.prepareStatement("select 1")) { try (ResultSet rs = ps.executeQuery()) { - assertThat(rs.next(), is(true)); - assertThat(rs.getInt(1), is(equalTo(1))); - assertThat(rs.next(), is(false)); + assertThat(rs.next()).isTrue(); + assertThat(rs.getInt(1)).isEqualTo(1); + assertThat(rs.next()).isFalse(); } } } @@ -73,9 +68,9 @@ public void testPreparedStatement() throws SQLException { for (int i = 1; i <= 3; i++) { ps.setInt(1, i); try (ResultSet rs = ps.executeQuery()) { - assertThat(rs.next(), is(true)); - assertThat(rs.getInt(1), is(equalTo(i))); - assertThat(rs.next(), is(false)); + assertThat(rs.next()).isTrue(); + assertThat(rs.getInt(1)).isEqualTo(i); + assertThat(rs.next()).isFalse(); } } } @@ -92,17 +87,17 @@ public void testBatchedDdlStatements() throws SQLException { statement.addBatch( "CREATE TABLE FOO2 (ID INT64 NOT NULL, NAME STRING(100)) PRIMARY KEY (ID)"); int[] updateCounts = statement.executeBatch(); - assertThat( - updateCounts, - is(equalTo(new int[] {Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO}))); + assertThat(updateCounts) + .asList() + .containsExactly(Statement.SUCCESS_NO_INFO, Statement.SUCCESS_NO_INFO); } try (ResultSet rs = connection .createStatement() .executeQuery( "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='' AND TABLE_NAME LIKE 'FOO%'")) { - assertThat(rs.next(), is(true)); - assertThat(rs.getLong(1), is(equalTo(2L))); + assertThat(rs.next()).isTrue(); + assertThat(rs.getLong(1)).isEqualTo(2L); } } // Execute a batch of DDL statements that contains a statement that will fail. @@ -121,35 +116,37 @@ public void testBatchedDdlStatements() throws SQLException { } catch (SQLException e) { gotExpectedException = true; } - assertThat(gotExpectedException, is(true)); + assertThat(gotExpectedException).isTrue(); // The table should have been created, the index should not. try (ResultSet rs = connection .createStatement() .executeQuery( "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='' AND TABLE_NAME LIKE 'FOO%'")) { - assertThat(rs.next(), is(true)); - assertThat(rs.getLong(1), is(equalTo(3L))); + assertThat(rs.next()).isTrue(); + assertThat(rs.getLong(1)).isEqualTo(3L); } try (ResultSet rs = connection .createStatement() .executeQuery( "SELECT COUNT(*) FROM INFORMATION_SCHEMA.INDEXES WHERE TABLE_SCHEMA='' AND INDEX_NAME='IDX_FOO1_UNIQUE'")) { - assertThat(rs.next(), is(true)); - assertThat(rs.getLong(1), is(equalTo(0L))); + assertThat(rs.next()).isTrue(); + assertThat(rs.getLong(1)).isEqualTo(0L); } } } @Test - public void testAddBatchWhenAlreadyInBatch() throws SQLException { - expected.expect(SQLException.class); - expected.expectMessage( - "Calling addBatch() is not allowed when a DML or DDL batch has been started on the connection."); + public void testAddBatchWhenAlreadyInBatch() { try (Connection connection = createConnection()) { connection.createStatement().execute("START BATCH DML"); connection.createStatement().addBatch("INSERT INTO Singers (SingerId) VALUES (-1)"); + fail("missing expected exception"); + } catch (SQLException e) { + assertThat(e.getMessage()) + .contains( + "Calling addBatch() is not allowed when a DML or DDL batch has been started on the connection."); } } } From 0642e6a5a808bfbc83cb3e17de22a5cc10ab29bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Fri, 13 Mar 2020 06:57:33 +0100 Subject: [PATCH 27/34] tests: unflake max staleness read tests (#86) --- .../com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java | 2 ++ .../google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java | 2 ++ .../com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java index 061f2e8de..163f555e0 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java @@ -84,6 +84,8 @@ public void createTestTables() throws Exception { @Test public void testSqlScript() throws Exception { + // Wait 100ms to ensure that staleness tests in the script succeed. + Thread.sleep(100L); JdbcSqlScriptVerifier verifier = new JdbcSqlScriptVerifier(new ITJdbcConnectionProvider()); verifier.verifyStatementsInFile("ITReadOnlySpannerTest.sql", SqlScriptVerifier.class); } diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java index 51882c66e..599a9cf65 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java @@ -101,6 +101,8 @@ public void createTestTables() throws Exception { @Test public void testSqlScript() throws Exception { + // Wait 100ms to ensure that staleness tests in the script succeed. + Thread.sleep(100L); SqlScriptVerifier verifier = new SqlScriptVerifier(new ITConnectionProvider()); verifier.verifyStatementsInFile("ITReadOnlySpannerTest.sql", SqlScriptVerifier.class); } diff --git a/src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql b/src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql index 8f8f66944..0dc041075 100644 --- a/src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql +++ b/src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql @@ -109,9 +109,9 @@ SHOW VARIABLE READ_TIMESTAMP; NEW_CONNECTION; ---TimestampBound.ofExactStaleness(100, TimeUnit.MILLISECONDS), +--TimestampBound.ofExactStaleness(1, TimeUnit.MILLISECONDS), -SET READ_ONLY_STALENESS = 'EXACT_STALENESS 100ms'; +SET READ_ONLY_STALENESS = 'EXACT_STALENESS 1ms'; @EXPECT RESULT_SET SELECT COUNT(*) AS ACTUAL, 1000 AS EXPECTED FROM NUMBERS; From 89153e284238431c9cf8d042c51cfc885ee4e3b9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 16 Mar 2020 16:12:21 +0100 Subject: [PATCH 28/34] build(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.2.0 (#88) This PR contains the following updates: | Package | Update | Change | |---|---|---| | org.apache.maven.plugins:maven-javadoc-plugin | minor | `3.1.1` -> `3.2.0` | --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-spanner-jdbc). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6d3ce9547..a78b77df9 100644 --- a/pom.xml +++ b/pom.xml @@ -483,7 +483,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.2.0 html From 342baf193778950a1d10ae231dc55364443ec90d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 16 Mar 2020 08:29:06 -0700 Subject: [PATCH 29/34] chore: update PR template (#87) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-03-14 02:16:59,517 synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py. .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/release-please.yml .github/trusted-contribution.yml .kokoro/build.bat .kokoro/build.sh .kokoro/coerce_logs.sh .kokoro/common.cfg .kokoro/continuous/common.cfg .kokoro/continuous/dependencies.cfg .kokoro/continuous/integration.cfg .kokoro/continuous/java11.cfg .kokoro/continuous/java7.cfg .kokoro/continuous/java8-osx.cfg .kokoro/continuous/java8-win.cfg .kokoro/continuous/java8.cfg .kokoro/continuous/lint.cfg .kokoro/continuous/propose_release.cfg .kokoro/continuous/samples.cfg .kokoro/dependencies.sh .kokoro/linkage-monitor.sh .kokoro/nightly/common.cfg .kokoro/nightly/dependencies.cfg .kokoro/nightly/integration.cfg .kokoro/nightly/java11.cfg .kokoro/nightly/java7.cfg .kokoro/nightly/java8-osx.cfg .kokoro/nightly/java8-win.cfg .kokoro/nightly/java8.cfg .kokoro/nightly/lint.cfg .kokoro/nightly/samples.cfg .kokoro/presubmit/clirr.cfg .kokoro/presubmit/common.cfg .kokoro/presubmit/dependencies.cfg .kokoro/presubmit/integration.cfg .kokoro/presubmit/java11.cfg .kokoro/presubmit/java7.cfg .kokoro/presubmit/java8-osx.cfg .kokoro/presubmit/java8-win.cfg .kokoro/presubmit/java8.cfg .kokoro/presubmit/linkage-monitor.cfg .kokoro/presubmit/lint.cfg .kokoro/presubmit/samples.cfg .kokoro/release/bump_snapshot.cfg .kokoro/release/common.cfg .kokoro/release/common.sh .kokoro/release/drop.cfg .kokoro/release/drop.sh .kokoro/release/promote.cfg .kokoro/release/promote.sh .kokoro/release/publish_javadoc.cfg .kokoro/release/publish_javadoc.sh .kokoro/release/snapshot.cfg .kokoro/release/snapshot.sh .kokoro/release/stage.cfg .kokoro/release/stage.sh .kokoro/trampoline.sh CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md codecov.yaml java.header license-checks.xml renovate.json 2020-03-14 02:16:59,709 synthtool > Wrote metadata to synth.metadata. ```
--- .github/PULL_REQUEST_TEMPLATE.md | 8 +++++++- synth.metadata | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0bd0ee062..528458893 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1 +1,7 @@ -Fixes # (it's a good idea to open an issue first for context and/or discussion) \ No newline at end of file +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-spanner-jdbc/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ diff --git a/synth.metadata b/synth.metadata index 796dab977..699d0d71b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-02-24T23:15:28.206977Z", + "updateTime": "2020-03-14T09:16:59.709595Z", "sources": [ { "template": { From cfa153997599c36f1243e87f1ea0760694657dfe Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 16 Mar 2020 23:41:34 +0100 Subject: [PATCH 30/34] deps: update core dependencies (#73) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a78b77df9..4c17942bd 100644 --- a/pom.xml +++ b/pom.xml @@ -58,9 +58,9 @@ google-cloud-spanner-jdbc - 1.27.2 + 1.28.0 1.30.9 - 1.92.5 + 1.93.3 1.54.0 1.34.2 28.2-android From 4fff168eae61fb55933cf3afd67f24ca65dfde54 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 17 Mar 2020 00:14:04 +0100 Subject: [PATCH 31/34] deps: update spanner.version to v1.51.0 (#75) This PR contains the following updates: | Package | Update | Change | |---|---|---| | com.google.api.grpc:grpc-google-cloud-spanner-admin-database-v1 | minor | `1.49.2` -> `1.51.0` | | com.google.api.grpc:grpc-google-cloud-spanner-admin-instance-v1 | minor | `1.49.2` -> `1.51.0` | | com.google.api.grpc:grpc-google-cloud-spanner-v1 | minor | `1.49.2` -> `1.51.0` | | [com.google.cloud:google-cloud-spanner](https://togithub.com/googleapis/java-spanner) | minor | `1.49.2` -> `1.51.0` | | com.google.api.grpc:proto-google-cloud-spanner-admin-database-v1 | minor | `1.49.2` -> `1.51.0` | | com.google.api.grpc:proto-google-cloud-spanner-v1 | minor | `1.49.2` -> `1.51.0` | --- ### Release Notes
googleapis/java-spanner ### [`v1.51.0`](https://togithub.com/googleapis/java-spanner/blob/master/CHANGELOG.md#​1510httpswwwgithubcomgoogleapisjava-spannercomparev1500v1510-2020-03-13) [Compare Source](https://togithub.com/googleapis/java-spanner/compare/v1.50.0...v1.51.0) ##### Features - add backend query options ([#​90](https://www.github.com/googleapis/java-spanner/issues/90)) ([e96e172](https://www.github.com/googleapis/java-spanner/commit/e96e17246bee9691171b46857806d03d1f8e19b4)) - add QueryOptions proto ([#​84](https://www.github.com/googleapis/java-spanner/issues/84)) ([eb8fc37](https://www.github.com/googleapis/java-spanner/commit/eb8fc375bbd766f25966aa565e266ed972bbe818)) ##### Bug Fixes - never use credentials in combination with plain text ([#​98](https://www.github.com/googleapis/java-spanner/issues/98)) ([7eb8d49](https://www.github.com/googleapis/java-spanner/commit/7eb8d49cd6c35d7f757cb89009ad16be601b77c3)) ##### Dependencies - update dependency com.google.cloud:google-cloud-core-bom to v1.93.1 ([#​91](https://www.github.com/googleapis/java-spanner/issues/91)) ([29d8db8](https://www.github.com/googleapis/java-spanner/commit/29d8db8cfc9d12824b9264d0fb870049a58a9a03)) - update dependency io.opencensus:opencensus-api to v0.25.0 ([#​95](https://www.github.com/googleapis/java-spanner/issues/95)) ([57f5fd0](https://www.github.com/googleapis/java-spanner/commit/57f5fd0f3bee4b437f48b6a08ab3174f035c8cca)) ### [`v1.50.0`](https://togithub.com/googleapis/java-spanner/blob/master/CHANGELOG.md#​1510httpswwwgithubcomgoogleapisjava-spannercomparev1500v1510-2020-03-13) [Compare Source](https://togithub.com/googleapis/java-spanner/compare/v1.49.2...v1.50.0) ##### Features - add backend query options ([#​90](https://www.github.com/googleapis/java-spanner/issues/90)) ([e96e172](https://www.github.com/googleapis/java-spanner/commit/e96e17246bee9691171b46857806d03d1f8e19b4)) - add QueryOptions proto ([#​84](https://www.github.com/googleapis/java-spanner/issues/84)) ([eb8fc37](https://www.github.com/googleapis/java-spanner/commit/eb8fc375bbd766f25966aa565e266ed972bbe818)) ##### Bug Fixes - never use credentials in combination with plain text ([#​98](https://www.github.com/googleapis/java-spanner/issues/98)) ([7eb8d49](https://www.github.com/googleapis/java-spanner/commit/7eb8d49cd6c35d7f757cb89009ad16be601b77c3)) ##### Dependencies - update dependency com.google.cloud:google-cloud-core-bom to v1.93.1 ([#​91](https://www.github.com/googleapis/java-spanner/issues/91)) ([29d8db8](https://www.github.com/googleapis/java-spanner/commit/29d8db8cfc9d12824b9264d0fb870049a58a9a03)) - update dependency io.opencensus:opencensus-api to v0.25.0 ([#​95](https://www.github.com/googleapis/java-spanner/issues/95)) ([57f5fd0](https://www.github.com/googleapis/java-spanner/commit/57f5fd0f3bee4b437f48b6a08ab3174f035c8cca))
--- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-spanner-jdbc). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4c17942bd..c78553f38 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ 3.11.4 1.4.1 1.8.1 - 1.49.2 + 1.51.0 2.2 2.3.4 0.20.0 From 3adc247d9a673e720e466b7aa818cc6e9b13a338 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 17 Mar 2020 16:12:40 -0700 Subject: [PATCH 32/34] samples: scaffold pom.xml files (#90) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-03-17 12:21:53,248 synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py. .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/release-please.yml .github/trusted-contribution.yml .kokoro/build.bat .kokoro/build.sh .kokoro/coerce_logs.sh .kokoro/common.cfg .kokoro/continuous/common.cfg .kokoro/continuous/dependencies.cfg .kokoro/continuous/integration.cfg .kokoro/continuous/java11.cfg .kokoro/continuous/java7.cfg .kokoro/continuous/java8-osx.cfg .kokoro/continuous/java8-win.cfg .kokoro/continuous/java8.cfg .kokoro/continuous/lint.cfg .kokoro/continuous/propose_release.cfg .kokoro/continuous/samples.cfg .kokoro/dependencies.sh .kokoro/linkage-monitor.sh .kokoro/nightly/common.cfg .kokoro/nightly/dependencies.cfg .kokoro/nightly/integration.cfg .kokoro/nightly/java11.cfg .kokoro/nightly/java7.cfg .kokoro/nightly/java8-osx.cfg .kokoro/nightly/java8-win.cfg .kokoro/nightly/java8.cfg .kokoro/nightly/lint.cfg .kokoro/nightly/samples.cfg .kokoro/presubmit/clirr.cfg .kokoro/presubmit/common.cfg .kokoro/presubmit/dependencies.cfg .kokoro/presubmit/integration.cfg .kokoro/presubmit/java11.cfg .kokoro/presubmit/java7.cfg .kokoro/presubmit/java8-osx.cfg .kokoro/presubmit/java8-win.cfg .kokoro/presubmit/java8.cfg .kokoro/presubmit/linkage-monitor.cfg .kokoro/presubmit/lint.cfg .kokoro/presubmit/samples.cfg .kokoro/release/bump_snapshot.cfg .kokoro/release/common.cfg .kokoro/release/common.sh .kokoro/release/drop.cfg .kokoro/release/drop.sh .kokoro/release/promote.cfg .kokoro/release/promote.sh .kokoro/release/publish_javadoc.cfg .kokoro/release/publish_javadoc.sh .kokoro/release/snapshot.cfg .kokoro/release/snapshot.sh .kokoro/release/stage.cfg .kokoro/release/stage.sh .kokoro/trampoline.sh CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md codecov.yaml java.header license-checks.xml renovate.json samples/install-without-bom/pom.xml samples/pom.xml samples/snapshot/pom.xml samples/snippets/pom.xml 2020-03-17 12:21:53,455 synthtool > Wrote metadata to synth.metadata. ```
--- samples/install-without-bom/pom.xml | 84 +++++++++++++++++++++++++++++ samples/pom.xml | 56 +++++++++++++++++++ samples/snapshot/pom.xml | 83 ++++++++++++++++++++++++++++ samples/snippets/pom.xml | 60 +++++++++++++++++++++ synth.metadata | 2 +- 5 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 samples/install-without-bom/pom.xml create mode 100644 samples/pom.xml create mode 100644 samples/snapshot/pom.xml create mode 100644 samples/snippets/pom.xml diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml new file mode 100644 index 000000000..952e5f2c6 --- /dev/null +++ b/samples/install-without-bom/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + spanner-jdbc-install-without-bom + jar + Google Google Cloud Spanner JDBC Install Without Bom + https://github.com/googleapis/java-spanner-jdbc + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.google.cloud + google-cloud-spanner-jdbc + + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + diff --git a/samples/pom.xml b/samples/pom.xml new file mode 100644 index 000000000..48df32823 --- /dev/null +++ b/samples/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + com.google.cloud + google-cloud-spanner-jdbc-samples + 0.0.1-SNAPSHOT + pom + Google Google Cloud Spanner JDBC Samples Parent + https://github.com/googleapis/java-spanner-jdbc + + Java idiomatic client for Google Cloud Platform services. + + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + install-without-bom + snapshot + snippets + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + + true + + + + + diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml new file mode 100644 index 000000000..a1b09607f --- /dev/null +++ b/samples/snapshot/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + com.google.cloud + spanner-jdbc-snapshot + jar + Google Google Cloud Spanner JDBC Snapshot Samples + https://github.com/googleapis/java-spanner-jdbc + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-spanner-jdbc + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + \ No newline at end of file diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml new file mode 100644 index 000000000..013fcbeb3 --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + com.google.cloud + spanner-jdbc-snippets + jar + Google Google Cloud Spanner JDBC Snippets + https://github.com/googleapis/java-spanner-jdbc + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + + com.google.cloud + libraries-bom + + pom + import + + + + + + + com.google.cloud + google-cloud-spanner-jdbc + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + diff --git a/synth.metadata b/synth.metadata index 699d0d71b..ee2cf171c 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-03-14T09:16:59.709595Z", + "updateTime": "2020-03-17T19:21:53.454785Z", "sources": [ { "template": { From c257fe914de732a4ce1665c096609855b9a7c5c0 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 18 Mar 2020 09:22:04 -0700 Subject: [PATCH 33/34] samples: fix snippet closing tag (#91) --- samples/install-without-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 952e5f2c6..6f6034983 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -31,7 +31,7 @@ google-cloud-spanner-jdbc
- + junit From 00602243fa6ad48ab0a39725ba29f6653f3d8051 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2020 23:22:08 +0000 Subject: [PATCH 34/34] chore: release 1.14.0 (#82) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :robot: I have created a release \*beep\* \*boop\* --- ## [1.14.0](https://www.github.com/googleapis/java-spanner-jdbc/compare/v1.13.0...v1.14.0) (2020-03-18) ### Features * add support for foreign keys ([#78](https://www.github.com/googleapis/java-spanner-jdbc/issues/78)) ([9e770f2](https://www.github.com/googleapis/java-spanner-jdbc/commit/9e770f281c03a1e9c034e5ff3ddee44fa20a7b30)), closes [#77](https://www.github.com/googleapis/java-spanner-jdbc/issues/77) ### Bug Fixes * add missing netty-shaded lib for über-jar ([#80](https://www.github.com/googleapis/java-spanner-jdbc/issues/80)) ([3d6f356](https://www.github.com/googleapis/java-spanner-jdbc/commit/3d6f35669671194e6772fe327ce48f27e5bf4643)) * fix deprecation warnings in JDBC (test) files ([#81](https://www.github.com/googleapis/java-spanner-jdbc/issues/81)) ([a5e031d](https://www.github.com/googleapis/java-spanner-jdbc/commit/a5e031d3183f8fe88a621500f235ca2b0242f50b)) * include Spanner gRPC test dependencies ([#63](https://www.github.com/googleapis/java-spanner-jdbc/issues/63)) ([a34bfc0](https://www.github.com/googleapis/java-spanner-jdbc/commit/a34bfc0ff1c2ddeef077dbfae4c56bdd53febcb2)) ### Dependencies * update core dependencies ([1ae098e](https://www.github.com/googleapis/java-spanner-jdbc/commit/1ae098e924c2a488cfddd0a3aee9511274b7a515)) * update core dependencies ([#40](https://www.github.com/googleapis/java-spanner-jdbc/issues/40)) ([18c3a1b](https://www.github.com/googleapis/java-spanner-jdbc/commit/18c3a1b069cb507a91d0320e64a8bf8ae8efe394)) * update core dependencies ([#73](https://www.github.com/googleapis/java-spanner-jdbc/issues/73)) ([cfa1539](https://www.github.com/googleapis/java-spanner-jdbc/commit/cfa153997599c36f1243e87f1ea0760694657dfe)) * update core dependencies to v1.27.1 ([#61](https://www.github.com/googleapis/java-spanner-jdbc/issues/61)) ([181991b](https://www.github.com/googleapis/java-spanner-jdbc/commit/181991bda1f66de707d27dad9658b9177626595a)) * update core dependencies to v1.27.2 ([#71](https://www.github.com/googleapis/java-spanner-jdbc/issues/71)) ([12425fc](https://www.github.com/googleapis/java-spanner-jdbc/commit/12425fcb4382449e4a7a0edad4c812b7ce15aa71)) * update core dependencies to v1.54.0 ([#72](https://www.github.com/googleapis/java-spanner-jdbc/issues/72)) ([5676021](https://www.github.com/googleapis/java-spanner-jdbc/commit/567602177e05fa198eaa011fbca05cfe4b72fb13)) * update core dependencies to v1.92.5 ([#53](https://www.github.com/googleapis/java-spanner-jdbc/issues/53)) ([604ee2b](https://www.github.com/googleapis/java-spanner-jdbc/commit/604ee2b75204ad52eaf724c3fb71e8c13540af7c)) * update core transport dependencies to v1.34.1 ([#43](https://www.github.com/googleapis/java-spanner-jdbc/issues/43)) ([2b6f04d](https://www.github.com/googleapis/java-spanner-jdbc/commit/2b6f04da3aeebac778fb664c4564fb8b58bf3be4)) * update core transport dependencies to v1.34.2 ([#62](https://www.github.com/googleapis/java-spanner-jdbc/issues/62)) ([8739015](https://www.github.com/googleapis/java-spanner-jdbc/commit/8739015f62289adb92fd55b19a5bff8762da20a9)) * update dependency com.google.api-client:google-api-client-bom to v1.30.8 ([#46](https://www.github.com/googleapis/java-spanner-jdbc/issues/46)) ([ef891b0](https://www.github.com/googleapis/java-spanner-jdbc/commit/ef891b000045d1f39f91b6a0ed3abaab19c5f05e)) * update dependency com.google.api-client:google-api-client-bom to v1.30.9 ([#74](https://www.github.com/googleapis/java-spanner-jdbc/issues/74)) ([3b62299](https://www.github.com/googleapis/java-spanner-jdbc/commit/3b622999b9f9645a6086e5efd3206f4d7b0806bc)) * update dependency com.google.truth:truth to v1.0.1 ([#32](https://www.github.com/googleapis/java-spanner-jdbc/issues/32)) ([5205863](https://www.github.com/googleapis/java-spanner-jdbc/commit/52058636e10951e883523204f0f161db8a972d62)) * update protobuf.version to v3.11.3 ([#48](https://www.github.com/googleapis/java-spanner-jdbc/issues/48)) ([0779fcb](https://www.github.com/googleapis/java-spanner-jdbc/commit/0779fcb0bfe935c3c302fa8442f733c7e3629761)) * update protobuf.version to v3.11.4 ([#64](https://www.github.com/googleapis/java-spanner-jdbc/issues/64)) ([f485cff](https://www.github.com/googleapis/java-spanner-jdbc/commit/f485cfffa0de27ce35f5d16c689c31c6ea22138e)) * update spanner.version to v1.51.0 ([#75](https://www.github.com/googleapis/java-spanner-jdbc/issues/75)) ([4fff168](https://www.github.com/googleapis/java-spanner-jdbc/commit/4fff168eae61fb55933cf3afd67f24ca65dfde54)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ README.md | 6 +++--- pom.xml | 2 +- versions.txt | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fbddecd3..d3d90e785 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## [1.14.0](https://www.github.com/googleapis/java-spanner-jdbc/compare/v1.13.0...v1.14.0) (2020-03-18) + + +### Features + +* add support for foreign keys ([#78](https://www.github.com/googleapis/java-spanner-jdbc/issues/78)) ([9e770f2](https://www.github.com/googleapis/java-spanner-jdbc/commit/9e770f281c03a1e9c034e5ff3ddee44fa20a7b30)), closes [#77](https://www.github.com/googleapis/java-spanner-jdbc/issues/77) + + +### Bug Fixes + +* add missing netty-shaded lib for über-jar ([#80](https://www.github.com/googleapis/java-spanner-jdbc/issues/80)) ([3d6f356](https://www.github.com/googleapis/java-spanner-jdbc/commit/3d6f35669671194e6772fe327ce48f27e5bf4643)) +* fix deprecation warnings in JDBC (test) files ([#81](https://www.github.com/googleapis/java-spanner-jdbc/issues/81)) ([a5e031d](https://www.github.com/googleapis/java-spanner-jdbc/commit/a5e031d3183f8fe88a621500f235ca2b0242f50b)) +* include Spanner gRPC test dependencies ([#63](https://www.github.com/googleapis/java-spanner-jdbc/issues/63)) ([a34bfc0](https://www.github.com/googleapis/java-spanner-jdbc/commit/a34bfc0ff1c2ddeef077dbfae4c56bdd53febcb2)) + + +### Dependencies + +* update core dependencies ([1ae098e](https://www.github.com/googleapis/java-spanner-jdbc/commit/1ae098e924c2a488cfddd0a3aee9511274b7a515)) +* update core dependencies ([#40](https://www.github.com/googleapis/java-spanner-jdbc/issues/40)) ([18c3a1b](https://www.github.com/googleapis/java-spanner-jdbc/commit/18c3a1b069cb507a91d0320e64a8bf8ae8efe394)) +* update core dependencies ([#73](https://www.github.com/googleapis/java-spanner-jdbc/issues/73)) ([cfa1539](https://www.github.com/googleapis/java-spanner-jdbc/commit/cfa153997599c36f1243e87f1ea0760694657dfe)) +* update core dependencies to v1.27.1 ([#61](https://www.github.com/googleapis/java-spanner-jdbc/issues/61)) ([181991b](https://www.github.com/googleapis/java-spanner-jdbc/commit/181991bda1f66de707d27dad9658b9177626595a)) +* update core dependencies to v1.27.2 ([#71](https://www.github.com/googleapis/java-spanner-jdbc/issues/71)) ([12425fc](https://www.github.com/googleapis/java-spanner-jdbc/commit/12425fcb4382449e4a7a0edad4c812b7ce15aa71)) +* update core dependencies to v1.54.0 ([#72](https://www.github.com/googleapis/java-spanner-jdbc/issues/72)) ([5676021](https://www.github.com/googleapis/java-spanner-jdbc/commit/567602177e05fa198eaa011fbca05cfe4b72fb13)) +* update core dependencies to v1.92.5 ([#53](https://www.github.com/googleapis/java-spanner-jdbc/issues/53)) ([604ee2b](https://www.github.com/googleapis/java-spanner-jdbc/commit/604ee2b75204ad52eaf724c3fb71e8c13540af7c)) +* update core transport dependencies to v1.34.1 ([#43](https://www.github.com/googleapis/java-spanner-jdbc/issues/43)) ([2b6f04d](https://www.github.com/googleapis/java-spanner-jdbc/commit/2b6f04da3aeebac778fb664c4564fb8b58bf3be4)) +* update core transport dependencies to v1.34.2 ([#62](https://www.github.com/googleapis/java-spanner-jdbc/issues/62)) ([8739015](https://www.github.com/googleapis/java-spanner-jdbc/commit/8739015f62289adb92fd55b19a5bff8762da20a9)) +* update dependency com.google.api-client:google-api-client-bom to v1.30.8 ([#46](https://www.github.com/googleapis/java-spanner-jdbc/issues/46)) ([ef891b0](https://www.github.com/googleapis/java-spanner-jdbc/commit/ef891b000045d1f39f91b6a0ed3abaab19c5f05e)) +* update dependency com.google.api-client:google-api-client-bom to v1.30.9 ([#74](https://www.github.com/googleapis/java-spanner-jdbc/issues/74)) ([3b62299](https://www.github.com/googleapis/java-spanner-jdbc/commit/3b622999b9f9645a6086e5efd3206f4d7b0806bc)) +* update dependency com.google.truth:truth to v1.0.1 ([#32](https://www.github.com/googleapis/java-spanner-jdbc/issues/32)) ([5205863](https://www.github.com/googleapis/java-spanner-jdbc/commit/52058636e10951e883523204f0f161db8a972d62)) +* update protobuf.version to v3.11.3 ([#48](https://www.github.com/googleapis/java-spanner-jdbc/issues/48)) ([0779fcb](https://www.github.com/googleapis/java-spanner-jdbc/commit/0779fcb0bfe935c3c302fa8442f733c7e3629761)) +* update protobuf.version to v3.11.4 ([#64](https://www.github.com/googleapis/java-spanner-jdbc/issues/64)) ([f485cff](https://www.github.com/googleapis/java-spanner-jdbc/commit/f485cfffa0de27ce35f5d16c689c31c6ea22138e)) +* update spanner.version to v1.51.0 ([#75](https://www.github.com/googleapis/java-spanner-jdbc/issues/75)) ([4fff168](https://www.github.com/googleapis/java-spanner-jdbc/commit/4fff168eae61fb55933cf3afd67f24ca65dfde54)) + ## [1.13.0](https://www.github.com/googleapis/java-spanner-jdbc/compare/1.12.0...v1.13.0) (2020-01-28) diff --git a/README.md b/README.md index db50ef106..4a14e5b15 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,16 @@ If you are using Maven, add this to your pom.xml file com.google.cloud google-cloud-spanner-jdbc - 1.13.0 + 1.14.0 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-spanner-jdbc:1.13.0' +compile 'com.google.cloud:google-cloud-spanner-jdbc:1.14.0' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner-jdbc" % "1.13.0" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner-jdbc" % "1.14.0" ``` [//]: # ({x-version-update-end}) diff --git a/pom.xml b/pom.xml index c78553f38..a57e652a4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 google-cloud-spanner-jdbc - 1.13.1-SNAPSHOT + 1.14.0 jar Google Cloud Spanner JDBC https://github.com/googleapis/java-spanner-jdbc diff --git a/versions.txt b/versions.txt index 72f0ebd53..072804d1d 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-spanner-jdbc:1.13.0:1.13.1-SNAPSHOT +google-cloud-spanner-jdbc:1.14.0:1.14.0