This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new d0ee69c5cd62 CAMEL-26624: camel-google-secret-manager - run the 
integration tests on Floci GCP (#30194)
d0ee69c5cd62 is described below

commit d0ee69c5cd627e98de48044c8c06f77c030e9ddd
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Nov 17 11:17:59 2026 +0100

    CAMEL-26624: camel-google-secret-manager - run the integration tests on 
Floci GCP (#30194)
    
    * CAMEL-26624: camel-google-secret-manager - run the integration tests on 
Floci GCP
    * CAMEL-26624: fail fast when GOOGLE_APPLICATION_CREDENTIALS is set without 
the remote mode, honour the project id property
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../apache/camel/catalog/test-infra/metadata.json  |  11 +++
 .../camel-google-secret-manager/pom.xml            |  12 +++
 .../manager/integration/GoogleSecretManagerIT.java |  73 ++++++++++++---
 test-infra/camel-test-infra-all/pom.xml            |  11 +++
 .../src/generated/resources/META-INF/metadata.json |  11 +++
 .../camel-test-infra-google-secret-manager/pom.xml |  40 ++++++++
 .../common/GoogleSecretManagerProperties.java      |  27 ++++++
 .../services/GoogleSecretManagerInfraService.java  |  37 ++++++++
 ...gleSecretManagerLocalContainerInfraService.java | 102 +++++++++++++++++++++
 .../GoogleSecretManagerRemoteInfraService.java     |  54 +++++++++++
 .../services/GoogleSecretManagerService.java       |  27 ++++++
 .../GoogleSecretManagerServiceFactory.java         |  85 +++++++++++++++++
 .../src/main/resources/META-INF/MANIFEST.MF        |   0
 test-infra/pom.xml                                 |   1 +
 14 files changed, 476 insertions(+), 15 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
index 37ef08a6e1fd..c7ce0cd56460 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/test-infra/metadata.json
@@ -801,6 +801,17 @@
   "version" : "4.24.0-SNAPSHOT",
   "serviceVersion" : "RELEASE.2025-09-07T16-13-09Z-cpuv1",
   "uiSupported" : true
+}, {
+  "service" : 
"org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerInfraService",
+  "description" : "Local Google Secret Manager service with Floci GCP",
+  "implementation" : 
"org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerLocalContainerInfraService",
+  "alias" : [ "google" ],
+  "aliasImplementation" : [ "secret-manager" ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-google-secret-manager",
+  "version" : "4.24.0-SNAPSHOT",
+  "serviceVersion" : "0.12.0",
+  "uiSupported" : false
 }, {
   "service" : "org.apache.camel.test.infra.ftp.services.FtpInfraService",
   "description" : "Embedded SFTP Server",
diff --git a/components/camel-google/camel-google-secret-manager/pom.xml 
b/components/camel-google/camel-google-secret-manager/pom.xml
index 89a348043b93..951fcbccc86c 100644
--- a/components/camel-google/camel-google-secret-manager/pom.xml
+++ b/components/camel-google/camel-google-secret-manager/pom.xml
@@ -35,6 +35,10 @@
     <properties>
         <firstVersion>3.16.0</firstVersion>
         <camel.surefire.forkTimeout>300</camel.surefire.forkTimeout>
+
+        <!-- Floci GCP is not available for these -->
+        <skipITs.ppc64le>true</skipITs.ppc64le>
+        <skipITs.s390x>true</skipITs.s390x>
     </properties>
 
     <dependencies>
@@ -87,6 +91,14 @@
             <artifactId>camel-test-junit6</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <!-- test infra -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-google-secret-manager</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.assertj</groupId>
             <artifactId>assertj-core</artifactId>
diff --git 
a/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java
 
b/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java
index cb8794d184eb..a6dd0ab9730f 100644
--- 
a/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java
+++ 
b/components/camel-google/camel-google-secret-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java
@@ -16,28 +16,44 @@
  */
 package org.apache.camel.component.google.secret.manager.integration;
 
+import java.io.IOException;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
 import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
+import com.google.cloud.secretmanager.v1.SecretManagerServiceSettings;
+import io.grpc.ManagedChannelBuilder;
+import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import 
org.apache.camel.component.google.secret.manager.GoogleSecretManagerConstants;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spi.OnCamelContextStopped;
+import org.apache.camel.support.LifecycleStrategySupport;
+import 
org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerLocalContainerInfraService;
+import 
org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerService;
+import 
org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerServiceFactory;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-@EnabledIfEnvironmentVariable(named = "GOOGLE_APPLICATION_CREDENTIALS", 
matches = ".*",
-                              disabledReason = "Application credentials were 
not provided")
-public class GoogleSecretManagerIT extends CamelTestSupport {
+/**
+ * Runs against the Secret Manager service of Floci GCP, or with {@code 
-Dgoogle.instance.type=remote} against the one
+ * of the project of the {@code google.secret.manager.project.id} system 
property, with the application default
+ * credentials, such as the key of the {@code GOOGLE_APPLICATION_CREDENTIALS} 
environment variable.
+ */
+class GoogleSecretManagerIT extends CamelTestSupport {
+
+    @RegisterExtension
+    static GoogleSecretManagerService service = 
GoogleSecretManagerServiceFactory.createService();
 
-    final String serviceAccountKeyFile = 
System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
-    final String project = "myProject";
+    final String project = service.projectId();
 
     @EndpointInject("mock:createSecret")
     private MockEndpoint mockSecret;
@@ -48,6 +64,37 @@ public class GoogleSecretManagerIT extends CamelTestSupport {
     @EndpointInject("mock:listSecrets")
     private MockEndpoint listSecrets;
 
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        if (service instanceof GoogleSecretManagerLocalContainerInfraService) {
+            // the test ran against a real project when this variable was set, 
before it ran on Floci GCP: so that a run
+            // on Floci GCP is not taken for one against that project, it asks 
for -Dgoogle.instance.type=remote
+            if (System.getenv("GOOGLE_APPLICATION_CREDENTIALS") != null) {
+                throw new IllegalStateException(
+                        "GOOGLE_APPLICATION_CREDENTIALS is set: add 
-Dgoogle.instance.type=remote to run the test against"
+                                                + " the Secret Manager of that 
project");
+            }
+            // the endpoints take the client of the registry, and do not close 
it: it goes with the context
+            SecretManagerServiceClient client = createLocalClient();
+            context.getRegistry().bind("secretManagerClient", client);
+            
context.addLifecycleStrategy(LifecycleStrategySupport.adapt((OnCamelContextStopped)
 stopped -> client.close()));
+        }
+        return context;
+    }
+
+    // Floci GCP serves gRPC in plain text, and accepts any credentials
+    private static SecretManagerServiceClient createLocalClient() throws 
IOException {
+        SecretManagerServiceSettings settings = 
SecretManagerServiceSettings.newBuilder()
+                
.setTransportChannelProvider(InstantiatingGrpcChannelProvider.newBuilder()
+                        .setEndpoint(service.endpoint())
+                        
.setChannelConfigurator(ManagedChannelBuilder::usePlaintext)
+                        .build())
+                .setCredentialsProvider(NoCredentialsProvider.create())
+                .build();
+        return SecretManagerServiceClient.create(settings);
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
@@ -55,20 +102,16 @@ public class GoogleSecretManagerIT extends 
CamelTestSupport {
             public void configure() {
 
                 from("direct:createSecret")
-                        .to("google-secret-manager://" + project + 
"?serviceAccountKey="
-                            + serviceAccountKeyFile + 
"&operation=createSecret")
+                        .to("google-secret-manager://" + project + 
"?operation=createSecret")
                         .to("mock:createSecret");
 
-                from("direct:getSecretVersion").to("google-secret-manager://" 
+ project + "?serviceAccountKey="
-                                                   + serviceAccountKeyFile + 
"&operation=getSecretVersion")
+                from("direct:getSecretVersion").to("google-secret-manager://" 
+ project + "?operation=getSecretVersion")
                         .to("mock:getSecret");
 
-                from("direct:listSecrets").to("google-secret-manager://" + 
project + "?serviceAccountKey="
-                                              + serviceAccountKeyFile + 
"&operation=listSecrets")
+                from("direct:listSecrets").to("google-secret-manager://" + 
project + "?operation=listSecrets")
                         .to("mock:listSecrets");
 
-                from("direct:deleteSecret").to("google-secret-manager://" + 
project + "?serviceAccountKey="
-                                               + serviceAccountKeyFile + 
"&operation=deleteSecret")
+                from("direct:deleteSecret").to("google-secret-manager://" + 
project + "?operation=deleteSecret")
                         .to("mock:deleteSecret");
 
             }
@@ -76,7 +119,7 @@ public class GoogleSecretManagerIT extends CamelTestSupport {
     }
 
     @Test
-    public void sendIn() {
+    void sendIn() {
 
         mockSecret.expectedMessageCount(1);
         mockGetSecret.expectedMessageCount(1);
diff --git a/test-infra/camel-test-infra-all/pom.xml 
b/test-infra/camel-test-infra-all/pom.xml
index 5b2de18dd966..c4a54c5787d5 100644
--- a/test-infra/camel-test-infra-all/pom.xml
+++ b/test-infra/camel-test-infra-all/pom.xml
@@ -146,6 +146,11 @@
             <artifactId>camel-test-infra-google-pubsub</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-google-secret-manager</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-test-infra-google-storage</artifactId>
@@ -530,6 +535,12 @@
                                         
<artifactId>camel-test-infra-google-pubsub</artifactId>
                                     </dependency>
                                 </fileSet>
+                                <fileSet>
+                                    <dependency>
+                                        <groupId>org.apache.camel</groupId>
+                                        
<artifactId>camel-test-infra-google-secret-manager</artifactId>
+                                    </dependency>
+                                </fileSet>
                                 <fileSet>
                                     <dependency>
                                         <groupId>org.apache.camel</groupId>
diff --git 
a/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
 
b/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
index 37ef08a6e1fd..c7ce0cd56460 100644
--- 
a/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
+++ 
b/test-infra/camel-test-infra-all/src/generated/resources/META-INF/metadata.json
@@ -801,6 +801,17 @@
   "version" : "4.24.0-SNAPSHOT",
   "serviceVersion" : "RELEASE.2025-09-07T16-13-09Z-cpuv1",
   "uiSupported" : true
+}, {
+  "service" : 
"org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerInfraService",
+  "description" : "Local Google Secret Manager service with Floci GCP",
+  "implementation" : 
"org.apache.camel.test.infra.google.secret.manager.services.GoogleSecretManagerLocalContainerInfraService",
+  "alias" : [ "google" ],
+  "aliasImplementation" : [ "secret-manager" ],
+  "groupId" : "org.apache.camel",
+  "artifactId" : "camel-test-infra-google-secret-manager",
+  "version" : "4.24.0-SNAPSHOT",
+  "serviceVersion" : "0.12.0",
+  "uiSupported" : false
 }, {
   "service" : "org.apache.camel.test.infra.ftp.services.FtpInfraService",
   "description" : "Embedded SFTP Server",
diff --git a/test-infra/camel-test-infra-google-secret-manager/pom.xml 
b/test-infra/camel-test-infra-google-secret-manager/pom.xml
new file mode 100644
index 000000000000..18be9bea2952
--- /dev/null
+++ b/test-infra/camel-test-infra-google-secret-manager/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <artifactId>camel-test-infra-parent</artifactId>
+        <groupId>org.apache.camel</groupId>
+        <relativePath>../camel-test-infra-parent/pom.xml</relativePath>
+        <version>4.24.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <name>Camel :: Test Infra :: Google Secret Manager</name>
+    <artifactId>camel-test-infra-google-secret-manager</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-google-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/common/GoogleSecretManagerProperties.java
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/common/GoogleSecretManagerProperties.java
new file mode 100644
index 000000000000..b40276cadeb0
--- /dev/null
+++ 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/common/GoogleSecretManagerProperties.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.test.infra.google.secret.manager.common;
+
+public final class GoogleSecretManagerProperties {
+    public static final String PROJECT_ID = "google.secret.manager.project.id";
+    public static final String ENDPOINT = "google.secret.manager.endpoint";
+
+    private GoogleSecretManagerProperties() {
+
+    }
+}
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerInfraService.java
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerInfraService.java
new file mode 100644
index 000000000000..461a091db4a2
--- /dev/null
+++ 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerInfraService.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.test.infra.google.secret.manager.services;
+
+import org.apache.camel.test.infra.common.services.InfrastructureService;
+
+/**
+ * A Secret Manager service: the one of Floci GCP, or the one of a real Google 
Cloud project.
+ */
+public interface GoogleSecretManagerInfraService extends InfrastructureService 
{
+
+    /**
+     * The id of the project
+     */
+    String projectId();
+
+    /**
+     * The address of the Secret Manager API, for example {@code 
localhost:32768} for Floci GCP, which the gRPC clients
+     * reach in plain text, or {@code secretmanager.googleapis.com:443} for 
Google Cloud
+     */
+    String endpoint();
+}
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerLocalContainerInfraService.java
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerLocalContainerInfraService.java
new file mode 100644
index 000000000000..5bd8051b08de
--- /dev/null
+++ 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerLocalContainerInfraService.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.test.infra.google.secret.manager.services;
+
+import org.apache.camel.spi.annotations.InfraService;
+import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerEnvironmentUtil;
+import org.apache.camel.test.infra.common.services.ContainerService;
+import org.apache.camel.test.infra.google.common.GoogleProperties;
+import org.apache.camel.test.infra.google.common.services.FlociGcpContainer;
+import 
org.apache.camel.test.infra.google.secret.manager.common.GoogleSecretManagerProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A local Secret Manager service on Floci GCP, which the gRPC clients reach 
in plain text, with any credentials.
+ */
+@InfraService(service = GoogleSecretManagerInfraService.class,
+              description = "Local Google Secret Manager service with Floci 
GCP",
+              serviceAlias = "google", serviceImplementationAlias = 
"secret-manager")
+public class GoogleSecretManagerLocalContainerInfraService
+        implements GoogleSecretManagerInfraService, 
ContainerService<FlociGcpContainer> {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(GoogleSecretManagerLocalContainerInfraService.class);
+    private static final String DEFAULT_PROJECT_ID = "test-project";
+
+    private final FlociGcpContainer container;
+
+    public GoogleSecretManagerLocalContainerInfraService() {
+        this(LocalPropertyResolver.getProperty(FlociGcpContainer.class, 
GoogleProperties.GOOGLE_CONTAINER));
+    }
+
+    public GoogleSecretManagerLocalContainerInfraService(String imageName) {
+        container = initContainer(imageName);
+        String name = ContainerEnvironmentUtil.containerName(this.getClass());
+        if (name != null) {
+            container.withCreateContainerCmdModifier(cmd -> 
cmd.withName(name));
+        }
+    }
+
+    public GoogleSecretManagerLocalContainerInfraService(FlociGcpContainer 
container) {
+        this.container = container;
+    }
+
+    protected FlociGcpContainer initContainer(String imageName) {
+        return new FlociGcpContainer(imageName, 
ContainerEnvironmentUtil.isFixedPort(this.getClass()));
+    }
+
+    @Override
+    public void registerProperties() {
+        System.setProperty(GoogleSecretManagerProperties.PROJECT_ID, 
projectId());
+        System.setProperty(GoogleSecretManagerProperties.ENDPOINT, endpoint());
+    }
+
+    @Override
+    public void initialize() {
+        container.start();
+
+        LOG.info("Floci GCP running at address {}", 
container.serviceAddress());
+
+        registerProperties();
+    }
+
+    @Override
+    public void shutdown() {
+        container.stop();
+    }
+
+    @Override
+    public FlociGcpContainer getContainer() {
+        return container;
+    }
+
+    /**
+     * The id of the project, {@code test-project} unless the {@code 
google.secret.manager.project.id} system property
+     * gives another one: Floci GCP accepts any
+     */
+    @Override
+    public String projectId() {
+        return System.getProperty(GoogleSecretManagerProperties.PROJECT_ID, 
DEFAULT_PROJECT_ID);
+    }
+
+    @Override
+    public String endpoint() {
+        return container.grpcAddress();
+    }
+}
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerRemoteInfraService.java
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerRemoteInfraService.java
new file mode 100644
index 000000000000..74c7c82bd39d
--- /dev/null
+++ 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerRemoteInfraService.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.test.infra.google.secret.manager.services;
+
+import 
org.apache.camel.test.infra.google.secret.manager.common.GoogleSecretManagerProperties;
+
+/**
+ * The Secret Manager service of a real Google Cloud project, the one of the 
{@code google.secret.manager.project.id}
+ * system property, which the clients reach with the application default 
credentials, such as the key of the
+ * {@code GOOGLE_APPLICATION_CREDENTIALS} environment variable.
+ */
+public class GoogleSecretManagerRemoteInfraService implements 
GoogleSecretManagerInfraService {
+    private static final String DEFAULT_ENDPOINT = 
"secretmanager.googleapis.com:443";
+
+    @Override
+    public void registerProperties() {
+        // NO-OP
+    }
+
+    @Override
+    public void initialize() {
+        registerProperties();
+    }
+
+    @Override
+    public void shutdown() {
+        // NO-OP
+    }
+
+    @Override
+    public String projectId() {
+        return System.getProperty(GoogleSecretManagerProperties.PROJECT_ID);
+    }
+
+    @Override
+    public String endpoint() {
+        return System.getProperty(GoogleSecretManagerProperties.ENDPOINT, 
DEFAULT_ENDPOINT);
+    }
+}
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerService.java
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerService.java
new file mode 100644
index 000000000000..597d777d1a05
--- /dev/null
+++ 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.test.infra.google.secret.manager.services;
+
+import org.apache.camel.test.infra.common.services.ContainerTestService;
+import org.apache.camel.test.infra.common.services.TestService;
+
+/**
+ * Test infra service for Google Secret Manager
+ */
+public interface GoogleSecretManagerService extends 
GoogleSecretManagerInfraService, TestService, ContainerTestService {
+}
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerServiceFactory.java
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerServiceFactory.java
new file mode 100644
index 000000000000..d71c9543a181
--- /dev/null
+++ 
b/test-infra/camel-test-infra-google-secret-manager/src/main/java/org/apache/camel/test/infra/google/secret/manager/services/GoogleSecretManagerServiceFactory.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.test.infra.google.secret.manager.services;
+
+import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder;
+import org.apache.camel.test.infra.common.services.SingletonService;
+
+/**
+ * Creates the Secret Manager service of Floci GCP, or with {@code 
-Dgoogle.instance.type=remote} the one of a real
+ * Google Cloud project.
+ */
+public final class GoogleSecretManagerServiceFactory {
+
+    private static class SingletonGoogleSecretManagerService extends 
SingletonService<GoogleSecretManagerService>
+            implements GoogleSecretManagerService {
+        public SingletonGoogleSecretManagerService(GoogleSecretManagerService 
service, String name) {
+            super(service, name);
+        }
+
+        @Override
+        public String projectId() {
+            return getService().projectId();
+        }
+
+        @Override
+        public String endpoint() {
+            return getService().endpoint();
+        }
+    }
+
+    private GoogleSecretManagerServiceFactory() {
+
+    }
+
+    public static SimpleTestServiceBuilder<GoogleSecretManagerService> 
builder() {
+        return new SimpleTestServiceBuilder<>("google");
+    }
+
+    public static GoogleSecretManagerService createService() {
+        return builder()
+                .addLocalMapping(GoogleSecretManagerLocalContainerService::new)
+                .addRemoteMapping(GoogleSecretManagerRemoteService::new)
+                .build();
+    }
+
+    public static GoogleSecretManagerService createSingletonService() {
+        return SingletonServiceHolder.INSTANCE;
+    }
+
+    private static class SingletonServiceHolder {
+        static final GoogleSecretManagerService INSTANCE;
+        static {
+            SimpleTestServiceBuilder<GoogleSecretManagerService> instance = 
builder();
+            // a name of its own: the singleton of another Google service of 
the same JVM must not stand for this one
+            instance.addLocalMapping(
+                    () -> new SingletonGoogleSecretManagerService(
+                            new GoogleSecretManagerLocalContainerService(), 
"google-secret-manager"))
+                    .addRemoteMapping(GoogleSecretManagerRemoteService::new);
+            INSTANCE = instance.build();
+        }
+    }
+
+    static class GoogleSecretManagerLocalContainerService extends 
GoogleSecretManagerLocalContainerInfraService
+            implements GoogleSecretManagerService {
+    }
+
+    static class GoogleSecretManagerRemoteService extends 
GoogleSecretManagerRemoteInfraService
+            implements GoogleSecretManagerService {
+    }
+}
diff --git 
a/test-infra/camel-test-infra-google-secret-manager/src/main/resources/META-INF/MANIFEST.MF
 
b/test-infra/camel-test-infra-google-secret-manager/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/test-infra/pom.xml b/test-infra/pom.xml
index 64781271ddc9..520479cd4ebf 100644
--- a/test-infra/pom.xml
+++ b/test-infra/pom.xml
@@ -70,6 +70,7 @@
         <module>camel-test-infra-google-common</module>
         <module>camel-test-infra-google-firestore</module>
         <module>camel-test-infra-google-pubsub</module>
+        <module>camel-test-infra-google-secret-manager</module>
         <module>camel-test-infra-google-storage</module>
         <module>camel-test-infra-infinispan</module>
         <module>camel-test-infra-microprofile-lra</module>

Reply via email to