From 876c53e0104d9bc618ca9c2e99753bc9e390a871 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 18 Oct 2024 14:57:16 -0400 Subject: [PATCH 1/8] fix(test): add mock method to mock credentials. --- .../cloud/spring/autoconfigure/TestUtils.java | 38 +++++++++++++++++++ .../GcpBigQueryAutoConfigurationTests.java | 9 ++--- .../GcpContextAutoConfigurationTests.java | 5 +-- ...HealthIndicatorAutoConfigurationTests.java | 4 +- .../GcpDatastoreEmulatorIntegrationTests.java | 5 +-- .../GcpFirestoreAutoConfigurationTests.java | 5 +-- .../kms/KmsAutoConfigurationTests.java | 2 + ...ckdriverLoggingAutoConfigurationTests.java | 5 +-- .../GcpPubSubAutoConfigurationTests.java | 4 +- ...pPubSubEmulatorAutoConfigurationTests.java | 3 +- ...cpPubSubReactiveAutoConfigurationTest.java | 3 +- ...HealthIndicatorAutoConfigurationTests.java | 3 +- ...HealthIndicatorAutoConfigurationTests.java | 3 +- ...cretManagerAutoConfigurationUnitTests.java | 3 +- ...eAuthenticationAutoConfigurationTests.java | 3 +- .../GcpSpannerAutoConfigurationTests.java | 4 +- ...HealthIndicatorAutoConfigurationTests.java | 3 +- .../GcpStorageAutoConfigurationTests.java | 3 +- .../PubSubMessageChannelBinderTests.java | 6 ++- .../PubSubBinderConfigurationTests.java | 7 +++- 20 files changed, 85 insertions(+), 33 deletions(-) create mode 100644 spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java new file mode 100644 index 0000000000..4084c973bb --- /dev/null +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java @@ -0,0 +1,38 @@ +/* + * 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 + * + * https://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.spring.autoconfigure; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import com.google.auth.CredentialTypeForMetrics; +import com.google.auth.Credentials; + +public class TestUtils { + public static final Credentials MOCK_CREDENTIALS = createMockCredentials(); + + private static Credentials createMockCredentials() { + Credentials mockCredential = mock(Credentials.class); + when(mockCredential.getMetricsCredentialType()) + .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); + return mockCredential; + } + + public static Credentials getMockCredentials() { + return MOCK_CREDENTIALS; + } +} diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/bigquery/GcpBigQueryAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/bigquery/GcpBigQueryAutoConfigurationTests.java index 110b7b1fa5..b81254415a 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/bigquery/GcpBigQueryAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/bigquery/GcpBigQueryAutoConfigurationTests.java @@ -17,13 +17,12 @@ package com.google.cloud.spring.autoconfigure.bigquery; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; import com.google.api.gax.core.CredentialsProvider; -import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.bigquery.BigQuery; import com.google.cloud.bigquery.BigQueryOptions; import com.google.cloud.bigquery.storage.v1.BigQueryWriteClient; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.bigquery.core.BigQueryTemplate; import org.junit.jupiter.api.Test; @@ -34,8 +33,6 @@ class GcpBigQueryAutoConfigurationTests { - private static final GoogleCredentials MOCK_CREDENTIALS = mock(GoogleCredentials.class); - private ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration( @@ -52,7 +49,7 @@ void testSettingBigQueryOptions() { context -> { BigQueryOptions bigQueryOptions = context.getBean(BigQuery.class).getOptions(); assertThat(bigQueryOptions.getProjectId()).isEqualTo("test-project"); - assertThat(bigQueryOptions.getCredentials()).isEqualTo(MOCK_CREDENTIALS); + assertThat(bigQueryOptions.getCredentials()).isEqualTo(TestUtils.MOCK_CREDENTIALS); BigQueryTemplate bigQueryTemplate = context.getBean(BigQueryTemplate.class); assertThat(bigQueryTemplate.getDatasetName()).isEqualTo("test-dataset"); @@ -168,7 +165,7 @@ static class TestConfiguration { @Bean public CredentialsProvider credentialsProvider() { - return () -> MOCK_CREDENTIALS; + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/core/GcpContextAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/core/GcpContextAutoConfigurationTests.java index 2e65cdd7ac..3fc700cef6 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/core/GcpContextAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/core/GcpContextAutoConfigurationTests.java @@ -17,10 +17,9 @@ package com.google.cloud.spring.autoconfigure.core; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; import com.google.api.gax.core.CredentialsProvider; -import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.core.DefaultGcpEnvironmentProvider; import com.google.cloud.spring.core.DefaultGcpProjectIdProvider; import com.google.cloud.spring.core.GcpEnvironmentProvider; @@ -99,7 +98,7 @@ private static class TestConfiguration { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/health/DatastoreHealthIndicatorAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/health/DatastoreHealthIndicatorAutoConfigurationTests.java index 9c18936c9e..7f04bd967f 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/health/DatastoreHealthIndicatorAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/health/DatastoreHealthIndicatorAutoConfigurationTests.java @@ -20,7 +20,7 @@ import static org.mockito.Mockito.mock; import com.google.api.gax.core.CredentialsProvider; -import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.autoconfigure.datastore.GcpDatastoreAutoConfiguration; import org.junit.jupiter.api.Test; @@ -61,7 +61,7 @@ static class TestConfiguration { @Bean public CredentialsProvider credentialsProvider() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/it/GcpDatastoreEmulatorIntegrationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/it/GcpDatastoreEmulatorIntegrationTests.java index b6819b2ee6..c466e8e62c 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/it/GcpDatastoreEmulatorIntegrationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/datastore/it/GcpDatastoreEmulatorIntegrationTests.java @@ -18,16 +18,15 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.Mockito.mock; import com.google.api.gax.core.CredentialsProvider; -import com.google.auth.Credentials; import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.DatastoreException; import com.google.cloud.datastore.DatastoreOptions; import com.google.cloud.datastore.EntityQuery; import com.google.cloud.datastore.Query; import com.google.cloud.datastore.StructuredQuery; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.autoconfigure.datastore.DatastoreRepositoriesAutoConfiguration; import com.google.cloud.spring.autoconfigure.datastore.DatastoreTransactionManagerAutoConfiguration; @@ -118,7 +117,7 @@ static class TestConfiguration { @Bean public CredentialsProvider credentialsProvider() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/firestore/GcpFirestoreAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/firestore/GcpFirestoreAutoConfigurationTests.java index a86a424eed..c99f2cb27b 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/firestore/GcpFirestoreAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/firestore/GcpFirestoreAutoConfigurationTests.java @@ -18,12 +18,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.mock; import com.google.api.gax.core.CredentialsProvider; -import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.firestore.Firestore; import com.google.cloud.firestore.FirestoreOptions; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.firestore.v1.FirestoreGrpc; import io.grpc.ClientInterceptor; @@ -136,7 +135,7 @@ static class TestConfiguration { @Bean public CredentialsProvider credentialsProvider() { - return () -> mock(GoogleCredentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/kms/KmsAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/kms/KmsAutoConfigurationTests.java index 251af8c845..723e9bf94d 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/kms/KmsAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/kms/KmsAutoConfigurationTests.java @@ -21,6 +21,7 @@ import static org.mockito.Mockito.when; import com.google.api.gax.core.CredentialsProvider; +import com.google.auth.CredentialTypeForMetrics; import com.google.auth.Credentials; import com.google.auth.oauth2.ServiceAccountCredentials; import com.google.auth.oauth2.UserCredentials; @@ -172,6 +173,7 @@ static class TestConfiguration { public static CredentialsProvider googleCredentials() { UserCredentials mockUserCredential = mock(UserCredentials.class); when(mockUserCredential.getClientId()).thenReturn(CORE_CREDENTIAL_CLIENT_ID); + when(mockUserCredential.getMetricsCredentialType()).thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); return () -> mockUserCredential; } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/logging/StackdriverLoggingAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/logging/StackdriverLoggingAutoConfigurationTests.java index f23921b224..185448f284 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/logging/StackdriverLoggingAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/logging/StackdriverLoggingAutoConfigurationTests.java @@ -17,10 +17,9 @@ package com.google.cloud.spring.autoconfigure.logging; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; import com.google.api.gax.core.CredentialsProvider; -import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.autoconfigure.trace.StackdriverTraceAutoConfiguration; import com.google.cloud.spring.logging.TraceIdLoggingWebMvcInterceptor; @@ -105,7 +104,7 @@ private static class TestConfiguration { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } @Bean diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubAutoConfigurationTests.java index 86a16d8621..bef9165326 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubAutoConfigurationTests.java @@ -29,9 +29,9 @@ import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.StatusCode.Code; import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.auth.Credentials; import com.google.cloud.pubsub.v1.Publisher; import com.google.cloud.pubsub.v1.Subscriber; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.core.GcpProjectIdProvider; import com.google.cloud.spring.pubsub.core.PubSubConfiguration; import com.google.cloud.spring.pubsub.core.publisher.PublisherCustomizer; @@ -1459,7 +1459,7 @@ public GcpProjectIdProvider projectIdProvider() { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubEmulatorAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubEmulatorAutoConfigurationTests.java index d10b1a5058..005778ac88 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubEmulatorAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubEmulatorAutoConfigurationTests.java @@ -28,6 +28,7 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.auth.Credentials; import com.google.cloud.pubsub.v1.TopicAdminSettings; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.pubsub.core.PubSubConfiguration; import org.assertj.core.data.Offset; @@ -187,7 +188,7 @@ void testPublisherBatchingSettings() { private static class TestConfiguration { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubReactiveAutoConfigurationTest.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubReactiveAutoConfigurationTest.java index 52f9802b62..463ba373ee 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubReactiveAutoConfigurationTest.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/GcpPubSubReactiveAutoConfigurationTest.java @@ -22,6 +22,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.core.GcpProjectIdProvider; import com.google.cloud.spring.pubsub.core.subscriber.PubSubSubscriberOperations; import com.google.cloud.spring.pubsub.core.subscriber.PubSubSubscriberTemplate; @@ -165,7 +166,7 @@ public GcpProjectIdProvider projectIdProvider() { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfigurationTests.java index 97504d05f5..c30cd4e2f8 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubHealthIndicatorAutoConfigurationTests.java @@ -28,6 +28,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.pubsub.GcpPubSubAutoConfiguration; import com.google.cloud.spring.core.GcpProjectIdProvider; import com.google.cloud.spring.pubsub.core.PubSubTemplate; @@ -55,7 +56,7 @@ class PubSubHealthIndicatorAutoConfigurationTests { AutoConfigurations.of( PubSubHealthIndicatorAutoConfiguration.class, GcpPubSubAutoConfiguration.class)) .withBean(GcpProjectIdProvider.class, () -> () -> "fake project") - .withBean(CredentialsProvider.class, () -> () -> mock(Credentials.class)); + .withBean(CredentialsProvider.class, () -> () -> TestUtils.MOCK_CREDENTIALS); @SuppressWarnings("unchecked") @Test diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubSubscriptionHealthIndicatorAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubSubscriptionHealthIndicatorAutoConfigurationTests.java index e92cf0edf7..4b3ad4b410 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubSubscriptionHealthIndicatorAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/pubsub/health/PubSubSubscriptionHealthIndicatorAutoConfigurationTests.java @@ -22,6 +22,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; import com.google.cloud.monitoring.v3.MetricServiceClient; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.pubsub.GcpPubSubAutoConfiguration; import com.google.cloud.spring.core.GcpProjectIdProvider; import org.junit.jupiter.api.Test; @@ -40,7 +41,7 @@ class PubSubSubscriptionHealthIndicatorAutoConfigurationTests { PubSubSubscriptionHealthIndicatorAutoConfiguration.class, GcpPubSubAutoConfiguration.class)) .withBean(GcpProjectIdProvider.class, () -> () -> "fake project") - .withBean(CredentialsProvider.class, () -> () -> mock(Credentials.class)) + .withBean(CredentialsProvider.class, () -> () -> TestUtils.MOCK_CREDENTIALS) .withBean(MetricServiceClient.class, () -> mock(MetricServiceClient.class)); @Test diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/secretmanager/GcpSecretManagerAutoConfigurationUnitTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/secretmanager/GcpSecretManagerAutoConfigurationUnitTests.java index 646b0ece1f..f90ab28286 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/secretmanager/GcpSecretManagerAutoConfigurationUnitTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/secretmanager/GcpSecretManagerAutoConfigurationUnitTests.java @@ -22,6 +22,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; import com.google.cloud.secretmanager.v1.SecretManagerServiceClient; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.secretmanager.SecretManagerTemplate; import org.junit.jupiter.api.BeforeEach; @@ -77,7 +78,7 @@ static class TestConfig { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/security/FirebaseAuthenticationAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/security/FirebaseAuthenticationAutoConfigurationTests.java index 8a46e12ed5..72594e1972 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/security/FirebaseAuthenticationAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/security/FirebaseAuthenticationAutoConfigurationTests.java @@ -22,6 +22,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.core.GcpProjectIdProvider; import com.google.cloud.spring.security.firebase.FirebaseJwtTokenDecoder; import org.junit.jupiter.api.Test; @@ -72,7 +73,7 @@ public GcpProjectIdProvider projectIdProvider() { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/GcpSpannerAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/GcpSpannerAutoConfigurationTests.java index b50e76b171..77f362ce41 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/GcpSpannerAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/GcpSpannerAutoConfigurationTests.java @@ -23,9 +23,11 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.api.gax.retrying.RetrySettings; +import com.google.auth.CredentialTypeForMetrics; import com.google.auth.Credentials; import com.google.cloud.NoCredentials; import com.google.cloud.spanner.SpannerOptions; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.data.spanner.core.SpannerOperations; import com.google.cloud.spring.data.spanner.core.SpannerTransactionManager; @@ -186,7 +188,7 @@ static class TestConfiguration { /** Mock bean for credentials provider. */ @Bean public CredentialsProvider credentialsProvider() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } /** Mock bean for Gson. */ diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/health/SpannerHealthIndicatorAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/health/SpannerHealthIndicatorAutoConfigurationTests.java index 5ae4e41fad..7053c959c8 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/health/SpannerHealthIndicatorAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/spanner/health/SpannerHealthIndicatorAutoConfigurationTests.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; import com.google.cloud.spanner.Statement; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.autoconfigure.spanner.GcpSpannerAutoConfiguration; import com.google.gson.Gson; @@ -94,7 +95,7 @@ static class TestConfiguration { @Bean public CredentialsProvider credentialsProvider() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } @Bean diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/storage/GcpStorageAutoConfigurationTests.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/storage/GcpStorageAutoConfigurationTests.java index e9485dfde6..225f1f8548 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/storage/GcpStorageAutoConfigurationTests.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/storage/GcpStorageAutoConfigurationTests.java @@ -23,6 +23,7 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; +import com.google.cloud.spring.autoconfigure.TestUtils; import com.google.cloud.spring.core.GcpProjectIdProvider; import com.google.cloud.spring.storage.GoogleStorageResource; import com.google.cloud.storage.Blob; @@ -149,7 +150,7 @@ static class TestConfiguration { @Bean public static CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + return () -> TestUtils.MOCK_CREDENTIALS; } @Bean diff --git a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java index 16ce391154..654c57987c 100644 --- a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java +++ b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java @@ -22,6 +22,7 @@ import static org.mockito.Mockito.when; import com.google.api.gax.core.CredentialsProvider; +import com.google.auth.CredentialTypeForMetrics; import com.google.auth.Credentials; import com.google.cloud.spring.core.GcpProjectIdProvider; import com.google.cloud.spring.pubsub.PubSubAdmin; @@ -394,7 +395,10 @@ public GcpProjectIdProvider projectIdProvider() { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + Credentials mockCredential = mock(Credentials.class); + when(mockCredential.getMetricsCredentialType()) + .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); + return () -> mockCredential; } } } diff --git a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java index ea41b2a5c5..35d1f7dd6d 100644 --- a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java +++ b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java @@ -18,8 +18,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import com.google.api.gax.core.CredentialsProvider; +import com.google.auth.CredentialTypeForMetrics; import com.google.auth.Credentials; import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; import com.google.cloud.spring.autoconfigure.pubsub.GcpPubSubAutoConfiguration; @@ -165,7 +167,10 @@ void test_healthRegistryEnabled() { private static class TestConfiguration { @Bean public CredentialsProvider googleCredentials() { - return () -> mock(Credentials.class); + Credentials mockCredential = mock(Credentials.class); + when(mockCredential.getMetricsCredentialType()) + .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); + return () -> mockCredential; } @Bean From 75c51a9890a103fec7f400072684b49b8a61a725 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 18 Oct 2024 16:01:53 -0400 Subject: [PATCH 2/8] upgrade libraries bom to test. --- spring-cloud-gcp-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-gcp-dependencies/pom.xml b/spring-cloud-gcp-dependencies/pom.xml index f10ba1d7ee..72433a177f 100644 --- a/spring-cloud-gcp-dependencies/pom.xml +++ b/spring-cloud-gcp-dependencies/pom.xml @@ -34,7 +34,7 @@ - 26.48.0 + 26.49.0 1.21.0 1.0.5.RELEASE 1.3.0 From 552d04b68ddf6a42af8b4c717afb2cbf6073b248 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Mon, 21 Oct 2024 10:25:03 -0400 Subject: [PATCH 3/8] Revert "upgrade libraries bom to test." This reverts commit 75c51a9890a103fec7f400072684b49b8a61a725. --- spring-cloud-gcp-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-gcp-dependencies/pom.xml b/spring-cloud-gcp-dependencies/pom.xml index 72433a177f..f10ba1d7ee 100644 --- a/spring-cloud-gcp-dependencies/pom.xml +++ b/spring-cloud-gcp-dependencies/pom.xml @@ -34,7 +34,7 @@ - 26.49.0 + 26.48.0 1.21.0 1.0.5.RELEASE 1.3.0 From 95cd6aed2663d30da090c16cb5681713426bb095 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Fri, 18 Oct 2024 16:01:53 -0400 Subject: [PATCH 4/8] upgrade libraries bom to test. --- spring-cloud-gcp-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-gcp-dependencies/pom.xml b/spring-cloud-gcp-dependencies/pom.xml index cc9034a47c..e575229b89 100644 --- a/spring-cloud-gcp-dependencies/pom.xml +++ b/spring-cloud-gcp-dependencies/pom.xml @@ -34,7 +34,7 @@ - 26.48.0 + 26.49.0 1.21.0 1.0.7.RELEASE 1.3.0 From cb2ad2bb713d94264b968ece9c5b14b73a82c501 Mon Sep 17 00:00:00 2001 From: Cloud Java Bot Date: Mon, 21 Oct 2024 15:48:46 +0000 Subject: [PATCH 5/8] chore: update starter modules in spring-cloud-previews --- spring-cloud-previews/README.md | 218 ++++++------ .../BackupDRSpringAutoConfiguration.java | 79 ++--- .../v1/spring/BackupDRSpringProperties.java | 52 +-- ...CenterInsightsSpringAutoConfiguration.java | 21 ++ ...ContactCenterInsightsSpringProperties.java | 13 + .../CloudDeploySpringAutoConfiguration.java | 41 +++ .../spring/CloudDeploySpringProperties.java | 26 ++ ...uestionServiceSpringAutoConfiguration.java | 319 ++++++++++++++++++ ...rativeQuestionServiceSpringProperties.java | 150 ++++++++ ...itional-spring-configuration-metadata.json | 6 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + 11 files changed, 720 insertions(+), 206 deletions(-) create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringAutoConfiguration.java create mode 100644 spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringProperties.java diff --git a/spring-cloud-previews/README.md b/spring-cloud-previews/README.md index 657b2b6895..2e575a1a9a 100644 --- a/spring-cloud-previews/README.md +++ b/spring-cloud-previews/README.md @@ -16,112 +16,112 @@ add the following dependency to your `pom.xml`: | Client Library | Starter Maven Artifact | |----------------| -----------------------| -|[java/accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| -|[java/accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| -|[java/advisorynotifications](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/advisorynotifications/README.md)|com.google.cloud:google-cloud-advisorynotifications-spring-starter| -|[java/aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| -|[java/analyticshub](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/analyticshub/README.md)|com.google.cloud:google-cloud-analyticshub-spring-starter| -|[java/api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/api-gateway/README.md)|com.google.cloud:google-cloud-api-gateway-spring-starter| -|[java/apigee-connect](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| -|[java/apikeys](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/apikeys/README.md)|com.google.cloud:google-cloud-apikeys-spring-starter| -|[java/appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/appengine-admin/README.md)|com.google.cloud:google-cloud-appengine-admin-spring-starter| -|[java/artifact-registry](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/artifact-registry/README.md)|com.google.cloud:google-cloud-artifact-registry-spring-starter| -|[java/asset](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/asset/README.md)|com.google.cloud:google-cloud-asset-spring-starter| -|[java/assured-workloads](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/assured-workloads/README.md)|com.google.cloud:google-cloud-assured-workloads-spring-starter| -|[java/automl](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| -|[java/backupdr](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/backupdr/README.md)|com.google.cloud:google-cloud-backupdr-spring-starter| -|[java/bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| -|[java/bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| -|[java/bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| -|[java/billing](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| -|[java/billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/billingbudgets/README.md)|com.google.cloud:google-cloud-billingbudgets-spring-starter| -|[java/binary-authorization](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/binary-authorization/README.md)|com.google.cloud:google-cloud-binary-authorization-spring-starter| -|[java/channel](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| -|[java/cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| -|[java/cloudcontrolspartner](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/cloudcontrolspartner/README.md)|com.google.cloud:google-cloud-cloudcontrolspartner-spring-starter| -|[java/cloudquotas](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/cloudquotas/README.md)|com.google.cloud:google-cloud-cloudquotas-spring-starter| -|[java/compute](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/compute/README.md)|com.google.cloud:google-cloud-compute-spring-starter| -|[java/contact-center-insights](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/contact-center-insights/README.md)|com.google.cloud:google-cloud-contact-center-insights-spring-starter| -|[java/container](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/container/README.md)|com.google.cloud:google-cloud-container-spring-starter| -|[java/containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/containeranalysis/README.md)|com.google.cloud:google-cloud-containeranalysis-spring-starter| -|[java/data-fusion](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/data-fusion/README.md)|com.google.cloud:google-cloud-data-fusion-spring-starter| -|[java/datacatalog](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| -|[java/datalineage](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/datalineage/README.md)|com.google.cloud:google-cloud-datalineage-spring-starter| -|[java/dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/dataplex/README.md)|com.google.cloud:google-cloud-dataplex-spring-starter| -|[java/dataproc-metastore](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/dataproc-metastore/README.md)|com.google.cloud:google-cloud-dataproc-metastore-spring-starter| -|[java/dataproc](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| -|[java/datastream](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/datastream/README.md)|com.google.cloud:google-cloud-datastream-spring-starter| -|[java/debugger-client](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/debugger-client/README.md)|com.google.cloud:google-cloud-debugger-client-spring-starter| -|[java/deploy](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| -|[java/dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| -|[java/discoveryengine](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/discoveryengine/README.md)|com.google.cloud:google-cloud-discoveryengine-spring-starter| -|[java/distributedcloudedge](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/distributedcloudedge/README.md)|com.google.cloud:google-cloud-distributedcloudedge-spring-starter| -|[java/dlp](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| -|[java/dms](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/dms/README.md)|com.google.cloud:google-cloud-dms-spring-starter| -|[java/document-ai](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/document-ai/README.md)|com.google.cloud:google-cloud-document-ai-spring-starter| -|[java/domains](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| -|[java/edgenetwork](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/edgenetwork/README.md)|com.google.cloud:google-cloud-edgenetwork-spring-starter| -|[java/essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/essential-contacts/README.md)|com.google.cloud:google-cloud-essential-contacts-spring-starter| -|[java/eventarc](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| -|[java/filestore](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| -|[java/functions](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| -|[java/gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/gkehub/README.md)|com.google.cloud:google-cloud-gkehub-spring-starter| -|[java/gsuite-addons](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/gsuite-addons/README.md)|com.google.cloud:google-cloud-gsuite-addons-spring-starter| -|[java/iam-admin](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/iam-admin/README.md)|com.google.cloud:google-iam-admin-spring-starter| -|[java/iam](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| -|[java/iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| -|[java/iap](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/iap/README.md)|com.google.cloud:google-cloud-iap-spring-starter| -|[java/ids](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| -|[java/infra-manager](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/infra-manager/README.md)|com.google.cloud:google-cloud-infra-manager-spring-starter| -|[java/iot](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| -|[java/language](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/language/README.md)|com.google.cloud:google-cloud-language-spring-starter| -|[java/managed-identities](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/managed-identities/README.md)|com.google.cloud:google-cloud-managed-identities-spring-starter| -|[java/memcache](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/memcache/README.md)|com.google.cloud:google-cloud-memcache-spring-starter| -|[java/monitoring-dashboards](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/monitoring-dashboards/README.md)|com.google.cloud:google-cloud-monitoring-dashboard-spring-starter| -|[java/network-management](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| -|[java/network-security](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/network-security/README.md)|com.google.cloud:google-cloud-network-security-spring-starter| -|[java/networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| -|[java/notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| -|[java/optimization](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/optimization/README.md)|com.google.cloud:google-cloud-optimization-spring-starter| -|[java/orchestration-airflow](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/orchestration-airflow/README.md)|com.google.cloud:google-cloud-orchestration-airflow-spring-starter| -|[java/orgpolicy](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/orgpolicy/README.md)|com.google.cloud:google-cloud-orgpolicy-spring-starter| -|[java/os-config](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/os-config/README.md)|com.google.cloud:google-cloud-os-config-spring-starter| -|[java/os-login](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/os-login/README.md)|com.google.cloud:google-cloud-os-login-spring-starter| -|[java/policy-troubleshooter](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/policy-troubleshooter/README.md)|com.google.cloud:google-cloud-policy-troubleshooter-spring-starter| -|[java/profiler](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| -|[java/publicca](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/publicca/README.md)|com.google.cloud:google-cloud-publicca-spring-starter| -|[java/recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| -|[java/recommender](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| -|[java/redis](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/redis/README.md)|com.google.cloud:google-cloud-redis-spring-starter| -|[java/resource-settings](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/resource-settings/README.md)|com.google.cloud:google-cloud-resource-settings-spring-starter| -|[java/retail](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| -|[java/scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| -|[java/securesourcemanager](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/securesourcemanager/README.md)|com.google.cloud:google-cloud-securesourcemanager-spring-starter| -|[java/security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/security-private-ca/README.md)|com.google.cloud:google-cloud-security-private-ca-spring-starter| -|[java/securitycenter](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| -|[java/securitycentermanagement](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/securitycentermanagement/README.md)|com.google.cloud:google-cloud-securitycentermanagement-spring-starter| -|[java/securityposture](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/securityposture/README.md)|com.google.cloud:google-cloud-securityposture-spring-starter| -|[java/service-control](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/service-control/README.md)|com.google.cloud:google-cloud-service-control-spring-starter| -|[java/service-management](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/service-management/README.md)|com.google.cloud:google-cloud-service-management-spring-starter| -|[java/service-usage](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/service-usage/README.md)|com.google.cloud:google-cloud-service-usage-spring-starter| -|[java/servicedirectory](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| -|[java/shell](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| -|[java/speech](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/speech/README.md)|com.google.cloud:google-cloud-speech-spring-starter| -|[java/storage-transfer](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/storage-transfer/README.md)|com.google.cloud:google-cloud-storage-transfer-spring-starter| -|[java/talent](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| -|[java/tasks](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| -|[java/telcoautomation](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/telcoautomation/README.md)|com.google.cloud:google-cloud-telcoautomation-spring-starter| -|[java/texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| -|[java/tpu](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| -|[java/trace](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| -|[java/translate](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/translate/README.md)|com.google.cloud:google-cloud-translate-spring-starter| -|[java/video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| -|[java/video-stitcher](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/video-stitcher/README.md)|com.google.cloud:google-cloud-video-stitcher-spring-starter| -|[java/video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/video-transcoder/README.md)|com.google.cloud:google-cloud-video-transcoder-spring-starter| -|[java/vmmigration](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| -|[java/vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| -|[java/webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| -|[java/websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/websecurityscanner/README.md)|com.google.cloud:google-cloud-websecurityscanner-spring-starter| -|[java/workflow-executions](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/workflow-executions/README.md)|com.google.cloud:google-cloud-workflow-executions-spring-starter| -|[java/workflows](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| -|[java/workstations](https://github.com/googleapis/google-cloud-java/blob/v1.45.0/java/workstations/README.md)|com.google.cloud:google-cloud-workstations-spring-starter| +|[java/accessapproval](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/accessapproval/README.md)|com.google.cloud:google-cloud-accessapproval-spring-starter| +|[java/accesscontextmanager](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/accesscontextmanager/README.md)|com.google.cloud:google-identity-accesscontextmanager-spring-starter| +|[java/advisorynotifications](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/advisorynotifications/README.md)|com.google.cloud:google-cloud-advisorynotifications-spring-starter| +|[java/aiplatform](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/aiplatform/README.md)|com.google.cloud:google-cloud-aiplatform-spring-starter| +|[java/analyticshub](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/analyticshub/README.md)|com.google.cloud:google-cloud-analyticshub-spring-starter| +|[java/api-gateway](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/api-gateway/README.md)|com.google.cloud:google-cloud-api-gateway-spring-starter| +|[java/apigee-connect](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/apigee-connect/README.md)|com.google.cloud:google-cloud-apigee-connect-spring-starter| +|[java/apikeys](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/apikeys/README.md)|com.google.cloud:google-cloud-apikeys-spring-starter| +|[java/appengine-admin](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/appengine-admin/README.md)|com.google.cloud:google-cloud-appengine-admin-spring-starter| +|[java/artifact-registry](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/artifact-registry/README.md)|com.google.cloud:google-cloud-artifact-registry-spring-starter| +|[java/asset](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/asset/README.md)|com.google.cloud:google-cloud-asset-spring-starter| +|[java/assured-workloads](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/assured-workloads/README.md)|com.google.cloud:google-cloud-assured-workloads-spring-starter| +|[java/automl](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/automl/README.md)|com.google.cloud:google-cloud-automl-spring-starter| +|[java/backupdr](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/backupdr/README.md)|com.google.cloud:google-cloud-backupdr-spring-starter| +|[java/bigqueryconnection](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/bigqueryconnection/README.md)|com.google.cloud:google-cloud-bigqueryconnection-spring-starter| +|[java/bigquerydatatransfer](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/bigquerydatatransfer/README.md)|com.google.cloud:google-cloud-bigquerydatatransfer-spring-starter| +|[java/bigqueryreservation](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/bigqueryreservation/README.md)|com.google.cloud:google-cloud-bigqueryreservation-spring-starter| +|[java/billing](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/billing/README.md)|com.google.cloud:google-cloud-billing-spring-starter| +|[java/billingbudgets](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/billingbudgets/README.md)|com.google.cloud:google-cloud-billingbudgets-spring-starter| +|[java/binary-authorization](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/binary-authorization/README.md)|com.google.cloud:google-cloud-binary-authorization-spring-starter| +|[java/channel](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/channel/README.md)|com.google.cloud:google-cloud-channel-spring-starter| +|[java/cloudbuild](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/cloudbuild/README.md)|com.google.cloud:google-cloud-build-spring-starter| +|[java/cloudcontrolspartner](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/cloudcontrolspartner/README.md)|com.google.cloud:google-cloud-cloudcontrolspartner-spring-starter| +|[java/cloudquotas](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/cloudquotas/README.md)|com.google.cloud:google-cloud-cloudquotas-spring-starter| +|[java/compute](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/compute/README.md)|com.google.cloud:google-cloud-compute-spring-starter| +|[java/contact-center-insights](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/contact-center-insights/README.md)|com.google.cloud:google-cloud-contact-center-insights-spring-starter| +|[java/container](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/container/README.md)|com.google.cloud:google-cloud-container-spring-starter| +|[java/containeranalysis](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/containeranalysis/README.md)|com.google.cloud:google-cloud-containeranalysis-spring-starter| +|[java/data-fusion](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/data-fusion/README.md)|com.google.cloud:google-cloud-data-fusion-spring-starter| +|[java/datacatalog](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/datacatalog/README.md)|com.google.cloud:google-cloud-datacatalog-spring-starter| +|[java/datalineage](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/datalineage/README.md)|com.google.cloud:google-cloud-datalineage-spring-starter| +|[java/dataplex](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/dataplex/README.md)|com.google.cloud:google-cloud-dataplex-spring-starter| +|[java/dataproc-metastore](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/dataproc-metastore/README.md)|com.google.cloud:google-cloud-dataproc-metastore-spring-starter| +|[java/dataproc](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/dataproc/README.md)|com.google.cloud:google-cloud-dataproc-spring-starter| +|[java/datastream](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/datastream/README.md)|com.google.cloud:google-cloud-datastream-spring-starter| +|[java/debugger-client](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/debugger-client/README.md)|com.google.cloud:google-cloud-debugger-client-spring-starter| +|[java/deploy](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/deploy/README.md)|com.google.cloud:google-cloud-deploy-spring-starter| +|[java/dialogflow](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/dialogflow/README.md)|com.google.cloud:google-cloud-dialogflow-spring-starter| +|[java/discoveryengine](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/discoveryengine/README.md)|com.google.cloud:google-cloud-discoveryengine-spring-starter| +|[java/distributedcloudedge](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/distributedcloudedge/README.md)|com.google.cloud:google-cloud-distributedcloudedge-spring-starter| +|[java/dlp](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/dlp/README.md)|com.google.cloud:google-cloud-dlp-spring-starter| +|[java/dms](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/dms/README.md)|com.google.cloud:google-cloud-dms-spring-starter| +|[java/document-ai](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/document-ai/README.md)|com.google.cloud:google-cloud-document-ai-spring-starter| +|[java/domains](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/domains/README.md)|com.google.cloud:google-cloud-domains-spring-starter| +|[java/edgenetwork](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/edgenetwork/README.md)|com.google.cloud:google-cloud-edgenetwork-spring-starter| +|[java/essential-contacts](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/essential-contacts/README.md)|com.google.cloud:google-cloud-essential-contacts-spring-starter| +|[java/eventarc](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/eventarc/README.md)|com.google.cloud:google-cloud-eventarc-spring-starter| +|[java/filestore](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/filestore/README.md)|com.google.cloud:google-cloud-filestore-spring-starter| +|[java/functions](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/functions/README.md)|com.google.cloud:google-cloud-functions-spring-starter| +|[java/gkehub](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/gkehub/README.md)|com.google.cloud:google-cloud-gkehub-spring-starter| +|[java/gsuite-addons](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/gsuite-addons/README.md)|com.google.cloud:google-cloud-gsuite-addons-spring-starter| +|[java/iam-admin](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/iam-admin/README.md)|com.google.cloud:google-iam-admin-spring-starter| +|[java/iam](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/iam/README.md)|com.google.cloud:google-iam-policy-spring-starter| +|[java/iamcredentials](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/iamcredentials/README.md)|com.google.cloud:google-cloud-iamcredentials-spring-starter| +|[java/iap](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/iap/README.md)|com.google.cloud:google-cloud-iap-spring-starter| +|[java/ids](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/ids/README.md)|com.google.cloud:google-cloud-ids-spring-starter| +|[java/infra-manager](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/infra-manager/README.md)|com.google.cloud:google-cloud-infra-manager-spring-starter| +|[java/iot](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/iot/README.md)|com.google.cloud:google-cloud-iot-spring-starter| +|[java/language](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/language/README.md)|com.google.cloud:google-cloud-language-spring-starter| +|[java/managed-identities](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/managed-identities/README.md)|com.google.cloud:google-cloud-managed-identities-spring-starter| +|[java/memcache](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/memcache/README.md)|com.google.cloud:google-cloud-memcache-spring-starter| +|[java/monitoring-dashboards](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/monitoring-dashboards/README.md)|com.google.cloud:google-cloud-monitoring-dashboard-spring-starter| +|[java/network-management](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/network-management/README.md)|com.google.cloud:google-cloud-network-management-spring-starter| +|[java/network-security](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/network-security/README.md)|com.google.cloud:google-cloud-network-security-spring-starter| +|[java/networkconnectivity](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/networkconnectivity/README.md)|com.google.cloud:google-cloud-networkconnectivity-spring-starter| +|[java/notebooks](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/notebooks/README.md)|com.google.cloud:google-cloud-notebooks-spring-starter| +|[java/optimization](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/optimization/README.md)|com.google.cloud:google-cloud-optimization-spring-starter| +|[java/orchestration-airflow](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/orchestration-airflow/README.md)|com.google.cloud:google-cloud-orchestration-airflow-spring-starter| +|[java/orgpolicy](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/orgpolicy/README.md)|com.google.cloud:google-cloud-orgpolicy-spring-starter| +|[java/os-config](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/os-config/README.md)|com.google.cloud:google-cloud-os-config-spring-starter| +|[java/os-login](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/os-login/README.md)|com.google.cloud:google-cloud-os-login-spring-starter| +|[java/policy-troubleshooter](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/policy-troubleshooter/README.md)|com.google.cloud:google-cloud-policy-troubleshooter-spring-starter| +|[java/profiler](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/profiler/README.md)|com.google.cloud:google-cloud-profiler-spring-starter| +|[java/publicca](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/publicca/README.md)|com.google.cloud:google-cloud-publicca-spring-starter| +|[java/recaptchaenterprise](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/recaptchaenterprise/README.md)|com.google.cloud:google-cloud-recaptchaenterprise-spring-starter| +|[java/recommender](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/recommender/README.md)|com.google.cloud:google-cloud-recommender-spring-starter| +|[java/redis](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/redis/README.md)|com.google.cloud:google-cloud-redis-spring-starter| +|[java/resource-settings](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/resource-settings/README.md)|com.google.cloud:google-cloud-resource-settings-spring-starter| +|[java/retail](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/retail/README.md)|com.google.cloud:google-cloud-retail-spring-starter| +|[java/scheduler](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/scheduler/README.md)|com.google.cloud:google-cloud-scheduler-spring-starter| +|[java/securesourcemanager](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/securesourcemanager/README.md)|com.google.cloud:google-cloud-securesourcemanager-spring-starter| +|[java/security-private-ca](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/security-private-ca/README.md)|com.google.cloud:google-cloud-security-private-ca-spring-starter| +|[java/securitycenter](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/securitycenter/README.md)|com.google.cloud:google-cloud-securitycenter-spring-starter| +|[java/securitycentermanagement](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/securitycentermanagement/README.md)|com.google.cloud:google-cloud-securitycentermanagement-spring-starter| +|[java/securityposture](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/securityposture/README.md)|com.google.cloud:google-cloud-securityposture-spring-starter| +|[java/service-control](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/service-control/README.md)|com.google.cloud:google-cloud-service-control-spring-starter| +|[java/service-management](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/service-management/README.md)|com.google.cloud:google-cloud-service-management-spring-starter| +|[java/service-usage](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/service-usage/README.md)|com.google.cloud:google-cloud-service-usage-spring-starter| +|[java/servicedirectory](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/servicedirectory/README.md)|com.google.cloud:google-cloud-servicedirectory-spring-starter| +|[java/shell](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/shell/README.md)|com.google.cloud:google-cloud-shell-spring-starter| +|[java/speech](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/speech/README.md)|com.google.cloud:google-cloud-speech-spring-starter| +|[java/storage-transfer](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/storage-transfer/README.md)|com.google.cloud:google-cloud-storage-transfer-spring-starter| +|[java/talent](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/talent/README.md)|com.google.cloud:google-cloud-talent-spring-starter| +|[java/tasks](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/tasks/README.md)|com.google.cloud:google-cloud-tasks-spring-starter| +|[java/telcoautomation](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/telcoautomation/README.md)|com.google.cloud:google-cloud-telcoautomation-spring-starter| +|[java/texttospeech](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/texttospeech/README.md)|com.google.cloud:google-cloud-texttospeech-spring-starter| +|[java/tpu](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/tpu/README.md)|com.google.cloud:google-cloud-tpu-spring-starter| +|[java/trace](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/trace/README.md)|com.google.cloud:google-cloud-trace-spring-starter| +|[java/translate](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/translate/README.md)|com.google.cloud:google-cloud-translate-spring-starter| +|[java/video-intelligence](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/video-intelligence/README.md)|com.google.cloud:google-cloud-video-intelligence-spring-starter| +|[java/video-stitcher](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/video-stitcher/README.md)|com.google.cloud:google-cloud-video-stitcher-spring-starter| +|[java/video-transcoder](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/video-transcoder/README.md)|com.google.cloud:google-cloud-video-transcoder-spring-starter| +|[java/vmmigration](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/vmmigration/README.md)|com.google.cloud:google-cloud-vmmigration-spring-starter| +|[java/vpcaccess](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/vpcaccess/README.md)|com.google.cloud:google-cloud-vpcaccess-spring-starter| +|[java/webrisk](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/webrisk/README.md)|com.google.cloud:google-cloud-webrisk-spring-starter| +|[java/websecurityscanner](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/websecurityscanner/README.md)|com.google.cloud:google-cloud-websecurityscanner-spring-starter| +|[java/workflow-executions](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/workflow-executions/README.md)|com.google.cloud:google-cloud-workflow-executions-spring-starter| +|[java/workflows](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/workflows/README.md)|com.google.cloud:google-cloud-workflows-spring-starter| +|[java/workstations](https://github.com/googleapis/google-cloud-java/blob/v1.46.0/java/workstations/README.md)|com.google.cloud:google-cloud-workstations-spring-starter| diff --git a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java index 09c429127d..a3849a61aa 100644 --- a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringAutoConfiguration.java @@ -192,13 +192,6 @@ public BackupDRSettings backupDRSettings( clientSettingsBuilder.getBackupVaultSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getBackupVaultSettings().setRetrySettings(getBackupVaultRetrySettings); - RetrySettings testIamPermissionsRetrySettings = - RetryUtil.updateRetrySettings( - clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); - clientSettingsBuilder - .testIamPermissionsSettings() - .setRetrySettings(testIamPermissionsRetrySettings); - RetrySettings listDataSourcesRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listDataSourcesSettings().getRetrySettings(), serviceRetry); @@ -211,18 +204,6 @@ public BackupDRSettings backupDRSettings( clientSettingsBuilder.getDataSourceSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getDataSourceSettings().setRetrySettings(getDataSourceRetrySettings); - RetrySettings initiateBackupRetrySettings = - RetryUtil.updateRetrySettings( - clientSettingsBuilder.initiateBackupSettings().getRetrySettings(), serviceRetry); - clientSettingsBuilder.initiateBackupSettings().setRetrySettings(initiateBackupRetrySettings); - - RetrySettings fetchAccessTokenRetrySettings = - RetryUtil.updateRetrySettings( - clientSettingsBuilder.fetchAccessTokenSettings().getRetrySettings(), serviceRetry); - clientSettingsBuilder - .fetchAccessTokenSettings() - .setRetrySettings(fetchAccessTokenRetrySettings); - RetrySettings listBackupsRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.listBackupsSettings().getRetrySettings(), serviceRetry); @@ -281,6 +262,13 @@ public BackupDRSettings backupDRSettings( clientSettingsBuilder.getIamPolicySettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.getIamPolicySettings().setRetrySettings(getIamPolicyRetrySettings); + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { LOGGER.trace("Configured service-level retry settings from properties."); } @@ -352,20 +340,6 @@ public BackupDRSettings backupDRSettings( LOGGER.trace("Configured method-level retry settings for getBackupVault from properties."); } } - Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); - if (testIamPermissionsRetry != null) { - RetrySettings testIamPermissionsRetrySettings = - RetryUtil.updateRetrySettings( - clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), - testIamPermissionsRetry); - clientSettingsBuilder - .testIamPermissionsSettings() - .setRetrySettings(testIamPermissionsRetrySettings); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace( - "Configured method-level retry settings for testIamPermissions from properties."); - } - } Retry listDataSourcesRetry = clientProperties.getListDataSourcesRetry(); if (listDataSourcesRetry != null) { RetrySettings listDataSourcesRetrySettings = @@ -389,31 +363,6 @@ public BackupDRSettings backupDRSettings( LOGGER.trace("Configured method-level retry settings for getDataSource from properties."); } } - Retry initiateBackupRetry = clientProperties.getInitiateBackupRetry(); - if (initiateBackupRetry != null) { - RetrySettings initiateBackupRetrySettings = - RetryUtil.updateRetrySettings( - clientSettingsBuilder.initiateBackupSettings().getRetrySettings(), - initiateBackupRetry); - clientSettingsBuilder.initiateBackupSettings().setRetrySettings(initiateBackupRetrySettings); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Configured method-level retry settings for initiateBackup from properties."); - } - } - Retry fetchAccessTokenRetry = clientProperties.getFetchAccessTokenRetry(); - if (fetchAccessTokenRetry != null) { - RetrySettings fetchAccessTokenRetrySettings = - RetryUtil.updateRetrySettings( - clientSettingsBuilder.fetchAccessTokenSettings().getRetrySettings(), - fetchAccessTokenRetry); - clientSettingsBuilder - .fetchAccessTokenSettings() - .setRetrySettings(fetchAccessTokenRetrySettings); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace( - "Configured method-level retry settings for fetchAccessToken from properties."); - } - } Retry listBackupsRetry = clientProperties.getListBackupsRetry(); if (listBackupsRetry != null) { RetrySettings listBackupsRetrySettings = @@ -525,6 +474,20 @@ public BackupDRSettings backupDRSettings( LOGGER.trace("Configured method-level retry settings for getIamPolicy from properties."); } } + Retry testIamPermissionsRetry = clientProperties.getTestIamPermissionsRetry(); + if (testIamPermissionsRetry != null) { + RetrySettings testIamPermissionsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.testIamPermissionsSettings().getRetrySettings(), + testIamPermissionsRetry); + clientSettingsBuilder + .testIamPermissionsSettings() + .setRetrySettings(testIamPermissionsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for testIamPermissions from properties."); + } + } return clientSettingsBuilder.build(); } diff --git a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java index dc98844b9a..002fd3cecc 100644 --- a/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java +++ b/spring-cloud-previews/google-cloud-backupdr-spring-starter/src/main/java/com/google/cloud/backupdr/v1/spring/BackupDRSpringProperties.java @@ -67,11 +67,6 @@ public class BackupDRSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getBackupVaultRetry; - /** - * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes - * precedence over service-level retry configurations for that RPC method. - */ - @NestedConfigurationProperty private Retry testIamPermissionsRetry; /** * Allow override of retry settings at method-level for listDataSources. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -82,16 +77,6 @@ public class BackupDRSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getDataSourceRetry; - /** - * Allow override of retry settings at method-level for initiateBackup. If defined, this takes - * precedence over service-level retry configurations for that RPC method. - */ - @NestedConfigurationProperty private Retry initiateBackupRetry; - /** - * Allow override of retry settings at method-level for fetchAccessToken. If defined, this takes - * precedence over service-level retry configurations for that RPC method. - */ - @NestedConfigurationProperty private Retry fetchAccessTokenRetry; /** * Allow override of retry settings at method-level for listBackups. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -142,6 +127,11 @@ public class BackupDRSpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry getIamPolicyRetry; + /** + * Allow override of retry settings at method-level for testIamPermissions. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry testIamPermissionsRetry; @Override public Credentials getCredentials() { @@ -220,14 +210,6 @@ public void setGetBackupVaultRetry(Retry getBackupVaultRetry) { this.getBackupVaultRetry = getBackupVaultRetry; } - public Retry getTestIamPermissionsRetry() { - return this.testIamPermissionsRetry; - } - - public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { - this.testIamPermissionsRetry = testIamPermissionsRetry; - } - public Retry getListDataSourcesRetry() { return this.listDataSourcesRetry; } @@ -244,22 +226,6 @@ public void setGetDataSourceRetry(Retry getDataSourceRetry) { this.getDataSourceRetry = getDataSourceRetry; } - public Retry getInitiateBackupRetry() { - return this.initiateBackupRetry; - } - - public void setInitiateBackupRetry(Retry initiateBackupRetry) { - this.initiateBackupRetry = initiateBackupRetry; - } - - public Retry getFetchAccessTokenRetry() { - return this.fetchAccessTokenRetry; - } - - public void setFetchAccessTokenRetry(Retry fetchAccessTokenRetry) { - this.fetchAccessTokenRetry = fetchAccessTokenRetry; - } - public Retry getListBackupsRetry() { return this.listBackupsRetry; } @@ -339,4 +305,12 @@ public Retry getGetIamPolicyRetry() { public void setGetIamPolicyRetry(Retry getIamPolicyRetry) { this.getIamPolicyRetry = getIamPolicyRetry; } + + public Retry getTestIamPermissionsRetry() { + return this.testIamPermissionsRetry; + } + + public void setTestIamPermissionsRetry(Retry testIamPermissionsRetry) { + this.testIamPermissionsRetry = testIamPermissionsRetry; + } } diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java index ac89975e25..20db2befbf 100644 --- a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringAutoConfiguration.java @@ -309,6 +309,13 @@ public ContactCenterInsightsSettings contactCenterInsightsSettings( clientSettingsBuilder.updateSettingsSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.updateSettingsSettings().setRetrySettings(updateSettingsRetrySettings); + RetrySettings getEncryptionSpecRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEncryptionSpecSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getEncryptionSpecSettings() + .setRetrySettings(getEncryptionSpecRetrySettings); + RetrySettings createViewRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.createViewSettings().getRetrySettings(), serviceRetry); @@ -631,6 +638,20 @@ public ContactCenterInsightsSettings contactCenterInsightsSettings( LOGGER.trace("Configured method-level retry settings for updateSettings from properties."); } } + Retry getEncryptionSpecRetry = clientProperties.getGetEncryptionSpecRetry(); + if (getEncryptionSpecRetry != null) { + RetrySettings getEncryptionSpecRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getEncryptionSpecSettings().getRetrySettings(), + getEncryptionSpecRetry); + clientSettingsBuilder + .getEncryptionSpecSettings() + .setRetrySettings(getEncryptionSpecRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getEncryptionSpec from properties."); + } + } Retry createViewRetry = clientProperties.getCreateViewRetry(); if (createViewRetry != null) { RetrySettings createViewRetrySettings = diff --git a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java index ffd6b1ba2a..1dc77babf8 100644 --- a/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java +++ b/spring-cloud-previews/google-cloud-contact-center-insights-spring-starter/src/main/java/com/google/cloud/contactcenterinsights/v1/spring/ContactCenterInsightsSpringProperties.java @@ -162,6 +162,11 @@ public class ContactCenterInsightsSpringProperties implements CredentialsSupplie * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry updateSettingsRetry; + /** + * Allow override of retry settings at method-level for getEncryptionSpec. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getEncryptionSpecRetry; /** * Allow override of retry settings at method-level for createView. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -417,6 +422,14 @@ public void setUpdateSettingsRetry(Retry updateSettingsRetry) { this.updateSettingsRetry = updateSettingsRetry; } + public Retry getGetEncryptionSpecRetry() { + return this.getEncryptionSpecRetry; + } + + public void setGetEncryptionSpecRetry(Retry getEncryptionSpecRetry) { + this.getEncryptionSpecRetry = getEncryptionSpecRetry; + } + public Retry getCreateViewRetry() { return this.createViewRetry; } diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java index 55da3d9bb0..4444bf91d8 100644 --- a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java +++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringAutoConfiguration.java @@ -219,6 +219,20 @@ public CloudDeploySettings cloudDeploySettings( clientSettingsBuilder.abandonReleaseSettings().getRetrySettings(), serviceRetry); clientSettingsBuilder.abandonReleaseSettings().setRetrySettings(abandonReleaseRetrySettings); + RetrySettings listDeployPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeployPoliciesSettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .listDeployPoliciesSettings() + .setRetrySettings(listDeployPoliciesRetrySettings); + + RetrySettings getDeployPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeployPolicySettings().getRetrySettings(), serviceRetry); + clientSettingsBuilder + .getDeployPolicySettings() + .setRetrySettings(getDeployPolicyRetrySettings); + RetrySettings approveRolloutRetrySettings = RetryUtil.updateRetrySettings( clientSettingsBuilder.approveRolloutSettings().getRetrySettings(), serviceRetry); @@ -458,6 +472,33 @@ public CloudDeploySettings cloudDeploySettings( LOGGER.trace("Configured method-level retry settings for abandonRelease from properties."); } } + Retry listDeployPoliciesRetry = clientProperties.getListDeployPoliciesRetry(); + if (listDeployPoliciesRetry != null) { + RetrySettings listDeployPoliciesRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listDeployPoliciesSettings().getRetrySettings(), + listDeployPoliciesRetry); + clientSettingsBuilder + .listDeployPoliciesSettings() + .setRetrySettings(listDeployPoliciesRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listDeployPolicies from properties."); + } + } + Retry getDeployPolicyRetry = clientProperties.getGetDeployPolicyRetry(); + if (getDeployPolicyRetry != null) { + RetrySettings getDeployPolicyRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.getDeployPolicySettings().getRetrySettings(), + getDeployPolicyRetry); + clientSettingsBuilder + .getDeployPolicySettings() + .setRetrySettings(getDeployPolicyRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured method-level retry settings for getDeployPolicy from properties."); + } + } Retry approveRolloutRetry = clientProperties.getApproveRolloutRetry(); if (approveRolloutRetry != null) { RetrySettings approveRolloutRetrySettings = diff --git a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java index 3de7291033..74e65939b8 100644 --- a/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java +++ b/spring-cloud-previews/google-cloud-deploy-spring-starter/src/main/java/com/google/cloud/deploy/v1/spring/CloudDeploySpringProperties.java @@ -92,6 +92,16 @@ public class CloudDeploySpringProperties implements CredentialsSupplier { * precedence over service-level retry configurations for that RPC method. */ @NestedConfigurationProperty private Retry abandonReleaseRetry; + /** + * Allow override of retry settings at method-level for listDeployPolicies. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listDeployPoliciesRetry; + /** + * Allow override of retry settings at method-level for getDeployPolicy. If defined, this takes + * precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getDeployPolicyRetry; /** * Allow override of retry settings at method-level for approveRollout. If defined, this takes * precedence over service-level retry configurations for that RPC method. @@ -315,6 +325,22 @@ public void setAbandonReleaseRetry(Retry abandonReleaseRetry) { this.abandonReleaseRetry = abandonReleaseRetry; } + public Retry getListDeployPoliciesRetry() { + return this.listDeployPoliciesRetry; + } + + public void setListDeployPoliciesRetry(Retry listDeployPoliciesRetry) { + this.listDeployPoliciesRetry = listDeployPoliciesRetry; + } + + public Retry getGetDeployPolicyRetry() { + return this.getDeployPolicyRetry; + } + + public void setGetDeployPolicyRetry(Retry getDeployPolicyRetry) { + this.getDeployPolicyRetry = getDeployPolicyRetry; + } + public Retry getApproveRolloutRetry() { return this.approveRolloutRetry; } diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringAutoConfiguration.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringAutoConfiguration.java new file mode 100644 index 0000000000..9dfbdd0b90 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringAutoConfiguration.java @@ -0,0 +1,319 @@ +/* + * 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 + * + * https://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.retail.v2.spring; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.ExecutorProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.HeaderProvider; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.retail.v2.GenerativeQuestionServiceClient; +import com.google.cloud.retail.v2.GenerativeQuestionServiceSettings; +import com.google.cloud.spring.autoconfigure.core.GcpContextAutoConfiguration; +import com.google.cloud.spring.core.DefaultCredentialsProvider; +import com.google.cloud.spring.core.Retry; +import com.google.cloud.spring.core.util.RetryUtil; +import java.io.IOException; +import java.util.Collections; +import javax.annotation.Generated; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Auto-configuration for {@link GenerativeQuestionServiceClient}. + * + *

Provides auto-configuration for Spring Boot + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default transport provider is used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@AutoConfiguration +@AutoConfigureAfter(GcpContextAutoConfiguration.class) +@ConditionalOnClass(GenerativeQuestionServiceClient.class) +@ConditionalOnProperty( + value = "com.google.cloud.retail.v2.generative-question-service.enabled", + matchIfMissing = true) +@EnableConfigurationProperties(GenerativeQuestionServiceSpringProperties.class) +public class GenerativeQuestionServiceSpringAutoConfiguration { + private final GenerativeQuestionServiceSpringProperties clientProperties; + private final CredentialsProvider credentialsProvider; + private static final Log LOGGER = + LogFactory.getLog(GenerativeQuestionServiceSpringAutoConfiguration.class); + + protected GenerativeQuestionServiceSpringAutoConfiguration( + GenerativeQuestionServiceSpringProperties clientProperties, + CredentialsProvider credentialsProvider) + throws IOException { + this.clientProperties = clientProperties; + if (this.clientProperties.getCredentials().hasKey()) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using credentials from GenerativeQuestionService-specific configuration"); + } + this.credentialsProvider = + ((CredentialsProvider) new DefaultCredentialsProvider(this.clientProperties)); + } else { + this.credentialsProvider = credentialsProvider; + } + } + + /** + * Provides a default transport channel provider bean, corresponding to the client library's + * default transport channel provider. If the library supports both GRPC and REST transport, and + * the useRest property is configured, the HTTP/JSON transport provider will be used instead of + * GRPC. + * + * @return a default transport channel provider. + */ + @Bean + @ConditionalOnMissingBean(name = "defaultGenerativeQuestionServiceTransportChannelProvider") + public TransportChannelProvider defaultGenerativeQuestionServiceTransportChannelProvider() { + if (this.clientProperties.getUseRest()) { + return GenerativeQuestionServiceSettings.defaultHttpJsonTransportProviderBuilder().build(); + } + return GenerativeQuestionServiceSettings.defaultTransportChannelProvider(); + } + + /** + * Provides a GenerativeQuestionServiceSettings bean configured to use a + * DefaultCredentialsProvider and the client library's default transport channel provider + * (defaultGenerativeQuestionServiceTransportChannelProvider()). It also configures the quota + * project ID and executor thread count, if provided through properties. + * + *

Retry settings are also configured from service-level and method-level properties specified + * in GenerativeQuestionServiceSpringProperties. Method-level properties will take precedence over + * service-level properties if available, and client library defaults will be used if neither are + * specified. + * + * @param defaultTransportChannelProvider TransportChannelProvider to use in the settings. + * @return a {@link GenerativeQuestionServiceSettings} bean configured with {@link + * TransportChannelProvider} bean. + */ + @Bean + @ConditionalOnMissingBean + public GenerativeQuestionServiceSettings generativeQuestionServiceSettings( + @Qualifier("defaultGenerativeQuestionServiceTransportChannelProvider") + TransportChannelProvider defaultTransportChannelProvider) + throws IOException { + GenerativeQuestionServiceSettings.Builder clientSettingsBuilder; + if (this.clientProperties.getUseRest()) { + clientSettingsBuilder = GenerativeQuestionServiceSettings.newHttpJsonBuilder(); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Using REST (HTTP/JSON) transport."); + } + } else { + clientSettingsBuilder = GenerativeQuestionServiceSettings.newBuilder(); + } + clientSettingsBuilder + .setCredentialsProvider(this.credentialsProvider) + .setTransportChannelProvider(defaultTransportChannelProvider) + .setEndpoint(GenerativeQuestionServiceSettings.getDefaultEndpoint()) + .setHeaderProvider(this.userAgentHeaderProvider()); + if (this.clientProperties.getQuotaProjectId() != null) { + clientSettingsBuilder.setQuotaProjectId(this.clientProperties.getQuotaProjectId()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Quota project id set to " + + this.clientProperties.getQuotaProjectId() + + ", this overrides project id from credentials."); + } + } + if (this.clientProperties.getExecutorThreadCount() != null) { + ExecutorProvider executorProvider = + GenerativeQuestionServiceSettings.defaultExecutorProviderBuilder() + .setExecutorThreadCount(this.clientProperties.getExecutorThreadCount()) + .build(); + clientSettingsBuilder.setBackgroundExecutorProvider(executorProvider); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Background executor thread count is " + + this.clientProperties.getExecutorThreadCount()); + } + } + Retry serviceRetry = clientProperties.getRetry(); + if (serviceRetry != null) { + RetrySettings updateGenerativeQuestionsFeatureConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .updateGenerativeQuestionsFeatureConfigSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateGenerativeQuestionsFeatureConfigSettings() + .setRetrySettings(updateGenerativeQuestionsFeatureConfigRetrySettings); + + RetrySettings getGenerativeQuestionsFeatureConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getGenerativeQuestionsFeatureConfigSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .getGenerativeQuestionsFeatureConfigSettings() + .setRetrySettings(getGenerativeQuestionsFeatureConfigRetrySettings); + + RetrySettings listGenerativeQuestionConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGenerativeQuestionConfigsSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .listGenerativeQuestionConfigsSettings() + .setRetrySettings(listGenerativeQuestionConfigsRetrySettings); + + RetrySettings updateGenerativeQuestionConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateGenerativeQuestionConfigSettings().getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .updateGenerativeQuestionConfigSettings() + .setRetrySettings(updateGenerativeQuestionConfigRetrySettings); + + RetrySettings batchUpdateGenerativeQuestionConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .batchUpdateGenerativeQuestionConfigsSettings() + .getRetrySettings(), + serviceRetry); + clientSettingsBuilder + .batchUpdateGenerativeQuestionConfigsSettings() + .setRetrySettings(batchUpdateGenerativeQuestionConfigsRetrySettings); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Configured service-level retry settings from properties."); + } + } + Retry updateGenerativeQuestionsFeatureConfigRetry = + clientProperties.getUpdateGenerativeQuestionsFeatureConfigRetry(); + if (updateGenerativeQuestionsFeatureConfigRetry != null) { + RetrySettings updateGenerativeQuestionsFeatureConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .updateGenerativeQuestionsFeatureConfigSettings() + .getRetrySettings(), + updateGenerativeQuestionsFeatureConfigRetry); + clientSettingsBuilder + .updateGenerativeQuestionsFeatureConfigSettings() + .setRetrySettings(updateGenerativeQuestionsFeatureConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateGenerativeQuestionsFeatureConfig from properties."); + } + } + Retry getGenerativeQuestionsFeatureConfigRetry = + clientProperties.getGetGenerativeQuestionsFeatureConfigRetry(); + if (getGenerativeQuestionsFeatureConfigRetry != null) { + RetrySettings getGenerativeQuestionsFeatureConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .getGenerativeQuestionsFeatureConfigSettings() + .getRetrySettings(), + getGenerativeQuestionsFeatureConfigRetry); + clientSettingsBuilder + .getGenerativeQuestionsFeatureConfigSettings() + .setRetrySettings(getGenerativeQuestionsFeatureConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for getGenerativeQuestionsFeatureConfig from properties."); + } + } + Retry listGenerativeQuestionConfigsRetry = + clientProperties.getListGenerativeQuestionConfigsRetry(); + if (listGenerativeQuestionConfigsRetry != null) { + RetrySettings listGenerativeQuestionConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.listGenerativeQuestionConfigsSettings().getRetrySettings(), + listGenerativeQuestionConfigsRetry); + clientSettingsBuilder + .listGenerativeQuestionConfigsSettings() + .setRetrySettings(listGenerativeQuestionConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for listGenerativeQuestionConfigs from properties."); + } + } + Retry updateGenerativeQuestionConfigRetry = + clientProperties.getUpdateGenerativeQuestionConfigRetry(); + if (updateGenerativeQuestionConfigRetry != null) { + RetrySettings updateGenerativeQuestionConfigRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder.updateGenerativeQuestionConfigSettings().getRetrySettings(), + updateGenerativeQuestionConfigRetry); + clientSettingsBuilder + .updateGenerativeQuestionConfigSettings() + .setRetrySettings(updateGenerativeQuestionConfigRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for updateGenerativeQuestionConfig from properties."); + } + } + Retry batchUpdateGenerativeQuestionConfigsRetry = + clientProperties.getBatchUpdateGenerativeQuestionConfigsRetry(); + if (batchUpdateGenerativeQuestionConfigsRetry != null) { + RetrySettings batchUpdateGenerativeQuestionConfigsRetrySettings = + RetryUtil.updateRetrySettings( + clientSettingsBuilder + .batchUpdateGenerativeQuestionConfigsSettings() + .getRetrySettings(), + batchUpdateGenerativeQuestionConfigsRetry); + clientSettingsBuilder + .batchUpdateGenerativeQuestionConfigsSettings() + .setRetrySettings(batchUpdateGenerativeQuestionConfigsRetrySettings); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Configured method-level retry settings for batchUpdateGenerativeQuestionConfigs from properties."); + } + } + return clientSettingsBuilder.build(); + } + + /** + * Provides a GenerativeQuestionServiceClient bean configured with + * GenerativeQuestionServiceSettings. + * + * @param generativeQuestionServiceSettings settings to configure an instance of client bean. + * @return a {@link GenerativeQuestionServiceClient} bean configured with {@link + * GenerativeQuestionServiceSettings} + */ + @Bean + @ConditionalOnMissingBean + public GenerativeQuestionServiceClient generativeQuestionServiceClient( + GenerativeQuestionServiceSettings generativeQuestionServiceSettings) throws IOException { + return GenerativeQuestionServiceClient.create(generativeQuestionServiceSettings); + } + + private HeaderProvider userAgentHeaderProvider() { + String springLibrary = "spring-autogen-generative-question-service"; + String version = this.getClass().getPackage().getImplementationVersion(); + return () -> Collections.singletonMap("user-agent", springLibrary + "/" + version); + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringProperties.java b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringProperties.java new file mode 100644 index 0000000000..9b15700192 --- /dev/null +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/java/com/google/cloud/retail/v2/spring/GenerativeQuestionServiceSpringProperties.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * https://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.retail.v2.spring; + +import com.google.api.core.BetaApi; +import com.google.cloud.spring.core.Credentials; +import com.google.cloud.spring.core.CredentialsSupplier; +import com.google.cloud.spring.core.Retry; +import javax.annotation.Generated; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** Provides default property values for GenerativeQuestionService client bean */ +@Generated("by google-cloud-spring-generator") +@BetaApi("Autogenerated Spring autoconfiguration is not yet stable") +@ConfigurationProperties("com.google.cloud.retail.v2.generative-question-service") +public class GenerativeQuestionServiceSpringProperties implements CredentialsSupplier { + /** OAuth2 credentials to authenticate and authorize calls to Google Cloud Client Libraries. */ + @NestedConfigurationProperty + private final Credentials credentials = + new Credentials("https://www.googleapis.com/auth/cloud-platform"); + /** Quota project to use for billing. */ + private String quotaProjectId; + /** Number of threads used for executors. */ + private Integer executorThreadCount; + /** Allow override of default transport channel provider to use REST instead of gRPC. */ + private boolean useRest = false; + /** Allow override of retry settings at service level, applying to all of its RPC methods. */ + @NestedConfigurationProperty private Retry retry; + /** + * Allow override of retry settings at method-level for updateGenerativeQuestionsFeatureConfig. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateGenerativeQuestionsFeatureConfigRetry; + /** + * Allow override of retry settings at method-level for getGenerativeQuestionsFeatureConfig. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry getGenerativeQuestionsFeatureConfigRetry; + /** + * Allow override of retry settings at method-level for listGenerativeQuestionConfigs. If defined, + * this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry listGenerativeQuestionConfigsRetry; + /** + * Allow override of retry settings at method-level for updateGenerativeQuestionConfig. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry updateGenerativeQuestionConfigRetry; + /** + * Allow override of retry settings at method-level for batchUpdateGenerativeQuestionConfigs. If + * defined, this takes precedence over service-level retry configurations for that RPC method. + */ + @NestedConfigurationProperty private Retry batchUpdateGenerativeQuestionConfigsRetry; + + @Override + public Credentials getCredentials() { + return this.credentials; + } + + public String getQuotaProjectId() { + return this.quotaProjectId; + } + + public void setQuotaProjectId(String quotaProjectId) { + this.quotaProjectId = quotaProjectId; + } + + public boolean getUseRest() { + return this.useRest; + } + + public void setUseRest(boolean useRest) { + this.useRest = useRest; + } + + public Integer getExecutorThreadCount() { + return this.executorThreadCount; + } + + public void setExecutorThreadCount(Integer executorThreadCount) { + this.executorThreadCount = executorThreadCount; + } + + public Retry getRetry() { + return this.retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Retry getUpdateGenerativeQuestionsFeatureConfigRetry() { + return this.updateGenerativeQuestionsFeatureConfigRetry; + } + + public void setUpdateGenerativeQuestionsFeatureConfigRetry( + Retry updateGenerativeQuestionsFeatureConfigRetry) { + this.updateGenerativeQuestionsFeatureConfigRetry = updateGenerativeQuestionsFeatureConfigRetry; + } + + public Retry getGetGenerativeQuestionsFeatureConfigRetry() { + return this.getGenerativeQuestionsFeatureConfigRetry; + } + + public void setGetGenerativeQuestionsFeatureConfigRetry( + Retry getGenerativeQuestionsFeatureConfigRetry) { + this.getGenerativeQuestionsFeatureConfigRetry = getGenerativeQuestionsFeatureConfigRetry; + } + + public Retry getListGenerativeQuestionConfigsRetry() { + return this.listGenerativeQuestionConfigsRetry; + } + + public void setListGenerativeQuestionConfigsRetry(Retry listGenerativeQuestionConfigsRetry) { + this.listGenerativeQuestionConfigsRetry = listGenerativeQuestionConfigsRetry; + } + + public Retry getUpdateGenerativeQuestionConfigRetry() { + return this.updateGenerativeQuestionConfigRetry; + } + + public void setUpdateGenerativeQuestionConfigRetry(Retry updateGenerativeQuestionConfigRetry) { + this.updateGenerativeQuestionConfigRetry = updateGenerativeQuestionConfigRetry; + } + + public Retry getBatchUpdateGenerativeQuestionConfigsRetry() { + return this.batchUpdateGenerativeQuestionConfigsRetry; + } + + public void setBatchUpdateGenerativeQuestionConfigsRetry( + Retry batchUpdateGenerativeQuestionConfigsRetry) { + this.batchUpdateGenerativeQuestionConfigsRetry = batchUpdateGenerativeQuestionConfigsRetry; + } +} diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 018658241b..62b655a655 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -24,6 +24,12 @@ "description": "Auto-configure Google Cloud retail/ControlService components.", "defaultValue": true }, + { + "name": "com.google.cloud.retail.v2.generative-question-service.enabled", + "type": "java.lang.Boolean", + "description": "Auto-configure Google Cloud retail/GenerativeQuestionService components.", + "defaultValue": true + }, { "name": "com.google.cloud.retail.v2.model-service.enabled", "type": "java.lang.Boolean", diff --git a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 83618c4525..af2b0ea52f 100644 --- a/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-cloud-previews/google-cloud-retail-spring-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -2,6 +2,7 @@ com.google.cloud.retail.v2.spring.AnalyticsServiceSpringAutoConfiguration com.google.cloud.retail.v2.spring.CatalogServiceSpringAutoConfiguration com.google.cloud.retail.v2.spring.CompletionServiceSpringAutoConfiguration com.google.cloud.retail.v2.spring.ControlServiceSpringAutoConfiguration +com.google.cloud.retail.v2.spring.GenerativeQuestionServiceSpringAutoConfiguration com.google.cloud.retail.v2.spring.ModelServiceSpringAutoConfiguration com.google.cloud.retail.v2.spring.PredictionServiceSpringAutoConfiguration com.google.cloud.retail.v2.spring.ProductServiceSpringAutoConfiguration From f68aafbe85a78d03b0106faa6b8c33c580442787 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Mon, 21 Oct 2024 12:01:28 -0400 Subject: [PATCH 6/8] Empty commit to trigger build From e7d429eb3e2947c8eb26d83e81dab0a4ec9eb49b Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Mon, 21 Oct 2024 15:45:05 -0400 Subject: [PATCH 7/8] review feedback: avoid dup in pubsub tests, abstract to util method. --- .../PubSubMessageChannelBinderTests.java | 5 +-- .../stream/binder/pubsub/TestUtils.java | 39 +++++++++++++++++++ .../PubSubBinderConfigurationTests.java | 6 +-- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java diff --git a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java index 654c57987c..f0f8a882d4 100644 --- a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java +++ b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/PubSubMessageChannelBinderTests.java @@ -395,10 +395,7 @@ public GcpProjectIdProvider projectIdProvider() { @Bean public CredentialsProvider googleCredentials() { - Credentials mockCredential = mock(Credentials.class); - when(mockCredential.getMetricsCredentialType()) - .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); - return () -> mockCredential; + return () -> TestUtils.MOCK_CREDENTIALS; } } } diff --git a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java new file mode 100644 index 0000000000..f0367f1f6b --- /dev/null +++ b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java @@ -0,0 +1,39 @@ +/* + * 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 + * + * https://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.spring.stream.binder.pubsub; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import com.google.auth.CredentialTypeForMetrics; +import com.google.auth.Credentials; + +public class TestUtils { + public static final Credentials MOCK_CREDENTIALS = createMockCredentials(); + + private static Credentials createMockCredentials() { + Credentials mockCredential = mock(Credentials.class); + when(mockCredential.getMetricsCredentialType()) + .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); + return mockCredential; + } + + public static Credentials getMockCredentials() { + return MOCK_CREDENTIALS; + } +} + diff --git a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java index 35d1f7dd6d..9729a14ff8 100644 --- a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java +++ b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/config/PubSubBinderConfigurationTests.java @@ -30,6 +30,7 @@ import com.google.cloud.spring.pubsub.core.PubSubTemplate; import com.google.cloud.spring.pubsub.core.health.HealthTrackerRegistry; import com.google.cloud.spring.stream.binder.pubsub.PubSubMessageChannelBinder; +import com.google.cloud.spring.stream.binder.pubsub.TestUtils; import com.google.cloud.spring.stream.binder.pubsub.provisioning.PubSubChannelProvisioner; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -167,10 +168,7 @@ void test_healthRegistryEnabled() { private static class TestConfiguration { @Bean public CredentialsProvider googleCredentials() { - Credentials mockCredential = mock(Credentials.class); - when(mockCredential.getMetricsCredentialType()) - .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); - return () -> mockCredential; + return () -> TestUtils.MOCK_CREDENTIALS; } @Bean From 61bd2cf77bc12488cbf853ad6af969cf6af415b7 Mon Sep 17 00:00:00 2001 From: Min Zhu Date: Wed, 23 Oct 2024 10:11:33 -0400 Subject: [PATCH 8/8] chore: rm unused method in utils classes. --- .../java/com/google/cloud/spring/autoconfigure/TestUtils.java | 4 ---- .../google/cloud/spring/stream/binder/pubsub/TestUtils.java | 4 ---- 2 files changed, 8 deletions(-) diff --git a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java index 4084c973bb..d9ee4d437a 100644 --- a/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java +++ b/spring-cloud-gcp-autoconfigure/src/test/java/com/google/cloud/spring/autoconfigure/TestUtils.java @@ -31,8 +31,4 @@ private static Credentials createMockCredentials() { .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); return mockCredential; } - - public static Credentials getMockCredentials() { - return MOCK_CREDENTIALS; - } } diff --git a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java index f0367f1f6b..aa38cd83ad 100644 --- a/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java +++ b/spring-cloud-gcp-pubsub-stream-binder/src/test/java/com/google/cloud/spring/stream/binder/pubsub/TestUtils.java @@ -31,9 +31,5 @@ private static Credentials createMockCredentials() { .thenReturn(CredentialTypeForMetrics.DO_NOT_SEND); return mockCredential; } - - public static Credentials getMockCredentials() { - return MOCK_CREDENTIALS; - } }