diff --git a/README.md b/README.md index 0ca34109dc3..c12763f9052 100644 --- a/README.md +++ b/README.md @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-spanner' If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-spanner:6.19.1' +implementation 'com.google.cloud:google-cloud-spanner:6.20.0' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.19.1" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.20.0" ``` ## Authentication diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java index 65de63b720f..b62b2d44556 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java @@ -80,6 +80,7 @@ public class SpannerOptions extends ServiceOptions { private static final String JDBC_API_CLIENT_LIB_TOKEN = "sp-jdbc"; private static final String HIBERNATE_API_CLIENT_LIB_TOKEN = "sp-hib"; private static final String LIQUIBASE_API_CLIENT_LIB_TOKEN = "sp-liq"; + private static final String PG_ADAPTER_CLIENT_LIB_TOKEN = "pg-adapter"; private static final String API_SHORT_NAME = "Spanner"; private static final String DEFAULT_HOST = "https://spanner.googleapis.com"; @@ -657,7 +658,8 @@ public static class Builder ServiceOptions.getGoogApiClientLibName(), JDBC_API_CLIENT_LIB_TOKEN, HIBERNATE_API_CLIENT_LIB_TOKEN, - LIQUIBASE_API_CLIENT_LIB_TOKEN); + LIQUIBASE_API_CLIENT_LIB_TOKEN, + PG_ADAPTER_CLIENT_LIB_TOKEN); private TransportChannelProvider channelProvider; @SuppressWarnings("rawtypes") diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerOptionsTest.java index fc82954ad40..7d5c8a553aa 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerOptionsTest.java @@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThrows; import static org.mockito.Mockito.mock; @@ -502,6 +503,7 @@ public void testDoNotCacheClosedSpannerInstance() { public void testSetClientLibToken() { final String jdbcToken = "sp-jdbc"; final String hibernateToken = "sp-hib"; + final String pgAdapterToken = "pg-adapter"; SpannerOptions options = SpannerOptions.newBuilder() .setProjectId("some-project") @@ -522,8 +524,16 @@ public void testSetClientLibToken() { SpannerOptions.newBuilder() .setProjectId("some-project") .setCredentials(NoCredentials.getInstance()) + .setClientLibToken(pgAdapterToken) .build(); - assertThat(options.getClientLibToken()).isEqualTo(ServiceOptions.getGoogApiClientLibName()); + assertEquals(options.getClientLibToken(), pgAdapterToken); + + options = + SpannerOptions.newBuilder() + .setProjectId("some-project") + .setCredentials(NoCredentials.getInstance()) + .build(); + assertEquals(options.getClientLibToken(), ServiceOptions.getGoogApiClientLibName()); } @Test(expected = IllegalArgumentException.class)