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

Update grpc, protobuf, datastore and gax dependencies, regenerate SPI classes #1273

Merged
merged 7 commits into from
Sep 28, 2016
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
8 changes: 4 additions & 4 deletions google-cloud-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.0.0-beta-3</version>
<version>3.0.0</version>

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>0.0.16</version>
<version>0.0.18</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
<version>0.0.9</version>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-iam-v1</artifactId>
<version>0.0.9</version>
<version>0.1.0</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions google-cloud-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
<dependency>
<groupId>com.google.cloud.datastore</groupId>
<artifactId>datastore-v1-protos</artifactId>
<version>1.0.1</version>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud.datastore</groupId>
<artifactId>datastore-v1-proto-client</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
11 changes: 3 additions & 8 deletions google-cloud-errorreporting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork17</version>
<version>1.1.33.Fork19</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand All @@ -30,17 +30,12 @@
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-devtools-clouderrorreporting-v1beta1</artifactId>
<version>0.0.7</version>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
<version>0.15.0</version>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>1.1</version>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package com.google.cloud.errorreporting.spi.v1beta1;

import com.google.api.gax.core.PageAccessor;
import com.google.api.gax.core.PagedListResponse;
import com.google.api.gax.grpc.ApiCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest;
Expand Down Expand Up @@ -93,10 +93,14 @@ public class ErrorStatsServiceApi implements AutoCloseable {
private final List<AutoCloseable> closeables = new ArrayList<>();

private final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGroupStatsCallable;
private final ApiCallable<ListGroupStatsRequest, PageAccessor<ErrorGroupStats>>
private final ApiCallable<
ListGroupStatsRequest,
PagedListResponse<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>>
listGroupStatsPagedCallable;
private final ApiCallable<ListEventsRequest, ListEventsResponse> listEventsCallable;
private final ApiCallable<ListEventsRequest, PageAccessor<ErrorEvent>> listEventsPagedCallable;
private final ApiCallable<
ListEventsRequest, PagedListResponse<ListEventsRequest, ListEventsResponse, ErrorEvent>>
listEventsPagedCallable;
private final ApiCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable;

public final ErrorStatsServiceSettings getSettings() {
Expand Down Expand Up @@ -190,7 +194,7 @@ public void close() throws IOException {
* try (ErrorStatsServiceApi errorStatsServiceApi = ErrorStatsServiceApi.create()) {
* String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
* QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
* for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(formattedProjectName, timeRange)) {
* for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(formattedProjectName, timeRange).iterateAllElements()) {
* // doThingsWith(element);
* }
* }
Expand All @@ -208,8 +212,8 @@ public void close() throws IOException {
* higher response times or in returning incomplete results.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PageAccessor<ErrorGroupStats> listGroupStats(
String projectName, QueryTimeRange timeRange) {
public final PagedListResponse<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>
listGroupStats(String projectName, QueryTimeRange timeRange) {
PROJECT_PATH_TEMPLATE.validate(projectName, "listGroupStats");
ListGroupStatsRequest request =
ListGroupStatsRequest.newBuilder()
Expand All @@ -232,7 +236,7 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(
* .setProjectName(formattedProjectName)
* .setTimeRange(timeRange)
* .build();
* for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(request)) {
* for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(request).iterateAllElements()) {
* // doThingsWith(element);
* }
* }
Expand All @@ -241,7 +245,8 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PageAccessor<ErrorGroupStats> listGroupStats(ListGroupStatsRequest request) {
public final PagedListResponse<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>
listGroupStats(ListGroupStatsRequest request) {
return listGroupStatsPagedCallable().call(request);
}

Expand All @@ -258,15 +263,17 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(ListGroupStatsRequest
* .setProjectName(formattedProjectName)
* .setTimeRange(timeRange)
* .build();
* ListenableFuture&lt;PageAccessor&lt;ErrorGroupStats&gt;&gt; future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
* ListenableFuture&lt;PagedListResponse&lt;ListGroupStatsRequest,ListGroupStatsResponse,ErrorGroupStats&gt;&gt; future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
* // Do something
* for (ErrorGroupStats element : future.get()) {
* for (ErrorGroupStats element : future.get().iterateAllElements()) {
* // doThingsWith(element);
* }
* }
* </code></pre>
*/
public final ApiCallable<ListGroupStatsRequest, PageAccessor<ErrorGroupStats>>
public final ApiCallable<
ListGroupStatsRequest,
PagedListResponse<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats>>
listGroupStatsPagedCallable() {
return listGroupStatsPagedCallable;
}
Expand Down Expand Up @@ -312,7 +319,7 @@ public final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGrou
* try (ErrorStatsServiceApi errorStatsServiceApi = ErrorStatsServiceApi.create()) {
* String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
* String groupId = "";
* for (ErrorEvent element : errorStatsServiceApi.listEvents(formattedProjectName, groupId)) {
* for (ErrorEvent element : errorStatsServiceApi.listEvents(formattedProjectName, groupId).iterateAllElements()) {
* // doThingsWith(element);
* }
* }
Expand All @@ -325,7 +332,8 @@ public final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGrou
* @param groupId [Required] The group for which events shall be returned.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PageAccessor<ErrorEvent> listEvents(String projectName, String groupId) {
public final PagedListResponse<ListEventsRequest, ListEventsResponse, ErrorEvent> listEvents(
String projectName, String groupId) {
PROJECT_PATH_TEMPLATE.validate(projectName, "listEvents");
ListEventsRequest request =
ListEventsRequest.newBuilder().setProjectName(projectName).setGroupId(groupId).build();
Expand All @@ -345,7 +353,7 @@ public final PageAccessor<ErrorEvent> listEvents(String projectName, String grou
* .setProjectName(formattedProjectName)
* .setGroupId(groupId)
* .build();
* for (ErrorEvent element : errorStatsServiceApi.listEvents(request)) {
* for (ErrorEvent element : errorStatsServiceApi.listEvents(request).iterateAllElements()) {
* // doThingsWith(element);
* }
* }
Expand All @@ -354,7 +362,8 @@ public final PageAccessor<ErrorEvent> listEvents(String projectName, String grou
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final PageAccessor<ErrorEvent> listEvents(ListEventsRequest request) {
public final PagedListResponse<ListEventsRequest, ListEventsResponse, ErrorEvent> listEvents(
ListEventsRequest request) {
return listEventsPagedCallable().call(request);
}

Expand All @@ -371,15 +380,17 @@ public final PageAccessor<ErrorEvent> listEvents(ListEventsRequest request) {
* .setProjectName(formattedProjectName)
* .setGroupId(groupId)
* .build();
* ListenableFuture&lt;PageAccessor&lt;ErrorEvent&gt;&gt; future = errorStatsServiceApi.listEventsPagedCallable().futureCall(request);
* ListenableFuture&lt;PagedListResponse&lt;ListEventsRequest,ListEventsResponse,ErrorEvent&gt;&gt; future = errorStatsServiceApi.listEventsPagedCallable().futureCall(request);
* // Do something
* for (ErrorEvent element : future.get()) {
* for (ErrorEvent element : future.get().iterateAllElements()) {
* // doThingsWith(element);
* }
* }
* </code></pre>
*/
public final ApiCallable<ListEventsRequest, PageAccessor<ErrorEvent>> listEventsPagedCallable() {
public final ApiCallable<
ListEventsRequest, PagedListResponse<ListEventsRequest, ListEventsResponse, ErrorEvent>>
listEventsPagedCallable() {
return listEventsPagedCallable;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ public ListGroupStatsRequest injectToken(ListGroupStatsRequest payload, Object t
return ListGroupStatsRequest.newBuilder(payload).setPageToken((String) token).build();
}

@Override
public ListGroupStatsRequest injectPageSize(
ListGroupStatsRequest payload, int pageSize) {
return ListGroupStatsRequest.newBuilder(payload).setPageSize(pageSize).build();
}

@Override
public Integer extractPageSize(ListGroupStatsRequest payload) {
return payload.getPageSize();
}

@Override
public Object extractNextToken(ListGroupStatsResponse payload) {
return payload.getNextPageToken();
Expand All @@ -222,6 +233,16 @@ public ListEventsRequest injectToken(ListEventsRequest payload, Object token) {
return ListEventsRequest.newBuilder(payload).setPageToken((String) token).build();
}

@Override
public ListEventsRequest injectPageSize(ListEventsRequest payload, int pageSize) {
return ListEventsRequest.newBuilder(payload).setPageSize(pageSize).build();
}

@Override
public Integer extractPageSize(ListEventsRequest payload) {
return payload.getPageSize();
}

@Override
public Object extractNextToken(ListEventsResponse payload) {
return payload.getNextPageToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

package com.google.cloud.errorreporting.spi.v1beta1;

import com.google.api.gax.core.PageAccessor;
import com.google.api.gax.core.PagedListResponse;
import com.google.api.gax.testing.MockGrpcService;
import com.google.api.gax.testing.MockServiceHelper;
import com.google.common.collect.Lists;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup;
import com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest;
import com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.GeneratedMessageV3;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -80,7 +80,7 @@ public void getGroupTest() {
String name = "name3373707";
String groupId = "groupId506361563";
ErrorGroup expectedResponse = ErrorGroup.newBuilder().setName(name).setGroupId(groupId).build();
List<GeneratedMessage> expectedResponses = new ArrayList<>();
List<GeneratedMessageV3> expectedResponses = new ArrayList<>();
expectedResponses.add(expectedResponse);
mockErrorGroupService.setResponses(expectedResponses);

Expand All @@ -89,7 +89,7 @@ public void getGroupTest() {
ErrorGroup actualResponse = api.getGroup(formattedGroupName);
Assert.assertEquals(expectedResponse, actualResponse);

List<GeneratedMessage> actualRequests = mockErrorGroupService.getRequests();
List<GeneratedMessageV3> actualRequests = mockErrorGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);

Expand All @@ -102,7 +102,7 @@ public void updateGroupTest() {
String name = "name3373707";
String groupId = "groupId506361563";
ErrorGroup expectedResponse = ErrorGroup.newBuilder().setName(name).setGroupId(groupId).build();
List<GeneratedMessage> expectedResponses = new ArrayList<>();
List<GeneratedMessageV3> expectedResponses = new ArrayList<>();
expectedResponses.add(expectedResponse);
mockErrorGroupService.setResponses(expectedResponses);

Expand All @@ -111,7 +111,7 @@ public void updateGroupTest() {
ErrorGroup actualResponse = api.updateGroup(group);
Assert.assertEquals(expectedResponse, actualResponse);

List<GeneratedMessage> actualRequests = mockErrorGroupService.getRequests();
List<GeneratedMessageV3> actualRequests = mockErrorGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateGroupRequest actualRequest = (UpdateGroupRequest) actualRequests.get(0);

Expand Down
Loading