Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove deprecated databaseId field in DatastoreOptions #1237

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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