Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Update gax LRO client with latest toolkit (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
shinfan authored Feb 24, 2017
1 parent 0b17f2d commit f049262
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/google/longrunning/OperationsClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/google/longrunning/OperationsSettings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -66,6 +66,9 @@ public class OperationsSettings extends ClientSettings {
/** The default port of the service. */
private static final int DEFAULT_SERVICE_PORT = 443;

private static final String DEFAULT_GENERATOR_NAME = "gapic";
private static final String DEFAULT_GENERATOR_VERSION = "0.0.5";

private final SimpleCallSettings<GetOperationRequest, Operation> getOperationSettings;
private final PagedCallSettings<
ListOperationsRequest, ListOperationsResponse, ListOperationsPagedResponse>
Expand Down Expand Up @@ -114,6 +117,7 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
public static InstantiatingChannelProvider.Builder defaultChannelProviderBuilder() {
return InstantiatingChannelProvider.newBuilder()
.setPort(DEFAULT_SERVICE_PORT)
.setGeneratorHeader(DEFAULT_GENERATOR_NAME, DEFAULT_GENERATOR_VERSION)
.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/google/longrunning/package-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/google/longrunning/MockOperations.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/com/google/longrunning/MockOperationsImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -70,12 +70,12 @@ public void reset() {
}

@Override
public void getOperation(
GetOperationRequest request, StreamObserver<Operation> responseObserver) {
public void listOperations(
ListOperationsRequest request, StreamObserver<ListOperationsResponse> responseObserver) {
Object response = responses.remove();
if (response instanceof Operation) {
if (response instanceof ListOperationsResponse) {
requests.add(request);
responseObserver.onNext((Operation) response);
responseObserver.onNext((ListOperationsResponse) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
Expand All @@ -85,12 +85,12 @@ public void getOperation(
}

@Override
public void listOperations(
ListOperationsRequest request, StreamObserver<ListOperationsResponse> responseObserver) {
public void getOperation(
GetOperationRequest request, StreamObserver<Operation> responseObserver) {
Object response = responses.remove();
if (response instanceof ListOperationsResponse) {
if (response instanceof Operation) {
requests.add(request);
responseObserver.onNext((ListOperationsResponse) response);
responseObserver.onNext((Operation) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
Expand All @@ -100,8 +100,8 @@ public void listOperations(
}

@Override
public void cancelOperation(
CancelOperationRequest request, StreamObserver<Empty> responseObserver) {
public void deleteOperation(
DeleteOperationRequest request, StreamObserver<Empty> responseObserver) {
Object response = responses.remove();
if (response instanceof Empty) {
requests.add(request);
Expand All @@ -115,8 +115,8 @@ public void cancelOperation(
}

@Override
public void deleteOperation(
DeleteOperationRequest request, StreamObserver<Empty> responseObserver) {
public void cancelOperation(
CancelOperationRequest request, StreamObserver<Empty> responseObserver) {
Object response = responses.remove();
if (response instanceof Empty) {
requests.add(request);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016, Google Inc. All rights reserved.
* Copyright 2017, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -50,7 +50,7 @@
import org.junit.Test;

@javax.annotation.Generated("by GAPIC")
public class OperationsTest {
public class OperationsClientTest {
private static MockOperations mockOperations;
private static MockServiceHelper serviceHelper;
private OperationsClient client;
Expand Down

0 comments on commit f049262

Please sign in to comment.