Skip to content

Commit

Permalink
chore: Update googleapis hash (incl. mono removal) [ggj] (#793)
Browse files Browse the repository at this point in the history
* chore: Update googleapis (includes mono removal)

* fix: update goldens
  • Loading branch information
miraleung committed Jul 28, 2021
1 parent ebe1aef commit 36594fa
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 15 deletions.
4 changes: 2 additions & 2 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def gapic_generator_java_repositories():
_maybe(
http_archive,
name = "com_google_googleapis",
strip_prefix = "googleapis-2c1d1b27646cba6f14b760b635f29fafc5a74ca6",
strip_prefix = "googleapis-efecdbf96311bb705d619459280ffc651b10844a",
urls = [
"https://github.com/googleapis/googleapis/archive/2c1d1b27646cba6f14b760b635f29fafc5a74ca6.zip",
"https://github.com/googleapis/googleapis/archive/efecdbf96311bb705d619459280ffc651b10844a.zip",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,84 @@ public class SubscriberClientTest {
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);

SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 496131527;

PullResponse actualResponse = client.pull(subscription, maxMessages);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
PullRequest actualRequest = ((PullRequest) actualRequests.get(0));

Assert.assertEquals(subscription.toString(), actualRequest.getSubscription());
Assert.assertEquals(maxMessages, actualRequest.getMaxMessages());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}

@Test
public void pullExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

try {
SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 496131527;
client.pull(subscription, maxMessages);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}

@Test
public void pullTest2() throws Exception {
PullResponse expectedResponse =
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);

String subscription = "subscription341203229";
int maxMessages = 496131527;

PullResponse actualResponse = client.pull(subscription, maxMessages);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
PullRequest actualRequest = ((PullRequest) actualRequests.get(0));

Assert.assertEquals(subscription, actualRequest.getSubscription());
Assert.assertEquals(maxMessages, actualRequest.getMaxMessages());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}

@Test
public void pullExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

try {
String subscription = "subscription341203229";
int maxMessages = 496131527;
client.pull(subscription, maxMessages);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}

@Test
public void pullTest3() throws Exception {
PullResponse expectedResponse =
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);

SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
boolean returnImmediately = true;
int maxMessages = 496131527;
Expand All @@ -799,7 +877,7 @@ public class SubscriberClientTest {
}

@Test
public void pullExceptionTest() throws Exception {
public void pullExceptionTest3() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

Expand All @@ -815,7 +893,7 @@ public class SubscriberClientTest {
}

@Test
public void pullTest2() throws Exception {
public void pullTest4() throws Exception {
PullResponse expectedResponse =
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);
Expand All @@ -841,7 +919,7 @@ public class SubscriberClientTest {
}

@Test
public void pullExceptionTest2() throws Exception {
public void pullExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

Expand All @@ -861,6 +939,8 @@ public class SubscriberClientTest {
StreamingPullResponse expectedResponse =
StreamingPullResponse.newBuilder()
.addAllReceivedMessages(new ArrayList<ReceivedMessage>())
.setSubscriptionProperties(
StreamingPullResponse.SubscriptionProperties.newBuilder().build())
.build();
mockSubscriber.addResponse(expectedResponse);
StreamingPullRequest request =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,9 @@ public final SearchAllResourcesPagedResponse searchAllResources(
* the searchable fields (except for the included permissions).
* <li>`resource:(instance1 OR instance2) policy:amy` to find IAM policy bindings that are
* set on resources "instance1" or "instance2" and also specify user "amy".
* <li>`roles:roles/compute.admin` to find IAM policy bindings that specify the Compute
* Admin role.
* <li>`memberTypes:user` to find IAM policy bindings that contain the "user" member type.
* </ul>
*
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand All @@ -1164,6 +1167,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(String scope
* .setQuery("query107944136")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .addAllAssetTypes(new ArrayList<String>())
* .setOrderBy("orderBy-1207110587")
* .build();
* for (IamPolicySearchResult element :
* assetServiceClient.searchAllIamPolicies(request).iterateAll()) {
Expand Down Expand Up @@ -1196,6 +1201,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
* .setQuery("query107944136")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .addAllAssetTypes(new ArrayList<String>())
* .setOrderBy("orderBy-1207110587")
* .build();
* ApiFuture<IamPolicySearchResult> future =
* assetServiceClient.searchAllIamPoliciesPagedCallable().futureCall(request);
Expand Down Expand Up @@ -1227,6 +1234,8 @@ public final SearchAllIamPoliciesPagedResponse searchAllIamPolicies(
* .setQuery("query107944136")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .addAllAssetTypes(new ArrayList<String>())
* .setOrderBy("orderBy-1207110587")
* .build();
* while (true) {
* SearchAllIamPoliciesResponse response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,7 @@ public static class Builder extends StubSettings.Builder<AssetServiceStubSetting
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put(
"retry_policy_2_codes",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
definitions.put(
"retry_policy_3_codes",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
Expand Down Expand Up @@ -598,10 +596,10 @@ public static class Builder extends StubSettings.Builder<AssetServiceStubSetting
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(15000L))
.setInitialRpcTimeout(Duration.ofMillis(30000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(15000L))
.setTotalTimeout(Duration.ofMillis(15000L))
.setMaxRpcTimeout(Duration.ofMillis(30000L))
.setTotalTimeout(Duration.ofMillis(30000L))
.build();
definitions.put("retry_policy_2_params", settings);
settings =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,63 @@ public final UnaryCallable<AcknowledgeRequest, Empty> acknowledgeCallable() {
return stub.acknowledgeCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many
* concurrent pull requests pending for the given subscription.
*
* <p>Sample code:
*
* <pre>{@code
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
* int maxMessages = 496131527;
* PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
* }
* }</pre>
*
* @param subscription Required. The subscription from which messages should be pulled. Format is
* `projects/{project}/subscriptions/{sub}`.
* @param maxMessages Required. The maximum number of messages to return for this request. Must be
* a positive integer. The Pub/Sub system may return fewer than the number specified.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PullResponse pull(SubscriptionName subscription, int maxMessages) {
PullRequest request =
PullRequest.newBuilder()
.setSubscription(subscription == null ? null : subscription.toString())
.setMaxMessages(maxMessages)
.build();
return pull(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many
* concurrent pull requests pending for the given subscription.
*
* <p>Sample code:
*
* <pre>{@code
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
* int maxMessages = 496131527;
* PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
* }
* }</pre>
*
* @param subscription Required. The subscription from which messages should be pulled. Format is
* `projects/{project}/subscriptions/{sub}`.
* @param maxMessages Required. The maximum number of messages to return for this request. Must be
* a positive integer. The Pub/Sub system may return fewer than the number specified.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PullResponse pull(String subscription, int maxMessages) {
PullRequest request =
PullRequest.newBuilder().setSubscription(subscription).setMaxMessages(maxMessages).build();
return pull(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,84 @@ public void pullTest() throws Exception {
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);

SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 496131527;

PullResponse actualResponse = client.pull(subscription, maxMessages);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
PullRequest actualRequest = ((PullRequest) actualRequests.get(0));

Assert.assertEquals(subscription.toString(), actualRequest.getSubscription());
Assert.assertEquals(maxMessages, actualRequest.getMaxMessages());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}

@Test
public void pullExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

try {
SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 496131527;
client.pull(subscription, maxMessages);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}

@Test
public void pullTest2() throws Exception {
PullResponse expectedResponse =
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);

String subscription = "subscription341203229";
int maxMessages = 496131527;

PullResponse actualResponse = client.pull(subscription, maxMessages);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
PullRequest actualRequest = ((PullRequest) actualRequests.get(0));

Assert.assertEquals(subscription, actualRequest.getSubscription());
Assert.assertEquals(maxMessages, actualRequest.getMaxMessages());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}

@Test
public void pullExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

try {
String subscription = "subscription341203229";
int maxMessages = 496131527;
client.pull(subscription, maxMessages);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}

@Test
public void pullTest3() throws Exception {
PullResponse expectedResponse =
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);

SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
boolean returnImmediately = true;
int maxMessages = 496131527;
Expand All @@ -868,7 +946,7 @@ public void pullTest() throws Exception {
}

@Test
public void pullExceptionTest() throws Exception {
public void pullExceptionTest3() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

Expand All @@ -884,7 +962,7 @@ public void pullExceptionTest() throws Exception {
}

@Test
public void pullTest2() throws Exception {
public void pullTest4() throws Exception {
PullResponse expectedResponse =
PullResponse.newBuilder().addAllReceivedMessages(new ArrayList<ReceivedMessage>()).build();
mockSubscriber.addResponse(expectedResponse);
Expand All @@ -910,7 +988,7 @@ public void pullTest2() throws Exception {
}

@Test
public void pullExceptionTest2() throws Exception {
public void pullExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockSubscriber.addException(exception);

Expand All @@ -930,6 +1008,8 @@ public void streamingPullTest() throws Exception {
StreamingPullResponse expectedResponse =
StreamingPullResponse.newBuilder()
.addAllReceivedMessages(new ArrayList<ReceivedMessage>())
.setSubscriptionProperties(
StreamingPullResponse.SubscriptionProperties.newBuilder().build())
.build();
mockSubscriber.addResponse(expectedResponse);
StreamingPullRequest request =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"methods": ["modifyPushConfig", "modifyPushConfig", "modifyPushConfig", "modifyPushConfigCallable"]
},
"Pull": {
"methods": ["pull", "pull", "pull", "pullCallable"]
"methods": ["pull", "pull", "pull", "pull", "pull", "pullCallable"]
},
"Seek": {
"methods": ["seek", "seekCallable"]
Expand Down

0 comments on commit 36594fa

Please sign in to comment.