Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public String getProjectId() {
return projectId;
}

@BetaApi
public String getDatabaseId() {
return databaseId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public String getNamespace() {
return namespace;
}

@BetaApi
public String getDatabaseId() {
return databaseId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public String getNamespace() {
return namespace;
}

@BetaApi
public String getDatabaseId() {
return this.databaseId;
}
Expand Down Expand Up @@ -193,7 +194,7 @@ public Builder toBuilder() {

@Override
public int hashCode() {
return Objects.hash(baseHashCode(), namespace);
return Objects.hash(baseHashCode(), namespace, databaseId);
}

@Override
Expand All @@ -202,7 +203,9 @@ public boolean equals(Object obj) {
return false;
}
DatastoreOptions other = (DatastoreOptions) obj;
return baseEquals(other) && Objects.equals(namespace, other.namespace);
return baseEquals(other)
&& Objects.equals(namespace, other.namespace)
&& Objects.equals(databaseId, other.databaseId);
}

public static Builder newBuilder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.datastore;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
Expand All @@ -38,7 +39,6 @@ public class DatastoreOptionsTest {
private DatastoreRpc datastoreRpc;
private DatastoreOptions.Builder options;

// todo parameterize
@Before
public void setUp() {
datastoreRpcFactory = EasyMock.createMock(DatastoreRpcFactory.class);
Expand Down Expand Up @@ -90,6 +90,12 @@ public void testToBuilder() {
assertEquals(original.getHost(), copy.getHost());
assertEquals(original.getRetrySettings(), copy.getRetrySettings());
assertEquals(original.getCredentials(), copy.getCredentials());
assertEquals(original, copy);
assertEquals(original.hashCode(), copy.hashCode());

DatastoreOptions newOptions = options.setDatabaseId("new-database-id").build();
assertNotEquals(original, newOptions);
assertNotEquals(original.hashCode(), newOptions.hashCode());
}

@Test
Expand Down