From 05e25e5d31f72f9cdedbb5efa85c64b55ccbc405 Mon Sep 17 00:00:00 2001 From: kolea2 <45548808+kolea2@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:34:52 -0500 Subject: [PATCH] fix: remove deprecated `databaseId` field in DatastoreOptions (#1237) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: remove deprecated `databaseId` field in DatastoreOptions * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../clirr-ignored-differences.xml | 11 +++++ .../datastore/v1/client/DatastoreOptions.java | 42 ------------------- .../v1/client/DatastoreClientTest.java | 13 ------ 3 files changed, 11 insertions(+), 55 deletions(-) diff --git a/datastore-v1-proto-client/clirr-ignored-differences.xml b/datastore-v1-proto-client/clirr-ignored-differences.xml index e8c0b27f4..7df1765da 100644 --- a/datastore-v1-proto-client/clirr-ignored-differences.xml +++ b/datastore-v1-proto-client/clirr-ignored-differences.xml @@ -6,4 +6,15 @@ java.util.List getSplits(com.google.datastore.v1.Query, com.google.datastore.v1.PartitionId, int, com.google.datastore.v1.client.Datastore, com.google.protobuf.Timestamp) 7012 + + + com/google/datastore/v1/client/DatastoreOptions + java.lang.String getDatabaseId() + 7002 + + + com/google/datastore/v1/client/DatastoreOptions$Builder + com.google.datastore.v1.client.DatastoreOptions$Builder databaseId(java.lang.String) + 7002 + diff --git a/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreOptions.java b/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreOptions.java index 687410d78..9a7045809 100644 --- a/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreOptions.java +++ b/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreOptions.java @@ -20,7 +20,6 @@ import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.http.HttpTransport; -import com.google.api.core.BetaApi; import java.util.Arrays; import java.util.List; @@ -42,8 +41,6 @@ public class DatastoreOptions { private final String projectId; - @Deprecated private final String databaseId; - private final String projectEndpoint; private final String host; private final String localHost; @@ -60,7 +57,6 @@ public class DatastoreOptions { b.projectId != null || b.projectEndpoint != null, "Either project ID or project endpoint must be provided."); this.projectId = b.projectId; - this.databaseId = b.databaseId; this.projectEndpoint = b.projectEndpoint; this.host = b.host; this.localHost = b.localHost; @@ -78,8 +74,6 @@ public static class Builder { private String projectId; - @Deprecated private String databaseId; - private String projectEndpoint; private String host; private String localHost; @@ -91,7 +85,6 @@ public Builder() {} public Builder(DatastoreOptions options) { this.projectId = options.projectId; - this.databaseId = options.databaseId; this.projectEndpoint = options.projectEndpoint; this.host = options.host; this.localHost = options.localHost; @@ -111,24 +104,6 @@ public Builder projectId(String projectId) { return this; } - /** - * This field is ignored and will be removed in a future release. Please set the database id on - * the request itself. For example: - * - *
{@code
-     * CommitRequest.newBuilder()
-     *     .setDatabaseId("my-database-id")
-     *     ....
-     *     .build();
-     * }
- */ - @BetaApi - @Deprecated - public Builder databaseId(String databaseId) { - this.databaseId = databaseId; - return this; - } - /** * Sets the host used to access Cloud Datastore. To connect to the Cloud Datastore Emulator, use * {@link #localHost} instead. @@ -203,23 +178,6 @@ public String getProjectId() { return projectId; } - /** - * This field is ignored and will be removed in a future release. Please set the database id on - * the request itself. For example: - * - *
{@code
-   * CommitRequest.newBuilder()
-   *     .setDatabaseId("my-database-id")
-   *     ....
-   *     .build();
-   * }
- */ - @BetaApi - @Deprecated - public String getDatabaseId() { - return databaseId; - } - public String getProjectEndpoint() { return projectEndpoint; } diff --git a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java index 3fd82ddca..16a6303bb 100644 --- a/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java +++ b/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java @@ -215,19 +215,6 @@ public void create_LocalHost() { .isEqualTo("http://localhost:8080/v1/projects/project-id"); } - @Test - // TODO: remove this test once deprecated `databaseId` is removed - public void setDatabaseId() { - DatastoreOptions options = - new DatastoreOptions.Builder() - .projectId(PROJECT_ID) - .databaseId("test-db") - .localHost("localhost:8080") - .build(); - assertThat(options.getProjectId()).isEqualTo(PROJECT_ID); - assertThat(options.getDatabaseId()).isEqualTo("test-db"); - } - @Test public void create_LocalHostIp() { Datastore datastore =