Skip to content

Commit 608bf89

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 2683 b: refs/heads/update-datastore c: dc1f9e7 h: refs/heads/master i: 2681: f1bdf48 2679: 7006b69
1 parent 3d83016 commit 608bf89

6 files changed

Lines changed: 12 additions & 13 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: b62017c855a5a8c599a35298125a5024c15de42e
8+
refs/heads/update-datastore: dc1f9e7ac5b5000b087f517809d31462ec04926a
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ End-to-end tests should ensure that gcloud-java works when running on the
3030

3131
When changes are made to authentication and project ID-related code, authentication and project ID inference should be tested using all relevant methods detailed in the [authentication docs](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) and [project ID docs](https://github.com/GoogleCloudPlatform/gcloud-java#specifying-a-project-id).
3232

33+
Known issue: If you have installed the Google Cloud SDK, be sure to log in (using `gcloud auth login`) before running tests. Though the Datastore tests use a local Datastore emulator that doesn't require authentication, they will not run if you have the Google Cloud SDK installed but aren't authenticated.
34+
3335
Adding Features
3436
---------------
3537
In order to add a feature to gcloud-java:

branches/update-datastore/gcloud-java-datastore/src/main/java/com/google/gcloud/spi/DatastoreRpc.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ public int httpStatus() {
7979
private final int httpStatus;
8080
private final boolean retryable;
8181

82-
public DatastoreRpcException(Reason reason, Throwable cause) {
83-
this(reason.name(), reason.httpStatus, reason.retryable, reason.description, cause);
82+
public DatastoreRpcException(Reason reason) {
83+
this(reason.name(), reason.httpStatus, reason.retryable, reason.description);
8484
}
8585

86-
public DatastoreRpcException(String reason, int httpStatus, boolean retryable, String message, Throwable cause) {
87-
super(message, cause);
86+
public DatastoreRpcException(String reason, int httpStatus, boolean retryable, String message) {
87+
super(message);
8888
this.reason = reason;
8989
this.httpStatus = httpStatus;
9090
this.retryable = retryable;

branches/update-datastore/gcloud-java-datastore/src/main/java/com/google/gcloud/spi/DefaultDatastoreRpc.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ private static DatastoreRpcException translate(DatastoreException exception) {
124124
reason = HTTP_STATUS_TO_REASON.get(exception.getCode());
125125
}
126126
if (reason != null) {
127-
return new DatastoreRpcException(reason, exception);
127+
return new DatastoreRpcException(reason);
128128
} else {
129129
boolean retryable = false;
130130
reasonStr = "Unknown";
131131
if (exception.getCause() instanceof SocketTimeoutException) {
132132
retryable = true;
133133
reasonStr = "Request timeout";
134134
}
135-
return new DatastoreRpcException(reasonStr, exception.getCode(), retryable, message, exception);
135+
return new DatastoreRpcException(reasonStr, exception.getCode(), retryable, message);
136136
}
137137
}
138138

branches/update-datastore/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreExceptionTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,12 @@ public void testDatastoreError() throws Exception {
4242

4343
@Test
4444
public void testTranslateAndThrow() throws Exception {
45-
DatastoreRpcException toTranslate = null; // should be preserved as a cause
4645
for (Reason reason : Reason.values()) {
4746
try {
48-
toTranslate = new DatastoreRpcException(reason, null);
49-
DatastoreException.translateAndThrow(toTranslate);
47+
DatastoreException.translateAndThrow(new DatastoreRpcException(reason));
5048
fail("Exception expected");
5149
} catch (DatastoreException ex) {
5250
assertEquals(reason.name(), ex.datastoreError().name());
53-
assertEquals(toTranslate, ex.getCause());
5451
}
5552
}
5653
}

branches/update-datastore/gcloud-java-datastore/src/test/java/com/google/gcloud/datastore/DatastoreTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ public void testRetryableException() throws Exception {
734734
EasyMock.expect(rpcFactoryMock.create(EasyMock.anyObject(DatastoreOptions.class)))
735735
.andReturn(rpcMock);
736736
EasyMock.expect(rpcMock.lookup(requestPb))
737-
.andThrow(new DatastoreRpc.DatastoreRpcException(Reason.UNAVAILABLE, null))
737+
.andThrow(new DatastoreRpc.DatastoreRpcException(Reason.UNAVAILABLE))
738738
.andReturn(responsePb);
739739
EasyMock.replay(rpcFactoryMock, rpcMock);
740740
DatastoreOptions options = this.options.toBuilder()
@@ -756,7 +756,7 @@ public void testNonRetryableException() throws Exception {
756756
EasyMock.expect(rpcFactoryMock.create(EasyMock.anyObject(DatastoreOptions.class)))
757757
.andReturn(rpcMock);
758758
EasyMock.expect(rpcMock.lookup(requestPb))
759-
.andThrow(new DatastoreRpc.DatastoreRpcException(Reason.PERMISSION_DENIED, null))
759+
.andThrow(new DatastoreRpc.DatastoreRpcException(Reason.PERMISSION_DENIED))
760760
.times(1);
761761
EasyMock.replay(rpcFactoryMock, rpcMock);
762762
RetryParams retryParams = RetryParams.builder().retryMinAttempts(2).build();

0 commit comments

Comments
 (0)