This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch camel-23117-postgres-vector-infra in repository https://gitbox.apache.org/repos/asf/camel.git
commit d383a6367618b51f76abf317dd67dc5b7deb237e Author: Guillaume Nodet <[email protected]> AuthorDate: Fri Mar 13 09:31:35 2026 +0100 CAMEL-23117: Add test infrastructure for PostgreSQL with pgvector extension Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .../infra/postgres/common/PostgresProperties.java | 1 + .../PostgresVectorLocalContainerInfraService.java | 39 ++++++++++++++++++++++ .../PostgresVectorLocalContainerService.java} | 20 +++++------ .../PostgresVectorServiceFactory.java} | 22 ++++++------ .../infra/postgres/services/container.properties | 1 + 5 files changed, 61 insertions(+), 22 deletions(-) diff --git a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java index e44c9e897307..82ce8cd29acc 100644 --- a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java +++ b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java @@ -24,6 +24,7 @@ public final class PostgresProperties { public static final String USERNAME = "postgres.user.name"; public static final String PASSWORD = "postgres.user.password"; public static final String POSTGRES_CONTAINER = "postgres.container"; + public static final String POSTGRES_VECTOR_CONTAINER = "postgres.vector.container"; public static final int DEFAULT_PORT = 5432; diff --git a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorLocalContainerInfraService.java b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorLocalContainerInfraService.java new file mode 100644 index 000000000000..860b0bd98bf6 --- /dev/null +++ b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorLocalContainerInfraService.java @@ -0,0 +1,39 @@ +/* + * 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.postgres.services; + +import org.apache.camel.spi.annotations.InfraService; +import org.apache.camel.test.infra.common.LocalPropertyResolver; +import org.apache.camel.test.infra.postgres.common.PostgresProperties; + +@InfraService(service = PostgresInfraService.class, + description = "Postgres SQL Database with pgvector extension", + serviceAlias = { "postgres-vector", "pgvector" }) +public class PostgresVectorLocalContainerInfraService extends PostgresLocalContainerInfraService { + + public static final String DEFAULT_POSTGRES_VECTOR_CONTAINER + = LocalPropertyResolver.getProperty(PostgresLocalContainerInfraService.class, + PostgresProperties.POSTGRES_VECTOR_CONTAINER); + + public PostgresVectorLocalContainerInfraService() { + super(DEFAULT_POSTGRES_VECTOR_CONTAINER); + } + + public PostgresVectorLocalContainerInfraService(String imageName) { + super(imageName); + } +} diff --git a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorLocalContainerService.java similarity index 58% copy from test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java copy to test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorLocalContainerService.java index e44c9e897307..dfea9d565eee 100644 --- a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java +++ b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorLocalContainerService.java @@ -14,20 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.camel.test.infra.postgres.services; -package org.apache.camel.test.infra.postgres.common; +public class PostgresVectorLocalContainerService extends PostgresVectorLocalContainerInfraService + implements PostgresService { -public final class PostgresProperties { - public static final String SERVICE_ADDRESS = "postgres.service.address"; - public static final String HOST = "postgres.service.host"; - public static final String PORT = "postgres.service.port"; - public static final String USERNAME = "postgres.user.name"; - public static final String PASSWORD = "postgres.user.password"; - public static final String POSTGRES_CONTAINER = "postgres.container"; - - public static final int DEFAULT_PORT = 5432; - - private PostgresProperties() { + public PostgresVectorLocalContainerService() { + super(); + } + public PostgresVectorLocalContainerService(String imageName) { + super(imageName); } } diff --git a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java similarity index 56% copy from test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java copy to test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java index e44c9e897307..d0084ea87924 100644 --- a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/common/PostgresProperties.java +++ b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java @@ -14,20 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.camel.test.infra.postgres.services; -package org.apache.camel.test.infra.postgres.common; +import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; -public final class PostgresProperties { - public static final String SERVICE_ADDRESS = "postgres.service.address"; - public static final String HOST = "postgres.service.host"; - public static final String PORT = "postgres.service.port"; - public static final String USERNAME = "postgres.user.name"; - public static final String PASSWORD = "postgres.user.password"; - public static final String POSTGRES_CONTAINER = "postgres.container"; +public final class PostgresVectorServiceFactory { - public static final int DEFAULT_PORT = 5432; + private PostgresVectorServiceFactory() { + } - private PostgresProperties() { + public static SimpleTestServiceBuilder<PostgresService> builder() { + return new SimpleTestServiceBuilder<>("postgres"); + } + public static PostgresService createService() { + return builder().addLocalMapping(PostgresVectorLocalContainerService::new) + .addRemoteMapping(PostgresServiceFactory.PostgresRemoteService::new) + .build(); } } diff --git a/test-infra/camel-test-infra-postgres/src/main/resources/org/apache/camel/test/infra/postgres/services/container.properties b/test-infra/camel-test-infra-postgres/src/main/resources/org/apache/camel/test/infra/postgres/services/container.properties index 3e2064435fa0..05471706ca7b 100644 --- a/test-infra/camel-test-infra-postgres/src/main/resources/org/apache/camel/test/infra/postgres/services/container.properties +++ b/test-infra/camel-test-infra-postgres/src/main/resources/org/apache/camel/test/infra/postgres/services/container.properties @@ -17,3 +17,4 @@ postgres.container=mirror.gcr.io/postgres:17.9-alpine postgres.container.version.include=alpine postgres.container.version.freeze.major=true +postgres.vector.container=pgvector/pgvector:pg17
