, Void> retrySettingsSetter =
- builder -> {
- builder.setRetrySettings(options.getRetrySettings());
- return null;
- };
+
FirestoreStubSettings.Builder firestoreBuilder =
- FirestoreStubSettings.newBuilder(clientContext)
- .applyToAllUnaryMethods(retrySettingsSetter);
- // Manually apply the retry settings to streaming methods
- firestoreBuilder.runQuerySettings().setRetrySettings(options.getRetrySettings());
- firestoreBuilder.batchGetDocumentsSettings().setRetrySettings(options.getRetrySettings());
+ FirestoreStubSettings.newBuilder(clientContext);
+ RetrySettings retrySettings = options.getRetrySettings();
+
+ // Override retry settings only if customer provides settings different from default.
+ if (retrySettings.equals(ServiceOptions.getDefaultRetrySettings())) {
+ // We are manually setting `setMaxAttempts(5)` to follow
+ // the `firestore_grpc_service_config.json` configuration.
+ // This code should be removed when following issue is fixed:
+ // https://github.com/googleapis/sdk-platform-java/issues/2306
+ firestoreBuilder.applyToAllUnaryMethods(
+ builder -> {
+ builder.retrySettings().setMaxAttempts(5);
+ return null;
+ });
+ // Manually apply the retry settings to streaming methods
+ firestoreBuilder.runQuerySettings().retrySettings().setMaxAttempts(5);
+ firestoreBuilder.runAggregationQuerySettings().retrySettings().setMaxAttempts(5);
+ firestoreBuilder.batchGetDocumentsSettings().retrySettings().setMaxAttempts(5);
+ } else {
+ firestoreBuilder.applyToAllUnaryMethods(
+ builder -> {
+ builder.setRetrySettings(retrySettings);
+ return null;
+ });
+ // Manually apply the retry settings to streaming methods
+ firestoreBuilder.runQuerySettings().setRetrySettings(retrySettings);
+ firestoreBuilder.runAggregationQuerySettings().setRetrySettings(retrySettings);
+ firestoreBuilder.batchGetDocumentsSettings().setRetrySettings(retrySettings);
+ }
+
firestoreStub = GrpcFirestoreStub.create(firestoreBuilder.build());
} catch (Exception e) {
throw new IOException(e);
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java
index 19576e7769..cd14ac440d 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java
@@ -245,7 +245,6 @@ public static Builder newBuilder() {
}
/** Returns a new REST builder for this class. */
- @BetaApi
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}
@@ -287,7 +286,6 @@ private static Builder createDefault() {
return new Builder(FirestoreStubSettings.newBuilder());
}
- @BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(FirestoreStubSettings.newHttpJsonBuilder());
}
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreCallableFactory.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreCallableFactory.java
index 30f3b061fe..c123bc7d03 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreCallableFactory.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreCallableFactory.java
@@ -16,7 +16,6 @@
package com.google.cloud.firestore.v1.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonCallableFactory;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
@@ -41,7 +40,6 @@
* This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
-@BetaApi
public class HttpJsonFirestoreCallableFactory
implements HttpJsonStubCallableFactory {
@@ -73,8 +71,6 @@ public UnaryCallable createBatchingCa
httpJsonCallSettings, callSettings, clientContext);
}
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
@Override
public
OperationCallable createOperationCallable(
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java
index 59c4da840b..badc0f7e8c 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/HttpJsonFirestoreStub.java
@@ -20,7 +20,6 @@
import static com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
import static com.google.cloud.firestore.v1.FirestoreClient.PartitionQueryPagedResponse;
-import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
@@ -80,7 +79,6 @@
* This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
-@BetaApi
public class HttpJsonFirestoreStub extends FirestoreStub {
private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java
index 7d982b86c6..6858e1a14d 100644
--- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java
+++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/DocumentReferenceTest.java
@@ -872,6 +872,7 @@ public void extractFieldMaskFromMerge() throws Exception {
"second.foo",
"second.geoPointValue",
"second.infValue",
+ "second.instantValue",
"second.longValue",
"second.nanValue",
"second.negInfValue",
diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java
index 706412dae9..d38779fca5 100644
--- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java
+++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java
@@ -75,6 +75,7 @@
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -148,6 +149,7 @@ public final class LocalFirestoreHelper {
public static final Date DATE;
public static final Timestamp TIMESTAMP;
+ public static final Instant INSTANT;
public static final GeoPoint GEO_POINT;
public static final Blob BLOB;
public static final FooList FOO_LIST = new FooList<>();
@@ -942,6 +944,7 @@ public static class AllSupportedTypes {
public SingleField objectValue = new SingleField();
public Date dateValue = DATE;
public Timestamp timestampValue = TIMESTAMP;
+ public Instant instantValue = INSTANT;
public List arrayValue = ImmutableList.of("foo");
public String nullValue = null;
public Blob bytesValue = BLOB;
@@ -968,6 +971,7 @@ public boolean equals(Object o) {
&& Objects.equals(objectValue, that.objectValue)
&& Objects.equals(dateValue, that.dateValue)
&& Objects.equals(timestampValue, that.timestampValue)
+ && Objects.equals(instantValue, that.instantValue)
&& Objects.equals(arrayValue, that.arrayValue)
&& Objects.equals(nullValue, that.nullValue)
&& Objects.equals(bytesValue, that.bytesValue)
@@ -989,6 +993,10 @@ public boolean equals(Object o) {
Timestamp.ofTimeSecondsAndNanos(
TimeUnit.MILLISECONDS.toSeconds(DATE.getTime()),
123000); // Firestore truncates to microsecond precision.
+ INSTANT =
+ Instant.ofEpochSecond(
+ TimeUnit.MILLISECONDS.toSeconds(DATE.getTime()),
+ 123000); // Firestore truncates to microsecond precision.
GEO_POINT = new GeoPoint(50.1430847, -122.9477780);
BLOB = Blob.fromBytes(new byte[] {1, 2, 3});
SINGLE_FLOAT_MAP = map("float", 0.1F);
@@ -1083,6 +1091,7 @@ public boolean equals(Object o) {
ALL_SUPPORTED_TYPES_MAP.put("objectValue", map("foo", (Object) "bar"));
ALL_SUPPORTED_TYPES_MAP.put("dateValue", Timestamp.of(DATE));
ALL_SUPPORTED_TYPES_MAP.put("timestampValue", TIMESTAMP);
+ ALL_SUPPORTED_TYPES_MAP.put("instantValue", TIMESTAMP);
ALL_SUPPORTED_TYPES_MAP.put("arrayValue", ImmutableList.of("foo"));
ALL_SUPPORTED_TYPES_MAP.put("nullValue", null);
ALL_SUPPORTED_TYPES_MAP.put("bytesValue", BLOB);
@@ -1119,6 +1128,14 @@ public boolean equals(Object o) {
.setSeconds(479978400)
.setNanos(123000)) // Timestamps supports microsecond precision.
.build())
+ .put(
+ "instantValue",
+ Value.newBuilder()
+ .setTimestampValue(
+ com.google.protobuf.Timestamp.newBuilder()
+ .setSeconds(479978400)
+ .setNanos(123000)) // Instants supports microsecond precision.
+ .build())
.put(
"arrayValue",
Value.newBuilder()
diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpcTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpcTest.java
new file mode 100644
index 0000000000..e4e888ff0e
--- /dev/null
+++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/spi/v1/GrpcFirestoreRpcTest.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.firestore.spi.v1;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.api.gax.retrying.ExponentialRetryAlgorithm;
+import com.google.api.gax.retrying.RetryAlgorithm;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.api.gax.retrying.ScheduledRetryingExecutor;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.StatusCode.Code;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.firestore.FirestoreOptions;
+import com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
+import com.google.cloud.firestore.v1.FirestoreClient.PartitionQueryPagedResponse;
+import com.google.cloud.firestore.v1.stub.FirestoreStubSettings;
+import com.google.firestore.v1.BatchGetDocumentsRequest;
+import com.google.firestore.v1.BatchGetDocumentsResponse;
+import com.google.firestore.v1.BatchWriteRequest;
+import com.google.firestore.v1.BatchWriteResponse;
+import com.google.firestore.v1.BeginTransactionRequest;
+import com.google.firestore.v1.BeginTransactionResponse;
+import com.google.firestore.v1.CommitRequest;
+import com.google.firestore.v1.CommitResponse;
+import com.google.firestore.v1.ListDocumentsRequest;
+import com.google.firestore.v1.ListDocumentsResponse;
+import com.google.firestore.v1.PartitionQueryRequest;
+import com.google.firestore.v1.PartitionQueryResponse;
+import com.google.firestore.v1.RollbackRequest;
+import com.google.firestore.v1.RunAggregationQueryRequest;
+import com.google.firestore.v1.RunAggregationQueryResponse;
+import com.google.firestore.v1.RunQueryRequest;
+import com.google.firestore.v1.RunQueryResponse;
+import com.google.protobuf.Empty;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Set;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class GrpcFirestoreRpcTest {
+
+ private static FirestoreStubSettings defaultStubSettings;
+
+ private final FirestoreOptions firestoreOptionsWithoutOverride =
+ FirestoreOptions.newBuilder().setProjectId("test-project").build();
+
+ @BeforeClass
+ public static void beforeClass() throws IOException {
+ defaultStubSettings = FirestoreStubSettings.newBuilder().build();
+ }
+
+ static T getViaReflection(Object o, String fieldName)
+ throws NoSuchFieldException, IllegalAccessException {
+ return getViaReflection(o.getClass(), fieldName, o);
+ }
+
+ static T getViaReflection(Class clazz, String fieldName, Object o)
+ throws NoSuchFieldException, IllegalAccessException {
+ Field field = clazz.getDeclaredField(fieldName);
+ field.setAccessible(true);
+ return (T) field.get(o);
+ }
+
+ @Test
+ public void retrySettingsOverride() throws Exception {
+ RetrySettings retrySettings = RetrySettings.newBuilder().setMaxAttempts(2).build();
+ FirestoreOptions firestoreOptions =
+ FirestoreOptions.newBuilder()
+ .setProjectId("test-project")
+ .setRetrySettings(retrySettings)
+ .build();
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptions);
+
+ CallableRetryData commit = getRetryData(grpcFirestoreRpc.commitCallable());
+ assertThat(commit.retrySettings).isEqualTo(retrySettings);
+ assertThat(commit.retryableCodes)
+ .containsExactlyElementsIn(defaultStubSettings.commitSettings().getRetryableCodes());
+
+ CallableRetryData batchWrite = getRetryData(grpcFirestoreRpc.batchWriteCallable());
+ assertThat(batchWrite.retrySettings).isEqualTo(retrySettings);
+ assertThat(batchWrite.retryableCodes)
+ .containsExactlyElementsIn(defaultStubSettings.batchWriteSettings().getRetryableCodes());
+
+ CallableRetryData batchGetDocuments =
+ getRetryData(grpcFirestoreRpc.batchGetDocumentsCallable());
+ assertThat(batchGetDocuments.retrySettings).isEqualTo(retrySettings);
+ assertThat(batchGetDocuments.retryableCodes)
+ .containsExactlyElementsIn(
+ defaultStubSettings.batchGetDocumentsSettings().getRetryableCodes());
+
+ CallableRetryData runQuery = getRetryData(grpcFirestoreRpc.runQueryCallable());
+ assertThat(runQuery.retrySettings).isEqualTo(retrySettings);
+ assertThat(runQuery.retryableCodes)
+ .containsExactlyElementsIn(defaultStubSettings.runQuerySettings().getRetryableCodes());
+
+ CallableRetryData runAggregationQuery =
+ getRetryData(grpcFirestoreRpc.runAggregationQueryCallable());
+ assertThat(runAggregationQuery.retrySettings).isEqualTo(retrySettings);
+ assertThat(runAggregationQuery.retryableCodes)
+ .containsExactlyElementsIn(
+ defaultStubSettings.runAggregationQuerySettings().getRetryableCodes());
+
+ CallableRetryData beginTransaction = getRetryData(grpcFirestoreRpc.beginTransactionCallable());
+ assertThat(beginTransaction.retrySettings).isEqualTo(retrySettings);
+ assertThat(beginTransaction.retryableCodes)
+ .containsExactlyElementsIn(
+ defaultStubSettings.beginTransactionSettings().getRetryableCodes());
+
+ CallableRetryData rollback = getRetryData(grpcFirestoreRpc.rollbackCallable());
+ assertThat(rollback.retrySettings).isEqualTo(retrySettings);
+ assertThat(rollback.retryableCodes)
+ .containsExactlyElementsIn(defaultStubSettings.rollbackSettings().getRetryableCodes());
+
+ CallableRetryData listCollectionIdsPaged =
+ getRetryData(grpcFirestoreRpc.listCollectionIdsPagedCallable());
+ assertThat(listCollectionIdsPaged.retrySettings).isEqualTo(retrySettings);
+ assertThat(listCollectionIdsPaged.retryableCodes)
+ .containsExactlyElementsIn(
+ defaultStubSettings.listCollectionIdsSettings().getRetryableCodes());
+
+ CallableRetryData partitionQueryPaged =
+ getRetryData(grpcFirestoreRpc.partitionQueryPagedCallable());
+ assertThat(partitionQueryPaged.retrySettings).isEqualTo(retrySettings);
+ assertThat(partitionQueryPaged.retryableCodes)
+ .containsExactlyElementsIn(
+ defaultStubSettings.partitionQuerySettings().getRetryableCodes());
+
+ CallableRetryData listDocumentsPaged =
+ getRetryData(grpcFirestoreRpc.listDocumentsPagedCallable());
+ assertThat(listDocumentsPaged.retrySettings).isEqualTo(retrySettings);
+ assertThat(listDocumentsPaged.retryableCodes)
+ .containsExactlyElementsIn(defaultStubSettings.listDocumentsSettings().getRetryableCodes());
+ }
+
+ private static RetrySettings withMaxAttempt5(RetrySettings retrySettings) {
+ return retrySettings.toBuilder().setMaxAttempts(5).build();
+ }
+
+ @Test
+ public void commitCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.commitCallable());
+ UnaryCallSettings expectedSettings =
+ defaultStubSettings.commitSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void batchWriteCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.batchWriteCallable());
+ UnaryCallSettings expectedSettings =
+ defaultStubSettings.batchWriteSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void batchGetDocumentsCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.batchGetDocumentsCallable());
+ ServerStreamingCallSettings
+ expectedSettings = defaultStubSettings.batchGetDocumentsSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void runQueryCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.runQueryCallable());
+ ServerStreamingCallSettings expectedSettings =
+ defaultStubSettings.runQuerySettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void runAggregationQueryCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.runAggregationQueryCallable());
+ ServerStreamingCallSettings
+ expectedSettings = defaultStubSettings.runAggregationQuerySettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void beginTransactionCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.beginTransactionCallable());
+ UnaryCallSettings expectedSettings =
+ defaultStubSettings.beginTransactionSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void rollbackCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.rollbackCallable());
+ UnaryCallSettings expectedSettings =
+ defaultStubSettings.rollbackSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void listCollectionIdsPagedCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.listCollectionIdsPagedCallable());
+ PagedCallSettings
+ expectedSettings = defaultStubSettings.listDocumentsSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void partitionQueryPagedCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.partitionQueryPagedCallable());
+ PagedCallSettings
+ expectedSettings = defaultStubSettings.partitionQuerySettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ @Test
+ public void listDocumentsPagedCallableFollowsServiceConfig() throws Exception {
+ GrpcFirestoreRpc grpcFirestoreRpc = new GrpcFirestoreRpc(firestoreOptionsWithoutOverride);
+ CallableRetryData actual = getRetryData(grpcFirestoreRpc.listDocumentsPagedCallable());
+ PagedCallSettings
+ expectedSettings = defaultStubSettings.listDocumentsSettings();
+ assertThat(actual.retrySettings)
+ .isEqualTo(withMaxAttempt5(expectedSettings.getRetrySettings()));
+ assertThat(actual.retryableCodes)
+ .containsExactlyElementsIn(expectedSettings.getRetryableCodes());
+ }
+
+ private static CallableRetryData getRetryData(Object callable) throws Exception {
+ String aClassName = callable.getClass().getName();
+ switch (aClassName) {
+ case "com.google.api.gax.tracing.TracedUnaryCallable":
+ case "com.google.api.gax.tracing.TracedServerStreamingCallable":
+ return getRetryData(getViaReflection(callable, "innerCallable"));
+ case "com.google.api.gax.rpc.UnaryCallable$1":
+ case "com.google.api.gax.rpc.ServerStreamingCallable$1":
+ return getRetryData(getViaReflection(callable, "this$0"));
+ case "com.google.api.gax.rpc.RetryingCallable":
+ return new CallableRetryData(
+ getRetrySettings(getViaReflection(callable, "executor")),
+ getRetryableCodes(getViaReflection(callable, "callable")));
+ case "com.google.api.gax.rpc.RetryingServerStreamingCallable":
+ return new CallableRetryData(
+ getRetrySettings(getViaReflection(callable, "executor")),
+ getRetryableCodes(getViaReflection(callable, "innerCallable")));
+ case "com.google.api.gax.rpc.PagedCallable":
+ return getRetryData(getViaReflection(callable, "callable"));
+ default:
+ throw new Exception("Unexpected class " + aClassName);
+ }
+ }
+
+ private static Set getRetryableCodes(Object o)
+ throws NoSuchFieldException, IllegalAccessException {
+ switch (o.getClass().getName()) {
+ case "com.google.api.gax.rpc.ServerStreamingCallable$1":
+ return getRetryableCodes(getViaReflection(o, "this$0"));
+ case "com.google.api.gax.rpc.WatchdogServerStreamingCallable":
+ return getRetryableCodes(getViaReflection(o, "inner"));
+ }
+ Object exceptionFactory = getViaReflection(o, "exceptionFactory");
+ return getViaReflection(exceptionFactory, "retryableCodes");
+ }
+
+ private static RetrySettings getRetrySettings(Object o) throws Exception {
+ String aClassName = o.getClass().getName();
+ switch (aClassName) {
+ case "com.google.api.gax.retrying.ScheduledRetryingExecutor":
+ {
+ Object retryAlgorithm =
+ getViaReflection(ScheduledRetryingExecutor.class, "retryAlgorithm", o);
+ Object exponentialRetryAlgorithm =
+ getViaReflection(RetryAlgorithm.class, "timedAlgorithmWithContext", retryAlgorithm);
+ return getViaReflection(
+ ExponentialRetryAlgorithm.class, "globalSettings", exponentialRetryAlgorithm);
+ }
+ default:
+ throw new Exception("Unexpected class " + aClassName);
+ }
+ }
+
+ static class CallableRetryData {
+ final RetrySettings retrySettings;
+ final Set retryableCodes;
+
+ CallableRetryData(RetrySettings retrySettings, Set retryableCodes) {
+ this.retrySettings = retrySettings;
+ this.retryableCodes = retryableCodes;
+ }
+ }
+}
diff --git a/grpc-google-cloud-firestore-admin-v1/pom.xml b/grpc-google-cloud-firestore-admin-v1/pom.xml
index c808e7e910..ad2565785c 100644
--- a/grpc-google-cloud-firestore-admin-v1/pom.xml
+++ b/grpc-google-cloud-firestore-admin-v1/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
grpc-google-cloud-firestore-admin-v1
- 3.17.1
+ 3.18.0
grpc-google-cloud-firestore-admin-v1
GRPC library for grpc-google-cloud-firestore-admin-v1
com.google.cloud
google-cloud-firestore-parent
- 3.17.1
+ 3.18.0
diff --git a/grpc-google-cloud-firestore-v1/pom.xml b/grpc-google-cloud-firestore-v1/pom.xml
index 3fb859e8e1..6f87981498 100644
--- a/grpc-google-cloud-firestore-v1/pom.xml
+++ b/grpc-google-cloud-firestore-v1/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
grpc-google-cloud-firestore-v1
- 3.17.1
+ 3.18.0
grpc-google-cloud-firestore-v1
GRPC library for grpc-google-cloud-firestore-v1
com.google.cloud
google-cloud-firestore-parent
- 3.17.1
+ 3.18.0
diff --git a/pom.xml b/pom.xml
index 96c1aa5063..3b820ccabb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloud
google-cloud-firestore-parent
pom
- 3.17.1
+ 3.18.0
Google Cloud Firestore Parent
https://github.com/googleapis/java-firestore
@@ -14,7 +14,7 @@
com.google.cloud
sdk-platform-java-config
- 3.25.0
+ 3.27.0
@@ -150,32 +150,32 @@
com.google.api.grpc
proto-google-cloud-firestore-admin-v1
- 3.17.1
+ 3.18.0
com.google.cloud
google-cloud-firestore
- 3.17.1
+ 3.18.0
com.google.cloud
proto-google-cloud-firestore-bundle-v1
- 3.17.1
+ 3.18.0
com.google.api.grpc
proto-google-cloud-firestore-v1
- 3.17.1
+ 3.18.0
com.google.api.grpc
grpc-google-cloud-firestore-admin-v1
- 3.17.1
+ 3.18.0
com.google.api.grpc
grpc-google-cloud-firestore-v1
- 3.17.1
+ 3.18.0
@@ -195,7 +195,7 @@
com.google.truth
truth
- 1.4.1
+ 1.4.2
test
diff --git a/proto-google-cloud-firestore-admin-v1/pom.xml b/proto-google-cloud-firestore-admin-v1/pom.xml
index cc3f99c2ff..36d2a4e628 100644
--- a/proto-google-cloud-firestore-admin-v1/pom.xml
+++ b/proto-google-cloud-firestore-admin-v1/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
proto-google-cloud-firestore-admin-v1
- 3.17.1
+ 3.18.0
proto-google-cloud-firestore-admin-v1
PROTO library for proto-google-cloud-firestore-admin-v1
com.google.cloud
google-cloud-firestore-parent
- 3.17.1
+ 3.18.0
diff --git a/proto-google-cloud-firestore-bundle-v1/pom.xml b/proto-google-cloud-firestore-bundle-v1/pom.xml
index 6f1fded072..a493f54eae 100644
--- a/proto-google-cloud-firestore-bundle-v1/pom.xml
+++ b/proto-google-cloud-firestore-bundle-v1/pom.xml
@@ -5,14 +5,14 @@
4.0.0
proto-google-cloud-firestore-bundle-v1
- 3.17.1
+ 3.18.0
proto-google-cloud-firestore-bundle-v1
PROTO library for proto-google-cloud-firestore-bundle-v1
com.google.cloud
google-cloud-firestore-parent
- 3.17.1
+ 3.18.0
diff --git a/proto-google-cloud-firestore-v1/pom.xml b/proto-google-cloud-firestore-v1/pom.xml
index 278b30245c..4ecb163192 100644
--- a/proto-google-cloud-firestore-v1/pom.xml
+++ b/proto-google-cloud-firestore-v1/pom.xml
@@ -4,13 +4,13 @@
4.0.0
com.google.api.grpc
proto-google-cloud-firestore-v1
- 3.17.1
+ 3.18.0
proto-google-cloud-firestore-v1
PROTO library for proto-google-cloud-firestore-v1
com.google.cloud
google-cloud-firestore-parent
- 3.17.1
+ 3.18.0
diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml
index 17a67f6c32..65aeee0d9d 100644
--- a/samples/install-without-bom/pom.xml
+++ b/samples/install-without-bom/pom.xml
@@ -30,7 +30,7 @@
com.google.cloud
google-cloud-firestore
- 3.17.0
+ 3.17.1
@@ -55,7 +55,7 @@
com.google.truth
truth
- 1.4.1
+ 1.4.2
test
diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml
index 51fb3f7119..4eca4021ca 100644
--- a/samples/native-image-sample/pom.xml
+++ b/samples/native-image-sample/pom.xml
@@ -66,7 +66,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
com.google.truth
truth
- 1.4.1
+ 1.4.2
test
diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml
index 24c857e190..29dd2d9f0e 100644
--- a/samples/snapshot/pom.xml
+++ b/samples/snapshot/pom.xml
@@ -29,7 +29,7 @@
com.google.cloud
google-cloud-firestore
- 3.17.0
+ 3.17.1
@@ -41,7 +41,7 @@
com.google.truth
truth
- 1.4.1
+ 1.4.2
test
diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml
index 407edfd237..658b6a08ac 100644
--- a/samples/snippets/pom.xml
+++ b/samples/snippets/pom.xml
@@ -69,7 +69,7 @@
com.google.truth
truth
- 1.4.1
+ 1.4.2
test
diff --git a/versions.txt b/versions.txt
index 9d1a130f9e..38072e0543 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,11 +1,11 @@
# Format:
# module:released-version:current-version
-google-cloud-firestore:3.17.1:3.17.1
-google-cloud-firestore-admin:3.17.1:3.17.1
-google-cloud-firestore-bom:3.17.1:3.17.1
-grpc-google-cloud-firestore-admin-v1:3.17.1:3.17.1
-grpc-google-cloud-firestore-v1:3.17.1:3.17.1
-proto-google-cloud-firestore-admin-v1:3.17.1:3.17.1
-proto-google-cloud-firestore-v1:3.17.1:3.17.1
-proto-google-cloud-firestore-bundle-v1:3.17.1:3.17.1
+google-cloud-firestore:3.18.0:3.18.0
+google-cloud-firestore-admin:3.18.0:3.18.0
+google-cloud-firestore-bom:3.18.0:3.18.0
+grpc-google-cloud-firestore-admin-v1:3.18.0:3.18.0
+grpc-google-cloud-firestore-v1:3.18.0:3.18.0
+proto-google-cloud-firestore-admin-v1:3.18.0:3.18.0
+proto-google-cloud-firestore-v1:3.18.0:3.18.0
+proto-google-cloud-firestore-bundle-v1:3.18.0:3.18.0