Skip to content

Commit

Permalink
fix: remove deprecated databaseId field in DatastoreOptions (#1237)
Browse files Browse the repository at this point in the history
* 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 <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
kolea2 and gcf-owl-bot[bot] authored Nov 29, 2023
1 parent 41d43e8 commit 05e25e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 55 deletions.
11 changes: 11 additions & 0 deletions datastore-v1-proto-client/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,15 @@
<method>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)</method>
<differenceType>7012</differenceType>
</difference>
<!-- removing deprecated/BetaApi methods-->
<difference>
<className>com/google/datastore/v1/client/DatastoreOptions</className>
<method>java.lang.String getDatabaseId()</method>
<differenceType>7002</differenceType>
</difference>
<difference>
<className>com/google/datastore/v1/client/DatastoreOptions$Builder</className>
<method>com.google.datastore.v1.client.DatastoreOptions$Builder databaseId(java.lang.String)</method>
<differenceType>7002</differenceType>
</difference>
</differences>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -78,8 +74,6 @@ public static class Builder {

private String projectId;

@Deprecated private String databaseId;

private String projectEndpoint;
private String host;
private String localHost;
Expand All @@ -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;
Expand All @@ -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:
*
* <pre>{@code
* CommitRequest.newBuilder()
* .setDatabaseId("my-database-id")
* ....
* .build();
* }</pre>
*/
@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.
Expand Down Expand Up @@ -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:
*
* <pre>{@code
* CommitRequest.newBuilder()
* .setDatabaseId("my-database-id")
* ....
* .build();
* }</pre>
*/
@BetaApi
@Deprecated
public String getDatabaseId() {
return databaseId;
}

public String getProjectEndpoint() {
return projectEndpoint;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 05e25e5

Please sign in to comment.