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 bee33cc58f07 CAMEL-26623: camel-google-firestore - run the integration
tests on Floci GCP (#29828)
bee33cc58f07 is described below
commit bee33cc58f07b2381afd63462d0ab80d7c0526e6
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Nov 16 22:55:29 2026 +0100
CAMEL-26623: camel-google-firestore - run the integration tests on Floci
GCP (#29828)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../apache/camel/catalog/test-infra/metadata.json | 11 +++
.../camel-google/camel-google-firestore/pom.xml | 12 +++
.../integration/GoogleFirestoreConsumerIT.java | 12 +--
.../integration/GoogleFirestoreITSupport.java | 81 +++++++++++-----
.../integration/GoogleFirestoreProducerIT.java | 12 +--
test-infra/camel-test-infra-all/pom.xml | 11 +++
.../src/generated/resources/META-INF/metadata.json | 11 +++
.../google/common/services/FlociGcpContainer.java | 8 ++
.../camel-test-infra-google-firestore/pom.xml | 40 ++++++++
.../common/GoogleFirestoreProperties.java | 33 +++++++
.../services/GoogleFirestoreInfraService.java | 37 ++++++++
.../GoogleFirestoreLocalContainerInfraService.java | 102 +++++++++++++++++++++
.../GoogleFirestoreRemoteInfraService.java | 54 +++++++++++
.../firestore/services/GoogleFirestoreService.java | 27 ++++++
.../services/GoogleFirestoreServiceFactory.java | 83 +++++++++++++++++
.../src/main/resources/META-INF/MANIFEST.MF | 0
test-infra/pom.xml | 1 +
17 files changed, 493 insertions(+), 42 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 ce31714c63a8..37ef08a6e1fd 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
@@ -570,6 +570,17 @@
"version" : "4.24.0-SNAPSHOT",
"serviceVersion" : "1.22.4-static",
"uiSupported" : false
+}, {
+ "service" :
"org.apache.camel.test.infra.google.firestore.services.GoogleFirestoreInfraService",
+ "description" : "Local Google Cloud Firestore service with Floci GCP",
+ "implementation" :
"org.apache.camel.test.infra.google.firestore.services.GoogleFirestoreLocalContainerInfraService",
+ "alias" : [ "google" ],
+ "aliasImplementation" : [ "firestore" ],
+ "groupId" : "org.apache.camel",
+ "artifactId" : "camel-test-infra-google-firestore",
+ "version" : "4.24.0-SNAPSHOT",
+ "serviceVersion" : "0.12.0",
+ "uiSupported" : false
}, {
"service" :
"org.apache.camel.test.infra.opensearch.services.OpenSearchInfraService",
"description" : "OpenSearch is a distributed search and analytics engine",
diff --git a/components/camel-google/camel-google-firestore/pom.xml
b/components/camel-google/camel-google-firestore/pom.xml
index 69891dd93165..f07593759e4d 100644
--- a/components/camel-google/camel-google-firestore/pom.xml
+++ b/components/camel-google/camel-google-firestore/pom.xml
@@ -34,6 +34,10 @@
<properties>
<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>
@@ -71,6 +75,14 @@
<artifactId>camel-test-junit6</artifactId>
<scope>test</scope>
</dependency>
+
+ <!-- test infra -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-google-firestore</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-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreConsumerIT.java
b/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreConsumerIT.java
index e23497089645..8e8ead691a56 100644
---
a/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreConsumerIT.java
+++
b/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreConsumerIT.java
@@ -24,7 +24,6 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.google.firestore.GoogleFirestoreConstants;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -33,17 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* Integration tests for Google Firestore Consumer operations.
*
* <p>
- * These tests require valid Google Cloud credentials. To run:
+ * These tests run against the Firestore service of Floci GCP, or against the
one of a Google Cloud project as
+ * {@link GoogleFirestoreITSupport} describes.
* </p>
- *
- * <pre>
- * mvn verify -pl components/camel-google/camel-google-firestore \
- * -Dgoogle.firestore.serviceAccountKey=/path/to/service-account.json \
- * -Dgoogle.firestore.projectId=my-project-id
- * </pre>
*/
-@EnabledIf(value =
"org.apache.camel.component.google.firestore.integration.GoogleFirestoreITSupport#hasCredentials",
- disabledReason = "Google Firestore credentials not provided. Set
google.firestore.serviceAccountKey and google.firestore.projectId system
properties.")
public class GoogleFirestoreConsumerIT extends GoogleFirestoreITSupport {
@Test
diff --git
a/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreITSupport.java
b/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreITSupport.java
index 6ac4e403db7d..fc5589e97b6a 100644
---
a/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreITSupport.java
+++
b/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreITSupport.java
@@ -18,19 +18,31 @@ package
org.apache.camel.component.google.firestore.integration;
import java.util.UUID;
+import com.google.cloud.firestore.Firestore;
+import com.google.cloud.firestore.FirestoreOptions;
import org.apache.camel.CamelContext;
import org.apache.camel.component.google.firestore.GoogleFirestoreComponent;
import
org.apache.camel.component.google.firestore.GoogleFirestoreConfiguration;
+import org.apache.camel.spi.OnCamelContextStopped;
+import org.apache.camel.support.LifecycleStrategySupport;
+import
org.apache.camel.test.infra.google.firestore.common.GoogleFirestoreProperties;
+import
org.apache.camel.test.infra.google.firestore.services.GoogleFirestoreService;
+import
org.apache.camel.test.infra.google.firestore.services.GoogleFirestoreServiceFactory;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base support class for Google Firestore integration tests.
*
* <p>
- * To run integration tests, provide the following system properties:
+ * The tests run against the Firestore service of Floci GCP. To run them
against the Firestore of a Google Cloud
+ * project, provide the following system properties:
* </p>
* <ul>
+ * <li>{@code google.instance.type=remote}</li>
* <li>{@code google.firestore.serviceAccountKey} - Path to the service
account JSON key file</li>
* <li>{@code google.firestore.projectId} - Google Cloud project ID</li>
* <li>{@code google.firestore.databaseId} - (Optional) Firestore database ID,
defaults to "(default)"</li>
@@ -42,6 +54,7 @@ import org.junit.jupiter.api.TestInstance;
*
* <pre>
* mvn verify -pl components/camel-google/camel-google-firestore \
+ * -Dgoogle.instance.type=remote \
* -Dgoogle.firestore.serviceAccountKey=/path/to/service-account.json \
* -Dgoogle.firestore.projectId=my-project-id
* </pre>
@@ -49,25 +62,16 @@ import org.junit.jupiter.api.TestInstance;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class GoogleFirestoreITSupport extends CamelTestSupport {
- protected static final String SERVICE_ACCOUNT_KEY =
System.getProperty("google.firestore.serviceAccountKey");
- protected static final String PROJECT_ID =
System.getProperty("google.firestore.projectId");
- protected static final String DATABASE_ID =
System.getProperty("google.firestore.databaseId");
+ @RegisterExtension
+ public static GoogleFirestoreService service =
GoogleFirestoreServiceFactory.createSingletonService();
+
+ private static final Logger LOG =
LoggerFactory.getLogger(GoogleFirestoreITSupport.class);
/**
* Test collection name with unique suffix to avoid conflicts between test
runs.
*/
protected static final String TEST_COLLECTION = "camel-test-" +
UUID.randomUUID().toString().substring(0, 8);
- /**
- * Checks if credentials are available to run integration tests.
- *
- * @return true if service account key and project ID are provided
- */
- public static boolean hasCredentials() {
- return SERVICE_ACCOUNT_KEY != null && !SERVICE_ACCOUNT_KEY.isEmpty()
- && PROJECT_ID != null && !PROJECT_ID.isEmpty();
- }
-
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
@@ -82,15 +86,42 @@ public abstract class GoogleFirestoreITSupport extends
CamelTestSupport {
*/
protected void addFirestoreComponent(CamelContext context) {
GoogleFirestoreConfiguration configuration = new
GoogleFirestoreConfiguration();
+ configuration.setProjectId(service.projectId());
- if (SERVICE_ACCOUNT_KEY != null) {
- configuration.setServiceAccountKey("file:" + SERVICE_ACCOUNT_KEY);
- }
- if (PROJECT_ID != null) {
- configuration.setProjectId(PROJECT_ID);
- }
- if (DATABASE_ID != null) {
- configuration.setDatabaseId(DATABASE_ID);
+ if (isRemote()) {
+ String serviceAccountKey =
System.getProperty(GoogleFirestoreProperties.SERVICE_ACCOUNT_KEY);
+ if (serviceAccountKey == null) {
+ throw new IllegalStateException(
+ "The google.firestore.serviceAccountKey system
property is required with -Dgoogle.instance.type=remote");
+ }
+ configuration.setServiceAccountKey("file:" + serviceAccountKey);
+ String databaseId =
System.getProperty(GoogleFirestoreProperties.DATABASE_ID);
+ if (databaseId != null) {
+ configuration.setDatabaseId(databaseId);
+ }
+ } else {
+ // the command that ran the tests against a real project, before
they ran on Floci GCP, gives a key: so that
+ // a run on Floci GCP is not taken for one against that project,
it asks for -Dgoogle.instance.type=remote
+ if
(System.getProperty(GoogleFirestoreProperties.SERVICE_ACCOUNT_KEY) != null) {
+ throw new IllegalStateException(
+ "The google.firestore.serviceAccountKey system
property is set: add -Dgoogle.instance.type=remote"
+ + " to run the tests against
the Firestore of that project");
+ }
+ // Floci GCP is reached as an emulator: in plain text, with any
credentials
+ Firestore client = FirestoreOptions.newBuilder()
+ .setProjectId(service.projectId())
+ .setEmulatorHost(service.endpoint())
+ .build()
+ .getService();
+ configuration.setFirestoreClient(client);
+ // the endpoints do not close a client that they did not build: it
goes with the context
+
context.addLifecycleStrategy(LifecycleStrategySupport.adapt((OnCamelContextStopped)
stopped -> {
+ try {
+ client.close();
+ } catch (Exception e) {
+ LOG.warn("Failed to close the Firestore client of Floci
GCP", e);
+ }
+ }));
}
GoogleFirestoreComponent component = new
GoogleFirestoreComponent(context);
@@ -99,6 +130,12 @@ public abstract class GoogleFirestoreITSupport extends
CamelTestSupport {
context.addComponent("google-firestore", component);
}
+ // the service is the one of a Google Cloud project with
-Dgoogle.instance.type=remote, and the one of Floci GCP
+ // otherwise
+ private static boolean isRemote() {
+ return "remote".equals(System.getProperty("google.instance.type"));
+ }
+
/**
* Returns the test collection name.
*
diff --git
a/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreProducerIT.java
b/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreProducerIT.java
index 169ece226705..4d564338883d 100644
---
a/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreProducerIT.java
+++
b/components/camel-google/camel-google-firestore/src/test/java/org/apache/camel/component/google/firestore/integration/GoogleFirestoreProducerIT.java
@@ -28,7 +28,6 @@ import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
-import org.junit.jupiter.api.condition.EnabledIf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -39,17 +38,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* Integration tests for Google Firestore Producer operations.
*
* <p>
- * These tests require valid Google Cloud credentials. To run:
+ * These tests run against the Firestore service of Floci GCP, or against the
one of a Google Cloud project as
+ * {@link GoogleFirestoreITSupport} describes.
* </p>
- *
- * <pre>
- * mvn verify -pl components/camel-google/camel-google-firestore \
- * -Dgoogle.firestore.serviceAccountKey=/path/to/service-account.json \
- * -Dgoogle.firestore.projectId=my-project-id
- * </pre>
*/
-@EnabledIf(value =
"org.apache.camel.component.google.firestore.integration.GoogleFirestoreITSupport#hasCredentials",
- disabledReason = "Google Firestore credentials not provided. Set
google.firestore.serviceAccountKey and google.firestore.projectId system
properties.")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class GoogleFirestoreProducerIT extends GoogleFirestoreITSupport {
diff --git a/test-infra/camel-test-infra-all/pom.xml
b/test-infra/camel-test-infra-all/pom.xml
index dfac989b11c5..5b2de18dd966 100644
--- a/test-infra/camel-test-infra-all/pom.xml
+++ b/test-infra/camel-test-infra-all/pom.xml
@@ -136,6 +136,11 @@
<artifactId>camel-test-infra-arangodb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-google-firestore</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-infra-google-pubsub</artifactId>
@@ -513,6 +518,12 @@
<artifactId>camel-test-infra-artemis</artifactId>
</dependency>
</fileSet>
+ <fileSet>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+
<artifactId>camel-test-infra-google-firestore</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 ce31714c63a8..37ef08a6e1fd 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
@@ -570,6 +570,17 @@
"version" : "4.24.0-SNAPSHOT",
"serviceVersion" : "1.22.4-static",
"uiSupported" : false
+}, {
+ "service" :
"org.apache.camel.test.infra.google.firestore.services.GoogleFirestoreInfraService",
+ "description" : "Local Google Cloud Firestore service with Floci GCP",
+ "implementation" :
"org.apache.camel.test.infra.google.firestore.services.GoogleFirestoreLocalContainerInfraService",
+ "alias" : [ "google" ],
+ "aliasImplementation" : [ "firestore" ],
+ "groupId" : "org.apache.camel",
+ "artifactId" : "camel-test-infra-google-firestore",
+ "version" : "4.24.0-SNAPSHOT",
+ "serviceVersion" : "0.12.0",
+ "uiSupported" : false
}, {
"service" :
"org.apache.camel.test.infra.opensearch.services.OpenSearchInfraService",
"description" : "OpenSearch is a distributed search and analytics engine",
diff --git
a/test-infra/camel-test-infra-google-common/src/main/java/org/apache/camel/test/infra/google/common/services/FlociGcpContainer.java
b/test-infra/camel-test-infra-google-common/src/main/java/org/apache/camel/test/infra/google/common/services/FlociGcpContainer.java
index 37926550c39b..9b4dfa597aad 100644
---
a/test-infra/camel-test-infra-google-common/src/main/java/org/apache/camel/test/infra/google/common/services/FlociGcpContainer.java
+++
b/test-infra/camel-test-infra-google-common/src/main/java/org/apache/camel/test/infra/google/common/services/FlociGcpContainer.java
@@ -47,4 +47,12 @@ public class FlociGcpContainer extends
GenericContainer<FlociGcpContainer> {
public String serviceAddress() {
return String.format("http://%s:%d", getHost(),
getMappedPort(SERVICE_PORT));
}
+
+ /**
+ * The address of the emulator for the gRPC clients, which connect to it
in plain text, for example
+ * {@code localhost:32768}
+ */
+ public String grpcAddress() {
+ return String.format("%s:%d", getHost(), getMappedPort(SERVICE_PORT));
+ }
}
diff --git a/test-infra/camel-test-infra-google-firestore/pom.xml
b/test-infra/camel-test-infra-google-firestore/pom.xml
new file mode 100644
index 000000000000..cc4583a9a706
--- /dev/null
+++ b/test-infra/camel-test-infra-google-firestore/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 Cloud Firestore</name>
+ <artifactId>camel-test-infra-google-firestore</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-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/common/GoogleFirestoreProperties.java
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/common/GoogleFirestoreProperties.java
new file mode 100644
index 000000000000..7bf8a3535506
--- /dev/null
+++
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/common/GoogleFirestoreProperties.java
@@ -0,0 +1,33 @@
+/*
+ * 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.firestore.common;
+
+/**
+ * The system properties of the Firestore service: the project id and the
service account key are the ones that the
+ * integration tests of camel-google-firestore have always taken.
+ */
+public final class GoogleFirestoreProperties {
+ public static final String PROJECT_ID = "google.firestore.projectId";
+ public static final String SERVICE_ACCOUNT_KEY =
"google.firestore.serviceAccountKey";
+ public static final String DATABASE_ID = "google.firestore.databaseId";
+ public static final String ENDPOINT = "google.firestore.endpoint";
+
+ private GoogleFirestoreProperties() {
+
+ }
+}
diff --git
a/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreInfraService.java
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreInfraService.java
new file mode 100644
index 000000000000..bbec3f750641
--- /dev/null
+++
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreInfraService.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.firestore.services;
+
+import org.apache.camel.test.infra.common.services.InfrastructureService;
+
+/**
+ * A Firestore service: the one of Floci GCP, or the one of a real Google
Cloud project.
+ */
+public interface GoogleFirestoreInfraService extends InfrastructureService {
+
+ /**
+ * The id of the project
+ */
+ String projectId();
+
+ /**
+ * The address of the Firestore API, for example {@code localhost:32768}
for Floci GCP, which the clients reach in
+ * plain text as an emulator, or {@code firestore.googleapis.com:443} for
Google Cloud
+ */
+ String endpoint();
+}
diff --git
a/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreLocalContainerInfraService.java
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreLocalContainerInfraService.java
new file mode 100644
index 000000000000..6713f0d24165
--- /dev/null
+++
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreLocalContainerInfraService.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.firestore.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.firestore.common.GoogleFirestoreProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A local Firestore service on Floci GCP, which the clients reach as an
emulator: in plain text, with any credentials.
+ */
+@InfraService(service = GoogleFirestoreInfraService.class,
+ description = "Local Google Cloud Firestore service with Floci
GCP",
+ serviceAlias = "google", serviceImplementationAlias =
"firestore")
+public class GoogleFirestoreLocalContainerInfraService
+ implements GoogleFirestoreInfraService,
ContainerService<FlociGcpContainer> {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(GoogleFirestoreLocalContainerInfraService.class);
+ private static final String DEFAULT_PROJECT_ID = "test-project";
+
+ private final FlociGcpContainer container;
+
+ public GoogleFirestoreLocalContainerInfraService() {
+ this(LocalPropertyResolver.getProperty(FlociGcpContainer.class,
GoogleProperties.GOOGLE_CONTAINER));
+ }
+
+ public GoogleFirestoreLocalContainerInfraService(String imageName) {
+ container = initContainer(imageName);
+ String name = ContainerEnvironmentUtil.containerName(this.getClass());
+ if (name != null) {
+ container.withCreateContainerCmdModifier(cmd ->
cmd.withName(name));
+ }
+ }
+
+ public GoogleFirestoreLocalContainerInfraService(FlociGcpContainer
container) {
+ this.container = container;
+ }
+
+ protected FlociGcpContainer initContainer(String imageName) {
+ return new FlociGcpContainer(imageName,
ContainerEnvironmentUtil.isFixedPort(this.getClass()));
+ }
+
+ @Override
+ public void registerProperties() {
+ System.setProperty(GoogleFirestoreProperties.PROJECT_ID, projectId());
+ System.setProperty(GoogleFirestoreProperties.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.firestore.projectId} system property gives
+ * another one: Floci GCP accepts any
+ */
+ @Override
+ public String projectId() {
+ return System.getProperty(GoogleFirestoreProperties.PROJECT_ID,
DEFAULT_PROJECT_ID);
+ }
+
+ @Override
+ public String endpoint() {
+ return container.grpcAddress();
+ }
+}
diff --git
a/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreRemoteInfraService.java
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreRemoteInfraService.java
new file mode 100644
index 000000000000..7037abc15669
--- /dev/null
+++
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreRemoteInfraService.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.firestore.services;
+
+import
org.apache.camel.test.infra.google.firestore.common.GoogleFirestoreProperties;
+
+/**
+ * The Firestore service of a real Google Cloud project, the one of the {@code
google.firestore.projectId} system
+ * property, which the integration tests reach with the service account key of
the
+ * {@code google.firestore.serviceAccountKey} system property.
+ */
+public class GoogleFirestoreRemoteInfraService implements
GoogleFirestoreInfraService {
+ private static final String DEFAULT_ENDPOINT =
"firestore.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(GoogleFirestoreProperties.PROJECT_ID);
+ }
+
+ @Override
+ public String endpoint() {
+ return System.getProperty(GoogleFirestoreProperties.ENDPOINT,
DEFAULT_ENDPOINT);
+ }
+}
diff --git
a/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreService.java
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreService.java
new file mode 100644
index 000000000000..4f55d8c92694
--- /dev/null
+++
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreService.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.firestore.services;
+
+import org.apache.camel.test.infra.common.services.ContainerTestService;
+import org.apache.camel.test.infra.common.services.TestService;
+
+/**
+ * Test infra service for Google Cloud Firestore
+ */
+public interface GoogleFirestoreService extends GoogleFirestoreInfraService,
TestService, ContainerTestService {
+}
diff --git
a/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreServiceFactory.java
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreServiceFactory.java
new file mode 100644
index 000000000000..0f01c4d34969
--- /dev/null
+++
b/test-infra/camel-test-infra-google-firestore/src/main/java/org/apache/camel/test/infra/google/firestore/services/GoogleFirestoreServiceFactory.java
@@ -0,0 +1,83 @@
+/*
+ * 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.firestore.services;
+
+import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder;
+import org.apache.camel.test.infra.common.services.SingletonService;
+
+/**
+ * Creates the Firestore service of Floci GCP, or with {@code
-Dgoogle.instance.type=remote} the one of a real Google
+ * Cloud project.
+ */
+public final class GoogleFirestoreServiceFactory {
+
+ private static class SingletonGoogleFirestoreService extends
SingletonService<GoogleFirestoreService>
+ implements GoogleFirestoreService {
+ public SingletonGoogleFirestoreService(GoogleFirestoreService service,
String name) {
+ super(service, name);
+ }
+
+ @Override
+ public String projectId() {
+ return getService().projectId();
+ }
+
+ @Override
+ public String endpoint() {
+ return getService().endpoint();
+ }
+ }
+
+ private GoogleFirestoreServiceFactory() {
+
+ }
+
+ public static SimpleTestServiceBuilder<GoogleFirestoreService> builder() {
+ return new SimpleTestServiceBuilder<>("google");
+ }
+
+ public static GoogleFirestoreService createService() {
+ return builder()
+ .addLocalMapping(GoogleFirestoreLocalContainerService::new)
+ .addRemoteMapping(GoogleFirestoreRemoteService::new)
+ .build();
+ }
+
+ public static GoogleFirestoreService createSingletonService() {
+ return SingletonServiceHolder.INSTANCE;
+ }
+
+ private static class SingletonServiceHolder {
+ static final GoogleFirestoreService INSTANCE;
+ static {
+ SimpleTestServiceBuilder<GoogleFirestoreService> 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 SingletonGoogleFirestoreService(new
GoogleFirestoreLocalContainerService(), "google-firestore"))
+ .addRemoteMapping(GoogleFirestoreRemoteService::new);
+ INSTANCE = instance.build();
+ }
+ }
+
+ static class GoogleFirestoreLocalContainerService extends
GoogleFirestoreLocalContainerInfraService
+ implements GoogleFirestoreService {
+ }
+
+ static class GoogleFirestoreRemoteService extends
GoogleFirestoreRemoteInfraService implements GoogleFirestoreService {
+ }
+}
diff --git
a/test-infra/camel-test-infra-google-firestore/src/main/resources/META-INF/MANIFEST.MF
b/test-infra/camel-test-infra-google-firestore/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 020f4d5b8562..64781271ddc9 100644
--- a/test-infra/pom.xml
+++ b/test-infra/pom.xml
@@ -68,6 +68,7 @@
<module>camel-test-infra-apicurio-registry</module>
<module>camel-test-infra-consul</module>
<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-storage</module>
<module>camel-test-infra-infinispan</module>