Skip to content

Commit 05e25e5

Browse files
fix: remove deprecated databaseId field in DatastoreOptions (#1237)
* 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>
1 parent 41d43e8 commit 05e25e5

File tree

3 files changed

+11
-55
lines changed

3 files changed

+11
-55
lines changed

datastore-v1-proto-client/clirr-ignored-differences.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,15 @@
66
<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>
77
<differenceType>7012</differenceType>
88
</difference>
9+
<!-- removing deprecated/BetaApi methods-->
10+
<difference>
11+
<className>com/google/datastore/v1/client/DatastoreOptions</className>
12+
<method>java.lang.String getDatabaseId()</method>
13+
<differenceType>7002</differenceType>
14+
</difference>
15+
<difference>
16+
<className>com/google/datastore/v1/client/DatastoreOptions$Builder</className>
17+
<method>com.google.datastore.v1.client.DatastoreOptions$Builder databaseId(java.lang.String)</method>
18+
<differenceType>7002</differenceType>
19+
</difference>
920
</differences>

datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreOptions.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.api.client.auth.oauth2.Credential;
2121
import com.google.api.client.http.HttpRequestInitializer;
2222
import com.google.api.client.http.HttpTransport;
23-
import com.google.api.core.BetaApi;
2423
import java.util.Arrays;
2524
import java.util.List;
2625

@@ -42,8 +41,6 @@
4241
public class DatastoreOptions {
4342
private final String projectId;
4443

45-
@Deprecated private final String databaseId;
46-
4744
private final String projectEndpoint;
4845
private final String host;
4946
private final String localHost;
@@ -60,7 +57,6 @@ public class DatastoreOptions {
6057
b.projectId != null || b.projectEndpoint != null,
6158
"Either project ID or project endpoint must be provided.");
6259
this.projectId = b.projectId;
63-
this.databaseId = b.databaseId;
6460
this.projectEndpoint = b.projectEndpoint;
6561
this.host = b.host;
6662
this.localHost = b.localHost;
@@ -78,8 +74,6 @@ public static class Builder {
7874

7975
private String projectId;
8076

81-
@Deprecated private String databaseId;
82-
8377
private String projectEndpoint;
8478
private String host;
8579
private String localHost;
@@ -91,7 +85,6 @@ public Builder() {}
9185

9286
public Builder(DatastoreOptions options) {
9387
this.projectId = options.projectId;
94-
this.databaseId = options.databaseId;
9588
this.projectEndpoint = options.projectEndpoint;
9689
this.host = options.host;
9790
this.localHost = options.localHost;
@@ -111,24 +104,6 @@ public Builder projectId(String projectId) {
111104
return this;
112105
}
113106

114-
/**
115-
* This field is ignored and will be removed in a future release. Please set the database id on
116-
* the request itself. For example:
117-
*
118-
* <pre>{@code
119-
* CommitRequest.newBuilder()
120-
* .setDatabaseId("my-database-id")
121-
* ....
122-
* .build();
123-
* }</pre>
124-
*/
125-
@BetaApi
126-
@Deprecated
127-
public Builder databaseId(String databaseId) {
128-
this.databaseId = databaseId;
129-
return this;
130-
}
131-
132107
/**
133108
* Sets the host used to access Cloud Datastore. To connect to the Cloud Datastore Emulator, use
134109
* {@link #localHost} instead.
@@ -203,23 +178,6 @@ public String getProjectId() {
203178
return projectId;
204179
}
205180

206-
/**
207-
* This field is ignored and will be removed in a future release. Please set the database id on
208-
* the request itself. For example:
209-
*
210-
* <pre>{@code
211-
* CommitRequest.newBuilder()
212-
* .setDatabaseId("my-database-id")
213-
* ....
214-
* .build();
215-
* }</pre>
216-
*/
217-
@BetaApi
218-
@Deprecated
219-
public String getDatabaseId() {
220-
return databaseId;
221-
}
222-
223181
public String getProjectEndpoint() {
224182
return projectEndpoint;
225183
}

datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,6 @@ public void create_LocalHost() {
215215
.isEqualTo("http://localhost:8080/v1/projects/project-id");
216216
}
217217

218-
@Test
219-
// TODO: remove this test once deprecated `databaseId` is removed
220-
public void setDatabaseId() {
221-
DatastoreOptions options =
222-
new DatastoreOptions.Builder()
223-
.projectId(PROJECT_ID)
224-
.databaseId("test-db")
225-
.localHost("localhost:8080")
226-
.build();
227-
assertThat(options.getProjectId()).isEqualTo(PROJECT_ID);
228-
assertThat(options.getDatabaseId()).isEqualTo("test-db");
229-
}
230-
231218
@Test
232219
public void create_LocalHostIp() {
233220
Datastore datastore =

0 commit comments

Comments
 (0)