From 3a3f1183cea73ce27a299a91bacb7bd6d3f8bdc2 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 27 Mar 2026 23:14:40 +0100 Subject: [PATCH 1/3] Make Docker container names unique per instance Append PID and AtomicInteger counter to container names generated by ContainerEnvironmentUtil.containerName(). This prevents container name collisions both across JVMs (parallel builds via mvnd) and within the same JVM (singleton containers coexisting with tests that create their own containers). Also remove hardcoded container name from RocketMQNameserverContainer which bypassed ContainerEnvironmentUtil. The network alias "nameserver" (which is network-scoped) is sufficient for inter-container communication. Co-Authored-By: Claude Opus 4.6 --- .../infra/common/services/ContainerEnvironmentUtil.java | 6 ++++++ .../rocketmq/services/RocketMQNameserverContainer.java | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java index 689e6ef7fb67c..e99d584351b12 100644 --- a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java +++ b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/ContainerEnvironmentUtil.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; import com.github.dockerjava.api.model.Version; import com.github.dockerjava.api.model.VersionComponent; @@ -35,6 +36,7 @@ public final class ContainerEnvironmentUtil { public static final String INFRA_PORT_PROPERTY = "camel.infra.port"; public static final String INFRA_FIXED_PORT_PROPERTY = "camel.infra.fixedPort"; private static final Logger LOG = LoggerFactory.getLogger(ContainerEnvironmentUtil.class); + private static final AtomicInteger INSTANCE_COUNTER = new AtomicInteger(0); private static boolean dockerAvailable; private static boolean environmentCheckState; @@ -114,6 +116,10 @@ public static String containerName(Class cls) { if (annotation.serviceImplementationAlias().length > 0) { name += "-" + annotation.serviceImplementationAlias()[0]; } + // Append PID for cross-JVM uniqueness (parallel builds via mvnd) + // and instance counter for within-JVM uniqueness (parallel test classes + // or tests that create their own containers alongside singletons) + name += "-" + ProcessHandle.current().pid() + "-" + INSTANCE_COUNTER.incrementAndGet(); } else { LOG.warn("InfraService annotation not Found to determine container name alias."); } diff --git a/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQNameserverContainer.java b/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQNameserverContainer.java index a0b7aaaef8372..34f15cb0b0d17 100644 --- a/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQNameserverContainer.java +++ b/test-infra/camel-test-infra-rocketmq/src/main/java/org/apache/camel/test/infra/rocketmq/services/RocketMQNameserverContainer.java @@ -32,8 +32,6 @@ public RocketMQNameserverContainer(Network network) { addExposedPort(RocketMQProperties.ROCKETMQ_NAMESRV_PORT); withTmpFs(Collections.singletonMap("/home/rocketmq/logs", "rw")); withCommand("sh", "mqnamesrv"); - withCreateContainerCmdModifier(cmd -> cmd.withName("nameserver")); - waitingFor(Wait.forListeningPort()); } } From 6d7050d15596587cadbebe08b979284d6d8cf7d2 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 27 Mar 2026 23:14:46 +0100 Subject: [PATCH 2/3] Add createSingletonService() to 32 test-infra service factories Add singleton service support to all test-infra service factories that previously only had createService(). Each follows the established pattern (inner SingletonXxxService, lazy holder, factory method). Co-Authored-By: Claude Opus 4.6 --- .../services/RabbitMQServiceFactory.java | 4 + .../AzureStorageBlobServiceFactory.java | 50 +++++++++++ .../AzureStorageDataLakeServiceFactory.java | 47 ++++++++++ .../AzureStorageQueueServiceFactory.java | 50 +++++++++++ .../services/CassandraServiceFactory.java | 43 +++++++++ .../services/ChatScriptServiceFactory.java | 28 ++++++ .../infra/cli/services/CliServiceFactory.java | 88 +++++++++++++++++++ .../common/services/SingletonService.java | 3 +- .../consul/services/ConsulServiceFactory.java | 37 ++++++++ .../services/DoclingServiceFactory.java | 27 ++++++ .../services/GooglePubSubServiceFactory.java | 29 ++++++ .../services/HashicorpServiceFactory.java | 38 ++++++++ .../services/HazelcastServiceFactory.java | 27 ++++++ .../ibmmq/services/IbmMQServiceFactory.java | 36 ++++++++ .../iggy/services/IggyServiceFactory.java | 43 +++++++++ .../ignite/services/IgniteServiceFactory.java | 27 ++++++ .../services/KeycloakServiceFactory.java | 48 ++++++++++ .../services/McpEverythingServiceFactory.java | 32 +++++++ .../McpEverythingSseServiceFactory.java | 34 +++++++ .../MicroprofileLRAServiceFactory.java | 41 +++++++++ .../minio/services/MinioServiceFactory.java | 58 ++++++++++++ .../services/MosquittoServiceFactory.java | 27 ++++++ .../nats/services/NatsServiceFactory.java | 28 ++++++ .../services/OpenldapServiceFactory.java | 38 ++++++++ .../services/PostgresServiceFactory.java | 47 ++++++++++ .../PostgresVectorServiceFactory.java | 47 ++++++++++ .../services/RabbitMQServiceFactory.java | 48 ++++++++++ .../redis/services/RedisServiceFactory.java | 33 +++++++ .../solr/services/SolrServiceFactory.java | 33 +++++++ .../TensorFlowServingServiceFactory.java | 36 ++++++++ .../triton/services/TritonServiceFactory.java | 38 ++++++++ .../xmpp/services/XmppServiceFactory.java | 38 ++++++++ .../services/ZooKeeperServiceFactory.java | 15 ++++ 33 files changed, 1216 insertions(+), 2 deletions(-) diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/test/infra/services/RabbitMQServiceFactory.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/test/infra/services/RabbitMQServiceFactory.java index c602ced47349d..cbdcad9c8e0e1 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/test/infra/services/RabbitMQServiceFactory.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/test/infra/services/RabbitMQServiceFactory.java @@ -26,4 +26,8 @@ private RabbitMQServiceFactory() { public static RabbitMQService createService() { return org.apache.camel.test.infra.rabbitmq.services.RabbitMQServiceFactory.createService(); } + + public static RabbitMQService createSingletonService() { + return org.apache.camel.test.infra.rabbitmq.services.RabbitMQServiceFactory.createSingletonService(); + } } diff --git a/test-infra/camel-test-infra-azure-storage-blob/src/main/java/org/apache/camel/test/infra/azure/storage/blob/services/AzureStorageBlobServiceFactory.java b/test-infra/camel-test-infra-azure-storage-blob/src/main/java/org/apache/camel/test/infra/azure/storage/blob/services/AzureStorageBlobServiceFactory.java index 01180df23be97..ed1b91978e460 100644 --- a/test-infra/camel-test-infra-azure-storage-blob/src/main/java/org/apache/camel/test/infra/azure/storage/blob/services/AzureStorageBlobServiceFactory.java +++ b/test-infra/camel-test-infra-azure-storage-blob/src/main/java/org/apache/camel/test/infra/azure/storage/blob/services/AzureStorageBlobServiceFactory.java @@ -17,10 +17,45 @@ package org.apache.camel.test.infra.azure.storage.blob.services; +import org.apache.camel.test.infra.azure.common.AzureCredentialsHolder; import org.apache.camel.test.infra.azure.common.services.AzureService; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class AzureStorageBlobServiceFactory { + + private static class SingletonAzureStorageBlobService extends SingletonService + implements AzureService { + public SingletonAzureStorageBlobService(AzureService service, String name) { + super(service, name); + } + + @Override + public AzureCredentialsHolder azureCredentials() { + return getService().azureCredentials(); + } + + @Override + public String accountName() { + return getService().accountName(); + } + + @Override + public String accessKey() { + return getService().accessKey(); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private AzureStorageBlobServiceFactory() { } @@ -36,6 +71,21 @@ public static AzureService createService() { .build(); } + public static AzureService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final AzureService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonAzureStorageBlobService(new AzureStorageBlobLocalContainerService(), "azure")) + .addRemoteMapping(AzureStorageBlobRemoteService::new); + INSTANCE = instance.build(); + } + } + static class AzureStorageBlobLocalContainerService extends AzureStorageBlobLocalContainerInfraService implements AzureService { } diff --git a/test-infra/camel-test-infra-azure-storage-datalake/src/main/java/org/apache/camel/test/infra/azure/storage/datalake/services/AzureStorageDataLakeServiceFactory.java b/test-infra/camel-test-infra-azure-storage-datalake/src/main/java/org/apache/camel/test/infra/azure/storage/datalake/services/AzureStorageDataLakeServiceFactory.java index 953576f653eab..95449de430d18 100644 --- a/test-infra/camel-test-infra-azure-storage-datalake/src/main/java/org/apache/camel/test/infra/azure/storage/datalake/services/AzureStorageDataLakeServiceFactory.java +++ b/test-infra/camel-test-infra-azure-storage-datalake/src/main/java/org/apache/camel/test/infra/azure/storage/datalake/services/AzureStorageDataLakeServiceFactory.java @@ -17,11 +17,45 @@ package org.apache.camel.test.infra.azure.storage.datalake.services; +import org.apache.camel.test.infra.azure.common.AzureCredentialsHolder; import org.apache.camel.test.infra.azure.common.services.AzureService; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class AzureStorageDataLakeServiceFactory { + private static class SingletonAzureStorageDataLakeService extends SingletonService + implements AzureService { + public SingletonAzureStorageDataLakeService(AzureService service, String name) { + super(service, name); + } + + @Override + public AzureCredentialsHolder azureCredentials() { + return getService().azureCredentials(); + } + + @Override + public String accountName() { + return getService().accountName(); + } + + @Override + public String accessKey() { + return getService().accessKey(); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private AzureStorageDataLakeServiceFactory() { } @@ -36,6 +70,19 @@ public static AzureService createService() { .build(); } + public static AzureService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final AzureService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addRemoteMapping(AzureStorageDataLakeRemoteService::new); + INSTANCE = instance.build(); + } + } + static class AzureStorageDataLakeRemoteService extends AzureStorageDataLakeRemoteInfraService implements AzureService { } } diff --git a/test-infra/camel-test-infra-azure-storage-queue/src/main/java/org/apache/camel/test/infra/azure/storage/queue/services/AzureStorageQueueServiceFactory.java b/test-infra/camel-test-infra-azure-storage-queue/src/main/java/org/apache/camel/test/infra/azure/storage/queue/services/AzureStorageQueueServiceFactory.java index 6761ca3647895..9109f568581c4 100644 --- a/test-infra/camel-test-infra-azure-storage-queue/src/main/java/org/apache/camel/test/infra/azure/storage/queue/services/AzureStorageQueueServiceFactory.java +++ b/test-infra/camel-test-infra-azure-storage-queue/src/main/java/org/apache/camel/test/infra/azure/storage/queue/services/AzureStorageQueueServiceFactory.java @@ -17,10 +17,45 @@ package org.apache.camel.test.infra.azure.storage.queue.services; +import org.apache.camel.test.infra.azure.common.AzureCredentialsHolder; import org.apache.camel.test.infra.azure.common.services.AzureService; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class AzureStorageQueueServiceFactory { + + private static class SingletonAzureStorageQueueService extends SingletonService + implements AzureService { + public SingletonAzureStorageQueueService(AzureService service, String name) { + super(service, name); + } + + @Override + public AzureCredentialsHolder azureCredentials() { + return getService().azureCredentials(); + } + + @Override + public String accountName() { + return getService().accountName(); + } + + @Override + public String accessKey() { + return getService().accessKey(); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private AzureStorageQueueServiceFactory() { } @@ -36,6 +71,21 @@ public static AzureService createService() { .build(); } + public static AzureService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final AzureService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonAzureStorageQueueService(new AzureStorageQueueLocalContainerService(), "azure")) + .addRemoteMapping(AzureStorageQueueRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class AzureStorageQueueLocalContainerService extends AzureStorageQueueLocalContainerInfraService implements AzureService { } diff --git a/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraServiceFactory.java b/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraServiceFactory.java index 2cdf79679e7f6..9418a9bba8ee4 100644 --- a/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraServiceFactory.java +++ b/test-infra/camel-test-infra-cassandra/src/main/java/org/apache/camel/test/infra/cassandra/services/CassandraServiceFactory.java @@ -17,8 +17,36 @@ package org.apache.camel.test.infra.cassandra.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class CassandraServiceFactory { + + private static class SingletonCassandraService extends SingletonService implements CassandraService { + public SingletonCassandraService(CassandraService service, String name) { + super(service, name); + } + + @Override + public int getCQL3Port() { + return getService().getCQL3Port(); + } + + @Override + public String getCassandraHost() { + return getService().getCassandraHost(); + } + + @Override + public String hosts() { + return getService().hosts(); + } + + @Override + public int port() { + return getService().port(); + } + } + private CassandraServiceFactory() { } @@ -43,6 +71,21 @@ public static CassandraService createService() { .build(); } + public static CassandraService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final CassandraService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonCassandraService(new CassandraLocalContainerService(), "cassandra")) + .addRemoteMapping(RemoteCassandraService::new); + INSTANCE = instance.build(); + } + } + public static class RemoteCassandraService extends RemoteCassandraInfraService implements CassandraService { } } diff --git a/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptServiceFactory.java b/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptServiceFactory.java index c5b1689e16260..dfb1594f24e4a 100644 --- a/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptServiceFactory.java +++ b/test-infra/camel-test-infra-chatscript/src/main/java/org/apache/camel/test/infra/chatscript/services/ChatScriptServiceFactory.java @@ -17,9 +17,22 @@ package org.apache.camel.test.infra.chatscript.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class ChatScriptServiceFactory { + private static class SingletonChatScriptService extends SingletonService + implements ChatScriptService { + public SingletonChatScriptService(ChatScriptService service, String name) { + super(service, name); + } + + @Override + public String serviceAddress() { + return getService().serviceAddress(); + } + } + private ChatScriptServiceFactory() { } @@ -35,6 +48,21 @@ public static ChatScriptService createService() { .build(); } + public static ChatScriptService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final ChatScriptService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonChatScriptService(new ChatScriptLocalContainerTestService(), "chatscript")) + .addRemoteMapping(ChatScriptRemoteTestService::new); + INSTANCE = instance.build(); + } + } + public static class ChatScriptLocalContainerTestService extends ChatScriptLocalContainerInfraService implements ChatScriptService { } diff --git a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliServiceFactory.java b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliServiceFactory.java index bad418ff5cadd..200f942c34b1a 100644 --- a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliServiceFactory.java +++ b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliServiceFactory.java @@ -16,9 +16,79 @@ */ package org.apache.camel.test.infra.cli.services; +import java.util.stream.Stream; + import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class CliServiceFactory { + + private static class SingletonCliService extends SingletonService implements CliService { + public SingletonCliService(CliService service, String name) { + super(service, name); + } + + @Override + public String execute(String command) { + return getService().execute(command); + } + + @Override + public String executeBackground(String command) { + return getService().executeBackground(command); + } + + @Override + public String executeGenericCommand(String command) { + return getService().executeGenericCommand(command); + } + + @Override + public void copyFileInternally(String source, String destination) { + getService().copyFileInternally(source, destination); + } + + @Override + public String getMountPoint() { + return getService().getMountPoint(); + } + + @Override + public String getContainerLogs() { + return getService().getContainerLogs(); + } + + @Override + public int getDevConsolePort() { + return getService().getDevConsolePort(); + } + + @Override + public Stream listDirectory(String directoryPath) { + return getService().listDirectory(directoryPath); + } + + @Override + public String id() { + return getService().id(); + } + + @Override + public String version() { + return getService().version(); + } + + @Override + public int getSshPort() { + return getService().getSshPort(); + } + + @Override + public String getSshPassword() { + return getService().getSshPassword(); + } + } + private CliServiceFactory() { } @@ -33,4 +103,22 @@ public static CliService createService() { .addMapping("local-camel-cli-process", CliLocalProcessService::new) .build(); } + + public static CliService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final CliService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonCliService(new CliLocalContainerService(), CliLocalContainerService.CONTAINER_NAME)) + .addMapping("local-camel-cli-process", + () -> new SingletonCliService( + new CliLocalProcessService(), + CliLocalContainerService.CONTAINER_NAME)); + INSTANCE = instance.build(); + } + } } diff --git a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/SingletonService.java b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/SingletonService.java index 127f562258e0f..9e2fc8501e67e 100644 --- a/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/SingletonService.java +++ b/test-infra/camel-test-infra-common/src/main/java/org/apache/camel/test/infra/common/services/SingletonService.java @@ -78,8 +78,7 @@ public final void initialize() { @Override public final void shutdown() { - LOG.error("Singleton services must not be shutdown manually"); - throw new IllegalArgumentException("Singleton services must not be shutdown manually"); + LOG.debug("Ignoring shutdown request for singleton service {}: will be shutdown via JVM shutdown hook", name); } @Override diff --git a/test-infra/camel-test-infra-consul/src/main/java/org/apache/camel/test/infra/consul/services/ConsulServiceFactory.java b/test-infra/camel-test-infra-consul/src/main/java/org/apache/camel/test/infra/consul/services/ConsulServiceFactory.java index ae9a9ac1d0bb0..81f1241577ad1 100644 --- a/test-infra/camel-test-infra-consul/src/main/java/org/apache/camel/test/infra/consul/services/ConsulServiceFactory.java +++ b/test-infra/camel-test-infra-consul/src/main/java/org/apache/camel/test/infra/consul/services/ConsulServiceFactory.java @@ -17,9 +17,31 @@ package org.apache.camel.test.infra.consul.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class ConsulServiceFactory { + private static class SingletonConsulService extends SingletonService implements ConsulService { + public SingletonConsulService(ConsulService service, String name) { + super(service, name); + } + + @Override + public String getConsulUrl() { + return getService().getConsulUrl(); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private ConsulServiceFactory() { } @@ -34,6 +56,21 @@ public static ConsulService createService() { .build(); } + public static ConsulService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final ConsulService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonConsulService(new ConsulLocalContainerTestService(), "consul")) + .addRemoteMapping(ConsulRemoteTestService::new); + INSTANCE = instance.build(); + } + } + public static class ConsulLocalContainerTestService extends ConsulLocalContainerInfraService implements ConsulService { } diff --git a/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingServiceFactory.java b/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingServiceFactory.java index 6e38bdc217607..798f55be973c5 100644 --- a/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingServiceFactory.java +++ b/test-infra/camel-test-infra-docling/src/main/java/org/apache/camel/test/infra/docling/services/DoclingServiceFactory.java @@ -17,8 +17,21 @@ package org.apache.camel.test.infra.docling.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class DoclingServiceFactory { + + private static class SingletonDoclingService extends SingletonService implements DoclingService { + public SingletonDoclingService(DoclingService service, String name) { + super(service, name); + } + + @Override + public String doclingServerUrl() { + return getService().doclingServerUrl(); + } + } + private DoclingServiceFactory() { } @@ -33,6 +46,20 @@ public static DoclingService createService() { .build(); } + public static DoclingService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final DoclingService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonDoclingService(new DoclingLocalContainerService(), "docling")); + INSTANCE = instance.build(); + } + } + public static class DoclingLocalContainerService extends DoclingLocalContainerInfraService implements DoclingService { } diff --git a/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubServiceFactory.java b/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubServiceFactory.java index a729c3047a517..dcaf736150292 100644 --- a/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubServiceFactory.java +++ b/test-infra/camel-test-infra-google-pubsub/src/main/java/org/apache/camel/test/infra/google/pubsub/services/GooglePubSubServiceFactory.java @@ -17,8 +17,22 @@ package org.apache.camel.test.infra.google.pubsub.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class GooglePubSubServiceFactory { + + private static class SingletonGooglePubSubService extends SingletonService + implements GooglePubSubService { + public SingletonGooglePubSubService(GooglePubSubService service, String name) { + super(service, name); + } + + @Override + public String getServiceAddress() { + return getService().getServiceAddress(); + } + } + private GooglePubSubServiceFactory() { } @@ -34,6 +48,21 @@ public static GooglePubSubService createService() { .build(); } + public static GooglePubSubService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final GooglePubSubService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonGooglePubSubService(new GooglePubSubLocalContainerService(), "google")) + .addRemoteMapping(GooglePubSubRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class GooglePubSubLocalContainerService extends GooglePubSubLocalContainerInfraService implements GooglePubSubService { } diff --git a/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpServiceFactory.java b/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpServiceFactory.java index 55a44f2194dc8..7e6133e5445ed 100644 --- a/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpServiceFactory.java +++ b/test-infra/camel-test-infra-hashicorp-vault/src/main/java/org/apache/camel/test/infra/hashicorp/vault/services/HashicorpServiceFactory.java @@ -17,8 +17,32 @@ package org.apache.camel.test.infra.hashicorp.vault.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class HashicorpServiceFactory { + + private static class SingletonHashicorpVaultService extends SingletonService + implements HashicorpVaultService { + public SingletonHashicorpVaultService(HashicorpVaultService service, String name) { + super(service, name); + } + + @Override + public String token() { + return getService().token(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String host() { + return getService().host(); + } + } + private HashicorpServiceFactory() { } @@ -33,6 +57,20 @@ public static HashicorpVaultService createService() { .build(); } + public static HashicorpVaultService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final HashicorpVaultService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonHashicorpVaultService(new HashicorpVaultLocalContainerService(), "hashicorp-vault")); + INSTANCE = instance.build(); + } + } + public static class HashicorpVaultLocalContainerService extends HashicorpVaultLocalContainerInfraService implements HashicorpVaultService { } diff --git a/test-infra/camel-test-infra-hazelcast/src/main/java/org/apache/camel/test/infra/hazelcast/services/HazelcastServiceFactory.java b/test-infra/camel-test-infra-hazelcast/src/main/java/org/apache/camel/test/infra/hazelcast/services/HazelcastServiceFactory.java index d1b9eab871356..45bfb5a37e92a 100644 --- a/test-infra/camel-test-infra-hazelcast/src/main/java/org/apache/camel/test/infra/hazelcast/services/HazelcastServiceFactory.java +++ b/test-infra/camel-test-infra-hazelcast/src/main/java/org/apache/camel/test/infra/hazelcast/services/HazelcastServiceFactory.java @@ -16,10 +16,23 @@ */ package org.apache.camel.test.infra.hazelcast.services; +import com.hazelcast.config.Config; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class HazelcastServiceFactory { + private static class SingletonHazelcastService extends SingletonService implements HazelcastService { + public SingletonHazelcastService(HazelcastService service, String name) { + super(service, name); + } + + @Override + public Config createConfiguration(String name, int port, String instanceName, String componentName) { + return getService().createConfiguration(name, port, instanceName, componentName); + } + } + private HazelcastServiceFactory() { } @@ -34,6 +47,20 @@ public static HazelcastService createService() { .build(); } + public static HazelcastService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final HazelcastService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonHazelcastService(new HazelcastEmbeddedService(), "hazelcast")); + INSTANCE = instance.build(); + } + } + public static class HazelcastEmbeddedService extends HazelcastEmbeddedInfraService implements HazelcastService { } } diff --git a/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQServiceFactory.java b/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQServiceFactory.java index f3043328dfd95..5010039b1b1e1 100644 --- a/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQServiceFactory.java +++ b/test-infra/camel-test-infra-ibmmq/src/main/java/org/apache/camel/test/infra/ibmmq/services/IbmMQServiceFactory.java @@ -17,9 +17,31 @@ package org.apache.camel.test.infra.ibmmq.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public class IbmMQServiceFactory { + private static class SingletonIbmMQService extends SingletonService implements IbmMQService { + public SingletonIbmMQService(IbmMQService service, String name) { + super(service, name); + } + + @Override + public String channel() { + return getService().channel(); + } + + @Override + public String queueManager() { + return getService().queueManager(); + } + + @Override + public int listenerPort() { + return getService().listenerPort(); + } + } + private IbmMQServiceFactory() { } @@ -34,6 +56,20 @@ public static IbmMQService createService() { .build(); } + public static IbmMQService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final IbmMQService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonIbmMQService(new IbmMQLocalContainerService(), "ibm-mq")); + INSTANCE = instance.build(); + } + } + public static class IbmMQLocalContainerService extends IbmMQLocalContainerInfraService implements IbmMQService { } diff --git a/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyServiceFactory.java b/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyServiceFactory.java index d093337a86950..74ae73f13e70d 100644 --- a/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyServiceFactory.java +++ b/test-infra/camel-test-infra-iggy/src/main/java/org/apache/camel/test/infra/iggy/services/IggyServiceFactory.java @@ -17,8 +17,36 @@ package org.apache.camel.test.infra.iggy.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class IggyServiceFactory { + + private static class SingletonIggyService extends SingletonService implements IggyService { + public SingletonIggyService(IggyService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String username() { + return getService().username(); + } + + @Override + public String password() { + return getService().password(); + } + } + private IggyServiceFactory() { } @@ -34,6 +62,21 @@ public static IggyService createService() { .build(); } + public static IggyService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final IggyService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonIggyService(new IggyLocalContainerService(), "iggy")) + .addRemoteMapping(IggyRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class IggyRemoteService extends IggyRemoteInfraService implements IggyService { } diff --git a/test-infra/camel-test-infra-ignite/src/main/java/org/apache/camel/test/infra/ignite/services/IgniteServiceFactory.java b/test-infra/camel-test-infra-ignite/src/main/java/org/apache/camel/test/infra/ignite/services/IgniteServiceFactory.java index 68addd52e597d..04f3d6eb85a62 100644 --- a/test-infra/camel-test-infra-ignite/src/main/java/org/apache/camel/test/infra/ignite/services/IgniteServiceFactory.java +++ b/test-infra/camel-test-infra-ignite/src/main/java/org/apache/camel/test/infra/ignite/services/IgniteServiceFactory.java @@ -17,9 +17,22 @@ package org.apache.camel.test.infra.ignite.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; +import org.apache.ignite.configuration.IgniteConfiguration; public final class IgniteServiceFactory { + private static class SingletonIgniteService extends SingletonService implements IgniteService { + public SingletonIgniteService(IgniteService service, String name) { + super(service, name); + } + + @Override + public IgniteConfiguration createConfiguration() { + return getService().createConfiguration(); + } + } + private IgniteServiceFactory() { } @@ -34,6 +47,20 @@ public static IgniteService createService() { .build(); } + public static IgniteService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final IgniteService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonIgniteService(new IgniteEmbeddedService(), "ignite")); + INSTANCE = instance.build(); + } + } + public static class IgniteEmbeddedService extends IgniteEmbeddedInfraService implements IgniteService { } } diff --git a/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakServiceFactory.java b/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakServiceFactory.java index 526c5e5f61de3..d97224e56f0d0 100644 --- a/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakServiceFactory.java +++ b/test-infra/camel-test-infra-keycloak/src/main/java/org/apache/camel/test/infra/keycloak/services/KeycloakServiceFactory.java @@ -17,8 +17,42 @@ package org.apache.camel.test.infra.keycloak.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; +import org.keycloak.admin.client.Keycloak; public final class KeycloakServiceFactory { + + private static class SingletonKeycloakService extends SingletonService implements KeycloakService { + public SingletonKeycloakService(KeycloakService service, String name) { + super(service, name); + } + + @Override + public String getKeycloakServerUrl() { + return getService().getKeycloakServerUrl(); + } + + @Override + public String getKeycloakRealm() { + return getService().getKeycloakRealm(); + } + + @Override + public String getKeycloakUsername() { + return getService().getKeycloakUsername(); + } + + @Override + public String getKeycloakPassword() { + return getService().getKeycloakPassword(); + } + + @Override + public Keycloak getKeycloakAdminClient() { + return getService().getKeycloakAdminClient(); + } + } + private KeycloakServiceFactory() { } @@ -33,6 +67,20 @@ public static KeycloakService createService() { .build(); } + public static KeycloakService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final KeycloakService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonKeycloakService(new KeycloakLocalContainerService(), "keycloak")); + INSTANCE = instance.build(); + } + } + public static class KeycloakLocalContainerService extends KeycloakLocalContainerInfraService implements KeycloakService { } diff --git a/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingServiceFactory.java b/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingServiceFactory.java index 597b46d53c204..254039c455832 100644 --- a/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingServiceFactory.java +++ b/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingServiceFactory.java @@ -17,9 +17,27 @@ package org.apache.camel.test.infra.mcp.everything.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class McpEverythingServiceFactory { + private static class SingletonMcpEverythingService extends SingletonService + implements McpEverythingService { + public SingletonMcpEverythingService(McpEverythingService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private McpEverythingServiceFactory() { } @@ -33,6 +51,20 @@ public static McpEverythingService createService() { .build(); } + public static McpEverythingService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final McpEverythingService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonMcpEverythingService(new McpEverythingLocalContainerService(), "mcp-everything")); + INSTANCE = instance.build(); + } + } + public static class McpEverythingLocalContainerService extends McpEverythingLocalContainerInfraService implements McpEverythingService { } diff --git a/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingSseServiceFactory.java b/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingSseServiceFactory.java index a8bca0e5e018d..c3bdd07628f99 100644 --- a/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingSseServiceFactory.java +++ b/test-infra/camel-test-infra-mcp-everything/src/main/java/org/apache/camel/test/infra/mcp/everything/services/McpEverythingSseServiceFactory.java @@ -17,9 +17,27 @@ package org.apache.camel.test.infra.mcp.everything.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class McpEverythingSseServiceFactory { + private static class SingletonMcpEverythingSseService extends SingletonService + implements McpEverythingSseService { + public SingletonMcpEverythingSseService(McpEverythingSseService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private McpEverythingSseServiceFactory() { } @@ -33,6 +51,22 @@ public static McpEverythingSseService createService() { .build(); } + public static McpEverythingSseService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final McpEverythingSseService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonMcpEverythingSseService( + new McpEverythingSseLocalContainerService(), + "mcp-everything-sse")); + INSTANCE = instance.build(); + } + } + public static class McpEverythingSseLocalContainerService extends McpEverythingSseLocalContainerInfraService implements McpEverythingSseService { } diff --git a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRAServiceFactory.java b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRAServiceFactory.java index dce1211eccd37..4d808fccfaf7e 100644 --- a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRAServiceFactory.java +++ b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRAServiceFactory.java @@ -17,8 +17,32 @@ package org.apache.camel.test.infra.microprofile.lra.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class MicroprofileLRAServiceFactory { + + private static class SingletonMicroprofileLRAService extends SingletonService + implements MicroprofileLRAService { + public SingletonMicroprofileLRAService(MicroprofileLRAService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String callbackHost() { + return getService().callbackHost(); + } + } + private MicroprofileLRAServiceFactory() { } @@ -34,6 +58,23 @@ public static MicroprofileLRAService createService() { .build(); } + public static MicroprofileLRAService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final MicroprofileLRAService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonMicroprofileLRAService( + new MicroprofileLRALocalContainerService(), + "microprofile-lra")) + .addRemoteMapping(MicroprofileLRARemoteService::new); + INSTANCE = instance.build(); + } + } + public static class MicroprofileLRALocalContainerService extends MicroprofileLRALocalContainerInfraService implements MicroprofileLRAService { } diff --git a/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java b/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java index ed25e600c9e8d..1ed85dc0c28d4 100644 --- a/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java +++ b/test-infra/camel-test-infra-minio/src/main/java/org/apache/camel/test/infra/minio/services/MinioServiceFactory.java @@ -17,8 +17,51 @@ package org.apache.camel.test.infra.minio.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class MinioServiceFactory { + + private static class SingletonMinioService extends SingletonService implements MinioService { + public SingletonMinioService(MinioService service, String name) { + super(service, name); + } + + @Override + public String secretKey() { + return getService().secretKey(); + } + + @Override + public String accessKey() { + return getService().accessKey(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int consolePort() { + return getService().consolePort(); + } + + @Override + public String consoleUsername() { + return getService().consoleUsername(); + } + + @Override + public String consolePassword() { + return getService().consolePassword(); + } + } + private MinioServiceFactory() { } @@ -34,6 +77,21 @@ public static MinioService createService() { .build(); } + public static MinioService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final MinioService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonMinioService(new MinioLocalContainerService(), "minio")) + .addRemoteMapping(MinioRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class MinioLocalContainerService extends MinioLocalContainerInfraService implements MinioService { } diff --git a/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoServiceFactory.java b/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoServiceFactory.java index d8d85c9190b23..0e51be0dda13b 100644 --- a/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoServiceFactory.java +++ b/test-infra/camel-test-infra-mosquitto/src/main/java/org/apache/camel/test/infra/mosquitto/services/MosquittoServiceFactory.java @@ -17,8 +17,21 @@ package org.apache.camel.test.infra.mosquitto.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class MosquittoServiceFactory { + + private static class SingletonMosquittoService extends SingletonService implements MosquittoService { + public SingletonMosquittoService(MosquittoService service, String name) { + super(service, name); + } + + @Override + public Integer getPort() { + return getService().getPort(); + } + } + private MosquittoServiceFactory() { } @@ -34,4 +47,18 @@ public static MosquittoService createService() { .build(); } + public static MosquittoService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final MosquittoService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonMosquittoService(new MosquittoLocalContainerService(), "mosquitto")) + .addRemoteMapping(MosquittoRemoteService::new); + INSTANCE = instance.build(); + } + } } diff --git a/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsServiceFactory.java b/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsServiceFactory.java index ae2ea32d1005e..29c445b60c939 100644 --- a/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsServiceFactory.java +++ b/test-infra/camel-test-infra-nats/src/main/java/org/apache/camel/test/infra/nats/services/NatsServiceFactory.java @@ -17,8 +17,21 @@ package org.apache.camel.test.infra.nats.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class NatsServiceFactory { + + private static class SingletonNatsService extends SingletonService implements NatsService { + public SingletonNatsService(NatsService service, String name) { + super(service, name); + } + + @Override + public String getServiceAddress() { + return getService().getServiceAddress(); + } + } + private NatsServiceFactory() { } @@ -33,6 +46,21 @@ public static NatsService createService() { .build(); } + public static NatsService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final NatsService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonNatsService(new NatsLocalContainerService(), "nats")) + .addRemoteMapping(NatsRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class NatsRemoteService extends NatsRemoteInfraService implements NatsService { } } diff --git a/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenldapServiceFactory.java b/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenldapServiceFactory.java index 1938b40548fa4..65f58acf505b9 100644 --- a/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenldapServiceFactory.java +++ b/test-infra/camel-test-infra-openldap/src/main/java/org/apache/camel/test/infra/openldap/services/OpenldapServiceFactory.java @@ -17,8 +17,31 @@ package org.apache.camel.test.infra.openldap.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class OpenldapServiceFactory { + + private static class SingletonOpenldapService extends SingletonService implements OpenldapService { + public SingletonOpenldapService(OpenldapService service, String name) { + super(service, name); + } + + @Override + public Integer getPort() { + return getService().getPort(); + } + + @Override + public Integer getSslPort() { + return getService().getSslPort(); + } + + @Override + public String getHost() { + return getService().getHost(); + } + } + private OpenldapServiceFactory() { } @@ -34,6 +57,21 @@ public static OpenldapService createService() { .build(); } + public static OpenldapService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final OpenldapService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonOpenldapService(new OpenldapLocalContainerService(), "openldap")) + .addRemoteMapping(OpenldapRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class OpenldapLocalContainerService extends OpenldapLocalContainerInfraService implements OpenldapService { } diff --git a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresServiceFactory.java b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresServiceFactory.java index e442ab10cc58f..3d636efe84db9 100644 --- a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresServiceFactory.java +++ b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresServiceFactory.java @@ -17,9 +17,41 @@ package org.apache.camel.test.infra.postgres.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class PostgresServiceFactory { + private static class SingletonPostgresService extends SingletonService implements PostgresService { + public SingletonPostgresService(PostgresService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String userName() { + return getService().userName(); + } + + @Override + public String password() { + return getService().password(); + } + + @Override + public String getServiceAddress() { + return getService().getServiceAddress(); + } + } + private PostgresServiceFactory() { } @@ -33,6 +65,21 @@ public static PostgresService createService() { .build(); } + public static PostgresService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final PostgresService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonPostgresService(new PostgresLocalContainerService(), "postgres")) + .addRemoteMapping(PostgresRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class PostgresRemoteService extends PostgresRemoteInfraService implements PostgresService { } } diff --git a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java index d0084ea879241..0cc8f47f062a6 100644 --- a/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java +++ b/test-infra/camel-test-infra-postgres/src/main/java/org/apache/camel/test/infra/postgres/services/PostgresVectorServiceFactory.java @@ -17,9 +17,41 @@ package org.apache.camel.test.infra.postgres.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class PostgresVectorServiceFactory { + private static class SingletonPostgresVectorService extends SingletonService implements PostgresService { + public SingletonPostgresVectorService(PostgresService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String userName() { + return getService().userName(); + } + + @Override + public String password() { + return getService().password(); + } + + @Override + public String getServiceAddress() { + return getService().getServiceAddress(); + } + } + private PostgresVectorServiceFactory() { } @@ -32,4 +64,19 @@ public static PostgresService createService() { .addRemoteMapping(PostgresServiceFactory.PostgresRemoteService::new) .build(); } + + public static PostgresService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final PostgresService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonPostgresVectorService(new PostgresVectorLocalContainerService(), "postgres-vector")) + .addRemoteMapping(PostgresServiceFactory.PostgresRemoteService::new); + INSTANCE = instance.build(); + } + } } diff --git a/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQServiceFactory.java b/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQServiceFactory.java index 97a6ad9da8867..77e73c7f8b8b3 100644 --- a/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQServiceFactory.java +++ b/test-infra/camel-test-infra-rabbitmq/src/main/java/org/apache/camel/test/infra/rabbitmq/services/RabbitMQServiceFactory.java @@ -18,8 +18,41 @@ package org.apache.camel.test.infra.rabbitmq.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class RabbitMQServiceFactory { + + private static class SingletonRabbitMQService extends SingletonService implements RabbitMQService { + public SingletonRabbitMQService(RabbitMQService service, String name) { + super(service, name); + } + + @Override + public ConnectionProperties connectionProperties() { + return getService().connectionProperties(); + } + + @Override + public int getHttpPort() { + return getService().getHttpPort(); + } + + @Override + public String managementUsername() { + return getService().managementUsername(); + } + + @Override + public String managementPassword() { + return getService().managementPassword(); + } + + @Override + public String managementUri() { + return getService().managementUri(); + } + } + private RabbitMQServiceFactory() { } @@ -35,6 +68,21 @@ public static RabbitMQService createService() { .build(); } + public static RabbitMQService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final RabbitMQService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonRabbitMQService(new RabbitMQLocalContainerService(), "rabbitmq")) + .addRemoteMapping(RabbitMQRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class RabbitMQLocalContainerService extends RabbitMQLocalContainerInfraService implements RabbitMQService { } diff --git a/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisServiceFactory.java b/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisServiceFactory.java index e27c3842d4f7a..e6b90e3469f90 100644 --- a/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisServiceFactory.java +++ b/test-infra/camel-test-infra-redis/src/main/java/org/apache/camel/test/infra/redis/services/RedisServiceFactory.java @@ -17,8 +17,26 @@ package org.apache.camel.test.infra.redis.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class RedisServiceFactory { + + private static class SingletonRedisService extends SingletonService implements RedisService { + public SingletonRedisService(RedisService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + } + private RedisServiceFactory() { } @@ -34,6 +52,21 @@ public static RedisService createService() { .build(); } + public static RedisService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final RedisService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonRedisService(new RedisLocalContainerService(), "redis")) + .addRemoteMapping(RedisRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class RedisRemoteService extends RedisRemoteInfraService implements RedisService { } diff --git a/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrServiceFactory.java b/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrServiceFactory.java index d79388ea0c2fe..0e29c8e2846fb 100644 --- a/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrServiceFactory.java +++ b/test-infra/camel-test-infra-solr/src/main/java/org/apache/camel/test/infra/solr/services/SolrServiceFactory.java @@ -17,8 +17,26 @@ package org.apache.camel.test.infra.solr.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class SolrServiceFactory { + + private static class SingletonSolrService extends SingletonService implements SolrService { + public SingletonSolrService(SolrService service, String name) { + super(service, name); + } + + @Override + public int getPort() { + return getService().getPort(); + } + + @Override + public String getSolrHost() { + return getService().getSolrHost(); + } + } + private SolrServiceFactory() { } @@ -34,6 +52,21 @@ public static SolrService createService() { .build(); } + public static SolrService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final SolrService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonSolrService(new SolrLocalContainerService(), SolrContainer.CONTAINER_NAME)) + .addRemoteMapping(SolrRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class SolrRemoteService extends SolrRemoteInfraService implements SolrService { } diff --git a/test-infra/camel-test-infra-tensorflow-serving/src/main/java/org/apache/camel/test/infra/tensorflow/serving/services/TensorFlowServingServiceFactory.java b/test-infra/camel-test-infra-tensorflow-serving/src/main/java/org/apache/camel/test/infra/tensorflow/serving/services/TensorFlowServingServiceFactory.java index b1689e835ab63..0dfd8f1fff549 100644 --- a/test-infra/camel-test-infra-tensorflow-serving/src/main/java/org/apache/camel/test/infra/tensorflow/serving/services/TensorFlowServingServiceFactory.java +++ b/test-infra/camel-test-infra-tensorflow-serving/src/main/java/org/apache/camel/test/infra/tensorflow/serving/services/TensorFlowServingServiceFactory.java @@ -17,8 +17,27 @@ package org.apache.camel.test.infra.tensorflow.serving.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class TensorFlowServingServiceFactory { + + private static class SingletonTensorFlowServingService extends SingletonService + implements TensorFlowServingService { + public SingletonTensorFlowServingService(TensorFlowServingService service, String name) { + super(service, name); + } + + @Override + public int grpcPort() { + return getService().grpcPort(); + } + + @Override + public int restPort() { + return getService().restPort(); + } + } + private TensorFlowServingServiceFactory() { } @@ -32,4 +51,21 @@ public static TensorFlowServingService createService() { .addRemoteMapping(TensorFlowServingRemoteService::new) .build(); } + + public static TensorFlowServingService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final TensorFlowServingService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonTensorFlowServingService( + new TensorFlowServingLocalContainerService(), + "tensorflow-serving")) + .addRemoteMapping(TensorFlowServingRemoteService::new); + INSTANCE = instance.build(); + } + } } diff --git a/test-infra/camel-test-infra-triton/src/main/java/org/apache/camel/test/infra/triton/services/TritonServiceFactory.java b/test-infra/camel-test-infra-triton/src/main/java/org/apache/camel/test/infra/triton/services/TritonServiceFactory.java index 9544f91765743..c2fced13be8ce 100644 --- a/test-infra/camel-test-infra-triton/src/main/java/org/apache/camel/test/infra/triton/services/TritonServiceFactory.java +++ b/test-infra/camel-test-infra-triton/src/main/java/org/apache/camel/test/infra/triton/services/TritonServiceFactory.java @@ -17,8 +17,31 @@ package org.apache.camel.test.infra.triton.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class TritonServiceFactory { + + private static class SingletonTritonService extends SingletonService implements TritonService { + public SingletonTritonService(TritonService service, String name) { + super(service, name); + } + + @Override + public int httpPort() { + return getService().httpPort(); + } + + @Override + public int grpcPort() { + return getService().grpcPort(); + } + + @Override + public int metricsPort() { + return getService().metricsPort(); + } + } + private TritonServiceFactory() { } @@ -33,6 +56,21 @@ public static TritonService createService() { .build(); } + public static TritonService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final TritonService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonTritonService(new TritonLocalContainerService(), "triton")) + .addRemoteMapping(TritonRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class TritonLocalContainerService extends TritonLocalContainerInfraService implements TritonService { } diff --git a/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServiceFactory.java b/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServiceFactory.java index 89339aeda5949..d62a23f460568 100644 --- a/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServiceFactory.java +++ b/test-infra/camel-test-infra-xmpp/src/main/java/org/apache/camel/test/infra/xmpp/services/XmppServiceFactory.java @@ -17,8 +17,31 @@ package org.apache.camel.test.infra.xmpp.services; import org.apache.camel.test.infra.common.services.SimpleTestServiceBuilder; +import org.apache.camel.test.infra.common.services.SingletonService; public final class XmppServiceFactory { + + private static class SingletonXmppService extends SingletonService implements XmppService { + public SingletonXmppService(XmppService service, String name) { + super(service, name); + } + + @Override + public String host() { + return getService().host(); + } + + @Override + public int port() { + return getService().port(); + } + + @Override + public String getUrl() { + return getService().getUrl(); + } + } + private XmppServiceFactory() { } @@ -34,6 +57,21 @@ public static XmppService createService() { .build(); } + public static XmppService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final XmppService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonXmppService(new XmppLocalContainerService(), "xmpp")) + .addRemoteMapping(XmppRemoteService::new); + INSTANCE = instance.build(); + } + } + public static class XmppLocalContainerService extends XmppLocalContainerInfraService implements XmppService { } diff --git a/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperServiceFactory.java b/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperServiceFactory.java index 16c1084060f95..e1714ded9e4ea 100644 --- a/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperServiceFactory.java +++ b/test-infra/camel-test-infra-zookeeper/src/main/java/org/apache/camel/test/infra/zookeeper/services/ZooKeeperServiceFactory.java @@ -47,6 +47,21 @@ public static ZooKeeperService createService() { .addRemoteMapping(ZooKeeperRemoteService::new) .build(); } + + public static ZooKeeperService createSingletonService() { + return SingletonServiceHolder.INSTANCE; + } + + private static class SingletonServiceHolder { + static final ZooKeeperService INSTANCE; + static { + SimpleTestServiceBuilder instance = builder(); + instance.addLocalMapping( + () -> new SingletonZooKeeperService(new ZooKeeperLocalContainerService(), "zookeeper")) + .addRemoteMapping(ZooKeeperRemoteService::new); + INSTANCE = instance.build(); + } + } } class ZooKeeperLocalContainerService extends ZooKeeperLocalContainerInfraService From 7ced72a6a7421fc8411bf21e11c8056248a647d7 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 27 Mar 2026 23:14:57 +0100 Subject: [PATCH 3/3] Migrate all test classes from createService() to createSingletonService() Migrate every test class that used createService() to use createSingletonService(). Tests that needed isolation fixes: - Google PubSub: catch AlreadyExistsException for reruns + unique topic names for conflicting test pairs (DeadLetterIT/MessageOrderingIT, CustomSerializerIT/BodyTypesIT, SingleExchangeRound*IT) - Hashicorp Vault: secretPath() helper using getClass().getSimpleName() for per-class secret path isolation - Spring-RabbitMQ: uniqueName() helper for exchange/queue names - LRA: delta-tolerant assertions for shared coordinator state - Consul: remove manual initialization (singleton handles lifecycle) 89 test files migrated across 30+ components. Co-Authored-By: Claude Opus 4.6 --- .../component/ChatScriptComponentIT.java | 2 +- .../integration/DoclingITestSupport.java | 2 +- .../docling/integration/OcrExtractionIT.java | 2 +- .../component/kserve/it/KServeITSupport.java | 2 +- .../LangChain4jAgentMcpAndCamelToolsIT.java | 2 +- .../integration/OpenAIMcpAdvancedIT.java | 2 +- .../OpenAIMcpConversationStoreIT.java | 2 +- .../OpenAIMcpManualToolLoopIT.java | 2 +- .../openai/integration/OpenAIMcpToolsIT.java | 2 +- .../it/TensorFlowServingITSupport.java | 2 +- .../arangodb/integration/BaseArangoDb.java | 2 +- .../azure/storage/blob/integration/Base.java | 2 +- .../storage/datalake/integration/Base.java | 2 +- .../queue/integration/StorageQueueBase.java | 2 +- .../component/consul/ConsulHealthIT.java | 12 ++---- .../component/consul/ConsulRegistryIT.java | 2 +- .../component/consul/ConsulTestSupport.java | 2 +- .../consul/cluster/ConsulClusterViewIT.java | 2 +- .../ConsulClusteredRoutePolicyFactoryIT.java | 2 +- .../cluster/ConsulClusteredRoutePolicyIT.java | 2 +- .../consul/cluster/ConsulMasterIT.java | 2 +- .../google/pubsub/PubsubTestSupport.java | 18 +++++---- .../integration/CustomSerializerIT.java | 4 +- .../pubsub/integration/DeadLetterIT.java | 12 +++--- .../SingleExchangeRoundAllHeadersIT.java | 4 +- ...icorpVaultPropertiesSourceNoEnvTestIT.java | 2 +- ...orpProducerCreateMultiVersionSecretIT.java | 8 ++-- .../HashicorpProducerCreateSecretIT.java | 12 +++--- .../HashicorpProducerCreateSecretPOJOIT.java | 8 ++-- .../HashicorpProducerDeleteSecretIT.java | 9 +++-- .../HashicorpProducerListSecretsIT.java | 13 +++---- ...orpProducerReadMultiVersionedSecretIT.java | 8 ++-- .../HashicorpProducerSecretPathHeaderIT.java | 7 ++-- .../operations/HashicorpVaultBase.java | 6 ++- .../hazelcast/HazelcastConfigurationTest.java | 2 +- .../hazelcast/HazelcastListProducerTest.java | 2 +- .../HazelcastSedaTransferExchangeTest.java | 2 +- .../hazelcast/HazelcastSetProducerTest.java | 2 +- .../policy/HazelcastRoutePolicyIT.java | 2 +- ...AggregationRepositoryCamelTestSupport.java | 2 +- .../HazelcastIdempotentRepositoryTest.java | 2 +- .../camel/component/iggy/IggyTestBase.java | 2 +- .../component/jms/JmsComponentIbmMQTest.java | 2 +- .../jms/issues/JmsReplyToIbmMQTest.java | 2 +- .../BaseExclusiveKafkaTestSupport.java | 2 +- .../keycloak/KeycloakConsumerIT.java | 2 +- .../keycloak/KeycloakTestInfraIT.java | 2 +- .../security/KeycloakSecurityTestInfraIT.java | 2 +- .../KeycloakTokenBindingSecurityIT.java | 2 +- .../KeycloakTokenIntrospectionIT.java | 2 +- .../camel/component/ldif/LdifTestSupport.java | 2 +- .../MinioIntegrationTestSupport.java | 2 +- .../integration/AbstractMongoDbITSupport.java | 2 +- .../nats/integration/NatsITSupport.java | 2 +- .../mqtt5/integration/PahoMqtt5ITSupport.java | 2 +- .../pqc/HashicorpVaultKeyLifecycleIT.java | 2 +- .../integration/AggregateRedisIT.java | 2 +- .../solr/integration/SolrTestSupport.java | 2 +- .../springai/chat/SpringAiChatMcpSseIT.java | 2 +- .../integration/RabbitMQBasicIT.java | 10 +++-- .../RabbitMQComponentNullBodyIT.java | 6 +-- .../integration/RabbitMQConsumerIT.java | 4 +- .../RabbitMQConsumerPooledExchangeIT.java | 4 +- .../integration/RabbitMQConsumerQueuesIT.java | 4 +- .../RabbitMQConsumerRoutingKeyIT.java | 4 +- .../integration/RabbitMQConsumerTopicIT.java | 5 ++- .../integration/RabbitMQITSupport.java | 6 ++- .../integration/RabbitMQInOutIT.java | 5 ++- .../RabbitMQPollingConsumerIT.java | 28 +++++++++----- .../RabbitMQProducerAutoDeclareIT.java | 12 +++--- .../integration/RabbitMQProducerIT.java | 38 +++++++++---------- .../RabbitMQProducerInvalidExchangeIT.java | 6 +-- .../RabbitMQProducerNullBodyIT.java | 6 +-- .../integration/RabbitMQProducerSimpleIT.java | 2 +- .../integration/RabbitMQProducerToDIT.java | 16 ++++---- .../integration/RedisConsumerManualIT.java | 2 +- .../integration/RedisProducerManualIT.java | 2 +- .../xmpp/integration/XmppBaseIT.java | 2 +- .../zookeepermaster/MasterEndpointIT.java | 2 +- .../MasterQuartzEndpointIT.java | 2 +- .../zookeepermaster/group/GroupIT.java | 2 +- .../integration/MasterEndpointFailoverIT.java | 2 +- ...ooKeeperClusteredRoutePolicyFactoryIT.java | 2 +- .../ZooKeeperClusteredRoutePolicyIT.java | 2 +- .../integration/ZooKeeperMasterIT.java | 2 +- .../integration/ZooKeeperITSupport.java | 2 +- .../jbang/it/support/JBangTestSupport.java | 2 +- 87 files changed, 211 insertions(+), 182 deletions(-) diff --git a/components/camel-ai/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java b/components/camel-ai/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java index 80cb589677ec1..2177388c9bc01 100644 --- a/components/camel-ai/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java +++ b/components/camel-ai/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java @@ -37,7 +37,7 @@ public class ChatScriptComponentIT extends CamelTestSupport { private static final Logger LOG = LoggerFactory.getLogger(ChatScriptComponentIT.class); @RegisterExtension - public static ChatScriptService service = ChatScriptServiceFactory.createService(); + public static ChatScriptService service = ChatScriptServiceFactory.createSingletonService(); @Test public void testChatScript() throws Exception { diff --git a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/DoclingITestSupport.java b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/DoclingITestSupport.java index f593f507ad2ca..046d4e86419e6 100644 --- a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/DoclingITestSupport.java +++ b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/DoclingITestSupport.java @@ -31,7 +31,7 @@ public abstract class DoclingITestSupport extends CamelTestSupport { protected static final Logger LOG = LoggerFactory.getLogger(DoclingITestSupport.class); @RegisterExtension - static DoclingService doclingService = DoclingServiceFactory.createService(); + static DoclingService doclingService = DoclingServiceFactory.createSingletonService(); @Override protected CamelContext createCamelContext() throws Exception { diff --git a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/OcrExtractionIT.java b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/OcrExtractionIT.java index 3aef0fe7d57a5..358626d8cf5e1 100644 --- a/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/OcrExtractionIT.java +++ b/components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/OcrExtractionIT.java @@ -58,7 +58,7 @@ class OcrExtractionIT extends CamelTestSupport { private static final String TEST_TEXT_LINE3 = "OCR Test Document"; @RegisterExtension - static DoclingService doclingService = DoclingServiceFactory.createService(); + static DoclingService doclingService = DoclingServiceFactory.createSingletonService(); @Override protected CamelContext createCamelContext() throws Exception { diff --git a/components/camel-ai/camel-kserve/src/test/java/org/apache/camel/component/kserve/it/KServeITSupport.java b/components/camel-ai/camel-kserve/src/test/java/org/apache/camel/component/kserve/it/KServeITSupport.java index b9585ab800056..68083d5e97547 100644 --- a/components/camel-ai/camel-kserve/src/test/java/org/apache/camel/component/kserve/it/KServeITSupport.java +++ b/components/camel-ai/camel-kserve/src/test/java/org/apache/camel/component/kserve/it/KServeITSupport.java @@ -26,7 +26,7 @@ class KServeITSupport extends CamelTestSupport { @RegisterExtension - static TritonService service = TritonServiceFactory.createService(); + static TritonService service = TritonServiceFactory.createSingletonService(); @Override protected CamelContext createCamelContext() throws Exception { diff --git a/components/camel-ai/camel-langchain4j-agent/src/test/java/org/apache/camel/component/langchain4j/agent/integration/LangChain4jAgentMcpAndCamelToolsIT.java b/components/camel-ai/camel-langchain4j-agent/src/test/java/org/apache/camel/component/langchain4j/agent/integration/LangChain4jAgentMcpAndCamelToolsIT.java index 6f06db05c5faa..14cc87293e172 100644 --- a/components/camel-ai/camel-langchain4j-agent/src/test/java/org/apache/camel/component/langchain4j/agent/integration/LangChain4jAgentMcpAndCamelToolsIT.java +++ b/components/camel-ai/camel-langchain4j-agent/src/test/java/org/apache/camel/component/langchain4j/agent/integration/LangChain4jAgentMcpAndCamelToolsIT.java @@ -75,7 +75,7 @@ public class LangChain4jAgentMcpAndCamelToolsIT extends CamelTestSupport { static OllamaService OLLAMA = OllamaServiceFactory.createSingletonService(); @RegisterExtension - static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService(); + static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService(); @Override protected void setupResources() throws Exception { diff --git a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpAdvancedIT.java b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpAdvancedIT.java index aeaeb75bdfeb5..73ad8a6893cda 100644 --- a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpAdvancedIT.java +++ b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpAdvancedIT.java @@ -51,7 +51,7 @@ public class OpenAIMcpAdvancedIT extends OpenAITestSupport { private static final String MCP_PROTOCOL_VERSIONS = "2024-11-05,2025-03-26,2025-06-18"; @RegisterExtension - static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService(); + static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService(); private String returnDirectEndpointUri; diff --git a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpConversationStoreIT.java b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpConversationStoreIT.java index fcc7762ec91a6..f908b769fbd23 100644 --- a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpConversationStoreIT.java +++ b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpConversationStoreIT.java @@ -57,7 +57,7 @@ public class OpenAIMcpConversationStoreIT extends OpenAITestSupport { private final Map> conversationStore = new ConcurrentHashMap<>(); @RegisterExtension - static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService(); + static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService(); @Override protected RouteBuilder createRouteBuilder() { diff --git a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpManualToolLoopIT.java b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpManualToolLoopIT.java index 2902838d285df..ace1aec5a0489 100644 --- a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpManualToolLoopIT.java +++ b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpManualToolLoopIT.java @@ -51,7 +51,7 @@ public class OpenAIMcpManualToolLoopIT extends OpenAITestSupport { private static final String MCP_PROTOCOL_VERSIONS = "2024-11-05,2025-03-26,2025-06-18"; @RegisterExtension - static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService(); + static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService(); @Override protected RouteBuilder createRouteBuilder() { diff --git a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpToolsIT.java b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpToolsIT.java index b049a3f0679af..10b6a17cb7fe1 100644 --- a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpToolsIT.java +++ b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpToolsIT.java @@ -43,7 +43,7 @@ public class OpenAIMcpToolsIT extends OpenAITestSupport { @RegisterExtension - static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService(); + static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService(); @Override protected RouteBuilder createRouteBuilder() { diff --git a/components/camel-ai/camel-tensorflow-serving/src/test/java/org/apache/camel/component/torchserve/it/TensorFlowServingITSupport.java b/components/camel-ai/camel-tensorflow-serving/src/test/java/org/apache/camel/component/torchserve/it/TensorFlowServingITSupport.java index c7dc00c0da97a..f49181e03addd 100644 --- a/components/camel-ai/camel-tensorflow-serving/src/test/java/org/apache/camel/component/torchserve/it/TensorFlowServingITSupport.java +++ b/components/camel-ai/camel-tensorflow-serving/src/test/java/org/apache/camel/component/torchserve/it/TensorFlowServingITSupport.java @@ -26,7 +26,7 @@ class TensorFlowServingITSupport extends CamelTestSupport { @RegisterExtension - static TensorFlowServingService service = TensorFlowServingServiceFactory.createService(); + static TensorFlowServingService service = TensorFlowServingServiceFactory.createSingletonService(); @Override protected CamelContext createCamelContext() throws Exception { diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java index a45e9344800d2..552e8bff74519 100644 --- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java +++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java @@ -42,7 +42,7 @@ public abstract class BaseArangoDb implements ConfigurableRoute, CamelTestSuppor @Order(1) @RegisterExtension - public static ArangoDBService service = ArangoDBServiceFactory.createService(); + public static ArangoDBService service = ArangoDBServiceFactory.createSingletonService(); @Order(2) @RegisterExtension public static final CamelContextExtension camelContextExtension = new TransientCamelContextExtension(); diff --git a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java index bf8a48149f1bd..d4ed2f8ed60f8 100644 --- a/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java +++ b/components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java @@ -45,7 +45,7 @@ public class Base extends CamelTestSupport { static { initCredentials(); - service = AzureStorageBlobServiceFactory.createService(); + service = AzureStorageBlobServiceFactory.createSingletonService(); } /* diff --git a/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/integration/Base.java b/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/integration/Base.java index 743ec3d053f44..1469fb81f0ed1 100644 --- a/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/integration/Base.java +++ b/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/integration/Base.java @@ -42,7 +42,7 @@ public class Base extends CamelTestSupport { @RegisterExtension - public AzureService service = AzureStorageDataLakeServiceFactory.createService(); + public AzureService service = AzureStorageDataLakeServiceFactory.createSingletonService(); protected DataLakeServiceClient serviceClient; protected DataLakeConfiguration configuration; diff --git a/components/camel-azure/camel-azure-storage-queue/src/test/java/org/apache/camel/component/azure/storage/queue/integration/StorageQueueBase.java b/components/camel-azure/camel-azure-storage-queue/src/test/java/org/apache/camel/component/azure/storage/queue/integration/StorageQueueBase.java index 666e361eeb49d..b6069ed81a6e9 100644 --- a/components/camel-azure/camel-azure-storage-queue/src/test/java/org/apache/camel/component/azure/storage/queue/integration/StorageQueueBase.java +++ b/components/camel-azure/camel-azure-storage-queue/src/test/java/org/apache/camel/component/azure/storage/queue/integration/StorageQueueBase.java @@ -43,7 +43,7 @@ public class StorageQueueBase extends CamelTestSupport { static { initCredentials(); - service = AzureStorageQueueServiceFactory.createService(); + service = AzureStorageQueueServiceFactory.createSingletonService(); } /* diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulHealthIT.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulHealthIT.java index 40e1de3fc4ab6..d7d7965caff60 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulHealthIT.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulHealthIT.java @@ -29,6 +29,7 @@ import org.apache.camel.test.junit6.CamelTestSupport; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import org.kiwiproject.consul.AgentClient; import org.kiwiproject.consul.Consul; import org.kiwiproject.consul.model.agent.ImmutableRegistration; @@ -38,20 +39,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class ConsulHealthIT extends CamelTestSupport { - /* - NOTE: this one is not registered as extension because it requires a different lifecycle. It - needs to be started much earlier than usual, so in this test we take care of handling it. - */ - private ConsulService consulService = ConsulServiceFactory.createService(); + @RegisterExtension + static ConsulService consulService = ConsulServiceFactory.createSingletonService(); private AgentClient client; private List registrations; private String service; - public ConsulHealthIT() { - consulService.initialize(); - } - @BindToRegistry("consul") public ConsulComponent getConsulComponent() { ConsulComponent component = new ConsulComponent(); diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulRegistryIT.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulRegistryIT.java index 559468859bef9..3dda40e897c99 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulRegistryIT.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulRegistryIT.java @@ -39,7 +39,7 @@ */ public class ConsulRegistryIT implements Serializable { @RegisterExtension - public static ConsulService consulService = ConsulServiceFactory.createService(); + public static ConsulService consulService = ConsulServiceFactory.createSingletonService(); private static final long serialVersionUID = -3482971969351609265L; private static ConsulRegistry registry; diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulTestSupport.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulTestSupport.java index 0f79c5773bd2c..35739c723e8c1 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulTestSupport.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/ConsulTestSupport.java @@ -31,7 +31,7 @@ public class ConsulTestSupport extends CamelTestSupport { @RegisterExtension - public static ConsulService service = ConsulServiceFactory.createService(); + public static ConsulService service = ConsulServiceFactory.createSingletonService(); @RegisterExtension @Order(10) diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusterViewIT.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusterViewIT.java index 8889ba8e9cde8..2f8f7dc494c18 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusterViewIT.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusterViewIT.java @@ -30,7 +30,7 @@ public class ConsulClusterViewIT { @RegisterExtension - public static ConsulService service = ConsulServiceFactory.createService(); + public static ConsulService service = ConsulServiceFactory.createSingletonService(); @Test public void getLeaderTest() throws Exception { diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java index 1d74a412a1e59..026a6fb0a34f3 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java @@ -39,7 +39,7 @@ public class ConsulClusteredRoutePolicyFactoryIT { @RegisterExtension - public static ConsulService service = ConsulServiceFactory.createService(); + public static ConsulService service = ConsulServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(ConsulClusteredRoutePolicyFactoryIT.class); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java index c100c90e45583..cd9ce9e59ea4b 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java @@ -39,7 +39,7 @@ public class ConsulClusteredRoutePolicyIT { @RegisterExtension - public static ConsulService service = ConsulServiceFactory.createService(); + public static ConsulService service = ConsulServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(ConsulClusteredRoutePolicyIT.class); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java index 6ce4dc7ce4287..8ab5b02dab657 100644 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java +++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java @@ -38,7 +38,7 @@ public class ConsulMasterIT { @RegisterExtension - public static ConsulService service = ConsulServiceFactory.createService(); + public static ConsulService service = ConsulServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(ConsulMasterIT.class); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); diff --git a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/PubsubTestSupport.java b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/PubsubTestSupport.java index 96624e25b8a4a..abd597d83923a 100644 --- a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/PubsubTestSupport.java +++ b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/PubsubTestSupport.java @@ -48,7 +48,7 @@ public class PubsubTestSupport extends CamelTestSupport { @RegisterExtension - public static GooglePubSubService service = GooglePubSubServiceFactory.createService(); + public static GooglePubSubService service = GooglePubSubServiceFactory.createSingletonService(); public static final String PROJECT_ID; @@ -122,17 +122,21 @@ public void createTopicSubscriptionPair(Topic topic, Subscription subscription) public void createTopic(Topic topic) { TopicAdminClient topicAdminClient = createTopicAdminClient(); - - topicAdminClient.createTopic(topic); - + try { + topicAdminClient.createTopic(topic); + } catch (com.google.api.gax.rpc.AlreadyExistsException e) { + // Topic already exists in shared emulator — safe to ignore + } topicAdminClient.shutdown(); } public void createSubscription(Subscription subscription) { SubscriptionAdminClient subscriptionAdminClient = createSubscriptionAdminClient(); - - subscriptionAdminClient.createSubscription(subscription); - + try { + subscriptionAdminClient.createSubscription(subscription); + } catch (com.google.api.gax.rpc.AlreadyExistsException e) { + // Subscription already exists in shared emulator — safe to ignore + } subscriptionAdminClient.shutdown(); } diff --git a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/CustomSerializerIT.java b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/CustomSerializerIT.java index 7661c5d8e80ea..d3eb548cedd00 100644 --- a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/CustomSerializerIT.java +++ b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/CustomSerializerIT.java @@ -31,8 +31,8 @@ public class CustomSerializerIT extends PubsubTestSupport { - private static final String TOPIC_NAME = "typesSend"; - private static final String SUBSCRIPTION_NAME = "TypesReceive"; + private static final String TOPIC_NAME = "customTypesSend"; + private static final String SUBSCRIPTION_NAME = "customTypesReceive"; @EndpointInject("direct:from") private Endpoint directIn; diff --git a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/DeadLetterIT.java b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/DeadLetterIT.java index 8593254de2069..e905d50457c36 100644 --- a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/DeadLetterIT.java +++ b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/DeadLetterIT.java @@ -34,12 +34,12 @@ public class DeadLetterIT extends PubsubTestSupport { - private static final String INPUT_TOPIC_NAME = "camel.input-topic"; - private static final String INPUT_SUBSCRIPTION_NAME = "camel.input-topic-subscription"; - private static final String OUTPUT_TOPIC_NAME = "camel.output-topic"; - private static final String OUTPUT_SUBSCRIPTION_NAME = "camel.output-topic-subscription"; - private static final String DEAD_LETTER_TOPIC_NAME = "camel.dead-letter-topic"; - private static final String DEAD_LETTER_SUBSCRIPTION_NAME = "camel.dead-letter-topic-subscription"; + private static final String INPUT_TOPIC_NAME = "camel.dl-input-topic"; + private static final String INPUT_SUBSCRIPTION_NAME = "camel.dl-input-topic-subscription"; + private static final String OUTPUT_TOPIC_NAME = "camel.dl-output-topic"; + private static final String OUTPUT_SUBSCRIPTION_NAME = "camel.dl-output-topic-subscription"; + private static final String DEAD_LETTER_TOPIC_NAME = "camel.dl-dead-letter-topic"; + private static final String DEAD_LETTER_SUBSCRIPTION_NAME = "camel.dl-dead-letter-topic-subscription"; private static int count = 1; @EndpointInject("google-pubsub:{{project.id}}:" + INPUT_SUBSCRIPTION_NAME) diff --git a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/SingleExchangeRoundAllHeadersIT.java b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/SingleExchangeRoundAllHeadersIT.java index 1528831233e65..68f81b15425ef 100644 --- a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/SingleExchangeRoundAllHeadersIT.java +++ b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/SingleExchangeRoundAllHeadersIT.java @@ -36,8 +36,8 @@ public class SingleExchangeRoundAllHeadersIT extends PubsubTestSupport { - private static final String TOPIC_NAME = "singleSend"; - private static final String SUBSCRIPTION_NAME = "singleReceive"; + private static final String TOPIC_NAME = "singleAllHeadersSend"; + private static final String SUBSCRIPTION_NAME = "singleAllHeadersReceive"; @EndpointInject("direct:from") private Endpoint directIn; diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java index dfbfc32c0e43d..4239154a9015b 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java @@ -39,7 +39,7 @@ public class HashicorpVaultPropertiesSourceNoEnvTestIT extends CamelTestSupport { @RegisterExtension - public static HashicorpVaultService service = HashicorpServiceFactory.createService(); + public static HashicorpVaultService service = HashicorpServiceFactory.createSingletonService(); @BeforeAll public static void init() { diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateMultiVersionSecretIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateMultiVersionSecretIT.java index ab29ef13d5f87..7702cb6821be5 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateMultiVersionSecretIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateMultiVersionSecretIT.java @@ -63,7 +63,8 @@ public void process(Exchange exchange) { exchange = template.request("direct:readSecret", new Processor() { @Override public void process(Exchange exchange) { - exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, "test"); + exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, + secretPath()); } }); @@ -76,12 +77,13 @@ public void process(Exchange exchange) { @Override protected RouteBuilder createRouteBuilder() { + final String path = secretPath(); return new RouteBuilder() { @Override public void configure() { from("direct:createSecret") - .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-write"); from("direct:readSecret") diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretIT.java index 02d2a0b20323e..a2e68ba7a6ec8 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretIT.java @@ -59,7 +59,8 @@ public void process(Exchange exchange) { template.request("direct:readSecret", new Processor() { @Override public void process(Exchange exchange) { - exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, "test"); + exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, + secretPath()); } }); template.request("direct:readSecretWithPathParam", null); @@ -83,12 +84,13 @@ public void process(Exchange exchange) { @Override protected RouteBuilder createRouteBuilder() { + final String path = secretPath(); return new RouteBuilder() { @Override public void configure() { from("direct:createSecret") - .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-write"); from("direct:readSecret") @@ -97,8 +99,8 @@ public void configure() { .to("mock:result-read"); from("direct:readSecretWithPathParam") - .toF("hashicorp-vault://secret?operation=getSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=getSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-read-with-param"); } }; diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretPOJOIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretPOJOIT.java index 030d11a7073ba..2fe3a35f827d0 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretPOJOIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerCreateSecretPOJOIT.java @@ -55,7 +55,8 @@ public void process(Exchange exchange) { exchange = template.request("direct:readSecret", new Processor() { @Override public void process(Exchange exchange) { - exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, "test"); + exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, + secretPath()); } }); @@ -68,12 +69,13 @@ public void process(Exchange exchange) { @Override protected RouteBuilder createRouteBuilder() { + final String path = secretPath(); return new RouteBuilder() { @Override public void configure() { from("direct:createSecret") - .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-write"); from("direct:readSecret") .toF("hashicorp-vault://secret?operation=getSecret&token=RAW(%s)&host=%s&port=%s&scheme=http", diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerDeleteSecretIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerDeleteSecretIT.java index d6f7a3ea2cc5f..38a1820e4b5e5 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerDeleteSecretIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerDeleteSecretIT.java @@ -58,17 +58,18 @@ public void process(Exchange exchange) { @Override protected RouteBuilder createRouteBuilder() { + final String path = secretPath(); return new RouteBuilder() { @Override public void configure() { from("direct:createSecret") - .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-write"); from("direct:deleteSecret") - .toF("hashicorp-vault://secret?operation=deleteSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=deleteSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-delete"); } }; diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerListSecretsIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerListSecretsIT.java index 805fde711b20f..c2105a7bff6cf 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerListSecretsIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerListSecretsIT.java @@ -27,7 +27,6 @@ import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -69,23 +68,23 @@ public void process(Exchange exchange) { MockEndpoint.assertIsSatisfied(context); Exchange ret = mockRead.getExchanges().get(0); assertNotNull(ret); - assertTrue(ret.getMessage().getBody(List.class).contains("test")); - assertEquals(1, ret.getMessage().getBody(List.class).size()); + assertTrue(ret.getMessage().getBody(List.class).contains(secretPath())); } @Override protected RouteBuilder createRouteBuilder() { + final String path = secretPath(); return new RouteBuilder() { @Override public void configure() { from("direct:createSecret") - .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-write"); from("direct:listSecrets") - .toF("hashicorp-vault://secret?operation=listSecrets&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=listSecrets&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-list"); } }; diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerReadMultiVersionedSecretIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerReadMultiVersionedSecretIT.java index 4cedda7af0dc7..03e8a7e6b7396 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerReadMultiVersionedSecretIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerReadMultiVersionedSecretIT.java @@ -63,7 +63,8 @@ public void process(Exchange exchange) { exchange = template.request("direct:readSecret", new Processor() { @Override public void process(Exchange exchange) { - exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, "test"); + exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, + secretPath()); exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_VERSION, "1"); } }); @@ -77,12 +78,13 @@ public void process(Exchange exchange) { @Override protected RouteBuilder createRouteBuilder() { + final String path = secretPath(); return new RouteBuilder() { @Override public void configure() { from("direct:createSecret") - .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=test", - service.token(), service.host(), service.port()) + .toF("hashicorp-vault://secret?operation=createSecret&token=RAW(%s)&host=%s&port=%s&scheme=http&secretPath=%s", + service.token(), service.host(), service.port(), path) .to("mock:result-write"); from("direct:readSecret") diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerSecretPathHeaderIT.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerSecretPathHeaderIT.java index 818af00b396b2..d4064636c2ce7 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerSecretPathHeaderIT.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpProducerSecretPathHeaderIT.java @@ -52,20 +52,21 @@ public void secretPathHeaderTest() throws InterruptedException { @Override public void process(Exchange exchange) { Message message = exchange.getMessage(); - message.setHeader(SECRET_PATH, "test"); + message.setHeader(SECRET_PATH, secretPath()); exchange.getMessage().setBody(Map.of("integer", "30")); } }); template.request("direct:readSecret", new Processor() { @Override public void process(Exchange exchange) { - exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, "test"); + exchange.getMessage().setHeader(HashicorpVaultConstants.SECRET_PATH, + secretPath()); } }); template.request("direct:deleteSecret", new Processor() { @Override public void process(Exchange exchange) { - exchange.getMessage().setHeader(SECRET_PATH, "test"); + exchange.getMessage().setHeader(SECRET_PATH, secretPath()); } }); diff --git a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpVaultBase.java b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpVaultBase.java index d5b97a156d5b7..fa7c738874b60 100644 --- a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpVaultBase.java +++ b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/operations/HashicorpVaultBase.java @@ -24,11 +24,15 @@ public class HashicorpVaultBase extends CamelTestSupport { @RegisterExtension - public static HashicorpVaultService service = HashicorpServiceFactory.createService(); + public static HashicorpVaultService service = HashicorpServiceFactory.createSingletonService(); @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); return context; } + + protected String secretPath() { + return getClass().getSimpleName() + "-test"; + } } diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java index 97b288fcf9274..bb801026063d2 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java @@ -45,7 +45,7 @@ class HazelcastConfigurationTest { @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); @RegisterExtension public static TestEntityNameGenerator nameGenerator = new TestEntityNameGenerator(); diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java index 6e0fa70e5005b..c89c653ffc2fd 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java @@ -43,7 +43,7 @@ public class HazelcastListProducerTest extends CamelTestSupport { @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); @RegisterExtension public static TestEntityNameGenerator nameGenerator = new TestEntityNameGenerator(); diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaTransferExchangeTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaTransferExchangeTest.java index 39b57e5c73bf9..df51b1e44bc6a 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaTransferExchangeTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaTransferExchangeTest.java @@ -38,7 +38,7 @@ public class HazelcastSedaTransferExchangeTest extends CamelTestSupport { @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); @RegisterExtension public static TestEntityNameGenerator nameGenerator = new TestEntityNameGenerator(); diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetProducerTest.java index f59fab144360c..7104d6928fab7 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetProducerTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSetProducerTest.java @@ -45,7 +45,7 @@ public class HazelcastSetProducerTest extends CamelTestSupport { @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); @RegisterExtension public static TestEntityNameGenerator nameGenerator = new TestEntityNameGenerator(); diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java index 05ae33a243ba2..e42ce33566ce7 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java @@ -47,7 +47,7 @@ public class HazelcastRoutePolicyIT { private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastRoutePolicyIT.class); @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); private static final List RESULTS = new ArrayList<>(); diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepositoryCamelTestSupport.java b/components/camel-hazelcast/src/test/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepositoryCamelTestSupport.java index 0be8909a8eca9..5c0329211accf 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepositoryCamelTestSupport.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/processor/aggregate/hazelcast/HazelcastAggregationRepositoryCamelTestSupport.java @@ -31,7 +31,7 @@ public class HazelcastAggregationRepositoryCamelTestSupport extends CamelTestSupport { @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); @RegisterExtension public static TestEntityNameGenerator nameGenerator = new TestEntityNameGenerator(); diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java index d6cd227dbabc8..ed497f56c1efb 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java @@ -41,7 +41,7 @@ public class HazelcastIdempotentRepositoryTest extends CamelTestSupport { @RegisterExtension - public static HazelcastService hazelcastService = HazelcastServiceFactory.createService(); + public static HazelcastService hazelcastService = HazelcastServiceFactory.createSingletonService(); @RegisterExtension public static TestEntityNameGenerator nameGenerator = new TestEntityNameGenerator(); diff --git a/components/camel-iggy/src/test/java/org/apache/camel/component/iggy/IggyTestBase.java b/components/camel-iggy/src/test/java/org/apache/camel/component/iggy/IggyTestBase.java index 81e20f7d0af1f..3eba5bb3e5b0d 100644 --- a/components/camel-iggy/src/test/java/org/apache/camel/component/iggy/IggyTestBase.java +++ b/components/camel-iggy/src/test/java/org/apache/camel/component/iggy/IggyTestBase.java @@ -45,7 +45,7 @@ public abstract class IggyTestBase { @Order(1) @RegisterExtension - protected static IggyService iggyService = IggyServiceFactory.createService(); + protected static IggyService iggyService = IggyServiceFactory.createSingletonService(); @Order(2) @RegisterExtension diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentIbmMQTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentIbmMQTest.java index 8d3018001ecc8..8faba063dc1db 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentIbmMQTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsComponentIbmMQTest.java @@ -35,7 +35,7 @@ public class JmsComponentIbmMQTest extends CamelTestSupport { @RegisterExtension - public static IbmMQService service = IbmMQServiceFactory.createService(); + public static IbmMQService service = IbmMQServiceFactory.createSingletonService(); @Test public void testSend() throws Exception { diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsReplyToIbmMQTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsReplyToIbmMQTest.java index 1f26b3ec4cc6c..34f2dc6091670 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsReplyToIbmMQTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsReplyToIbmMQTest.java @@ -35,7 +35,7 @@ public class JmsReplyToIbmMQTest extends CamelTestSupport { @RegisterExtension - public static IbmMQService service = IbmMQServiceFactory.createService(); + public static IbmMQService service = IbmMQServiceFactory.createSingletonService(); @Test public void testCustomJMSReplyToInOut() { diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/BaseExclusiveKafkaTestSupport.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/BaseExclusiveKafkaTestSupport.java index da2238f0f933e..edb8095d6d59f 100644 --- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/BaseExclusiveKafkaTestSupport.java +++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/BaseExclusiveKafkaTestSupport.java @@ -37,7 +37,7 @@ public abstract class BaseExclusiveKafkaTestSupport implements ConfigurableRoute { @Order(1) @RegisterExtension - protected static KafkaService service = KafkaServiceFactory.createService(); + protected static KafkaService service = KafkaServiceFactory.createSingletonService(); @Order(2) @RegisterExtension diff --git a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakConsumerIT.java b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakConsumerIT.java index 0bb0977e51c47..105edfc5e0fdc 100644 --- a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakConsumerIT.java +++ b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakConsumerIT.java @@ -50,7 +50,7 @@ public class KeycloakConsumerIT extends CamelTestSupport { private static final Logger log = LoggerFactory.getLogger(KeycloakConsumerIT.class); @RegisterExtension - static KeycloakService keycloakService = KeycloakServiceFactory.createService(); + static KeycloakService keycloakService = KeycloakServiceFactory.createSingletonService(); // Test data - use unique names to avoid conflicts private static final String TEST_REALM_NAME = "consumer-test-realm-" + UUID.randomUUID().toString().substring(0, 8); diff --git a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakTestInfraIT.java b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakTestInfraIT.java index cd7dacb39a2d9..eb48ee74cfa13 100644 --- a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakTestInfraIT.java +++ b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/KeycloakTestInfraIT.java @@ -59,7 +59,7 @@ public class KeycloakTestInfraIT extends CamelTestSupport { private static final Logger log = LoggerFactory.getLogger(KeycloakTestInfraIT.class); @RegisterExtension - static KeycloakService keycloakService = KeycloakServiceFactory.createService(); + static KeycloakService keycloakService = KeycloakServiceFactory.createSingletonService(); // Test data - use unique names to avoid conflicts private static final String TEST_REALM_NAME = "testinfra-realm-" + UUID.randomUUID().toString().substring(0, 8); diff --git a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityTestInfraIT.java b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityTestInfraIT.java index 375fa9ab7696f..b543601592696 100644 --- a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityTestInfraIT.java +++ b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakSecurityTestInfraIT.java @@ -77,7 +77,7 @@ public class KeycloakSecurityTestInfraIT extends CamelTestSupport { private static final Logger log = LoggerFactory.getLogger(KeycloakSecurityTestInfraIT.class); @RegisterExtension - static KeycloakService keycloakService = KeycloakServiceFactory.createService(); + static KeycloakService keycloakService = KeycloakServiceFactory.createSingletonService(); // Test data - use unique names to avoid conflicts private static final String TEST_REALM_NAME = "security-test-realm-" + UUID.randomUUID().toString().substring(0, 8); diff --git a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenBindingSecurityIT.java b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenBindingSecurityIT.java index d1430cb8cf632..6957c52bb790e 100644 --- a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenBindingSecurityIT.java +++ b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenBindingSecurityIT.java @@ -69,7 +69,7 @@ public class KeycloakTokenBindingSecurityIT extends CamelTestSupport { private static final Logger log = LoggerFactory.getLogger(KeycloakTokenBindingSecurityIT.class); @RegisterExtension - static KeycloakService keycloakService = KeycloakServiceFactory.createService(); + static KeycloakService keycloakService = KeycloakServiceFactory.createSingletonService(); // Test data - use unique names private static final String TEST_REALM_NAME = "token-binding-realm-" + UUID.randomUUID().toString().substring(0, 8); diff --git a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospectionIT.java b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospectionIT.java index 72715c0a2a077..2c2715bb54131 100644 --- a/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospectionIT.java +++ b/components/camel-keycloak/src/test/java/org/apache/camel/component/keycloak/security/KeycloakTokenIntrospectionIT.java @@ -73,7 +73,7 @@ public class KeycloakTokenIntrospectionIT extends CamelTestSupport { private static final Logger LOG = LoggerFactory.getLogger(KeycloakTokenIntrospectionIT.class); @RegisterExtension - static KeycloakService keycloakService = KeycloakServiceFactory.createService(); + static KeycloakService keycloakService = KeycloakServiceFactory.createSingletonService(); // Test data - use unique names to avoid conflicts private static final String TEST_REALM_NAME = "introspection-realm-" + UUID.randomUUID().toString().substring(0, 8); diff --git a/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifTestSupport.java b/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifTestSupport.java index 3cbab66c31820..2906c04087140 100644 --- a/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifTestSupport.java +++ b/components/camel-ldif/src/test/java/org/apache/camel/component/ldif/LdifTestSupport.java @@ -23,7 +23,7 @@ public class LdifTestSupport extends CamelTestSupport { @RegisterExtension - public static OpenldapService service = OpenldapServiceFactory.createService(); + public static OpenldapService service = OpenldapServiceFactory.createSingletonService(); protected int port; diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioIntegrationTestSupport.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioIntegrationTestSupport.java index 048987d1e73be..5d74652ba2962 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioIntegrationTestSupport.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioIntegrationTestSupport.java @@ -23,6 +23,6 @@ class MinioIntegrationTestSupport extends CamelTestSupport { @RegisterExtension - static MinioService service = MinioServiceFactory.createService(); + static MinioService service = MinioServiceFactory.createSingletonService(); } diff --git a/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/AbstractMongoDbITSupport.java b/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/AbstractMongoDbITSupport.java index 77dba660cf3f4..dd7e4ef67997c 100644 --- a/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/AbstractMongoDbITSupport.java +++ b/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/AbstractMongoDbITSupport.java @@ -29,7 +29,7 @@ public abstract class AbstractMongoDbITSupport extends CamelTestSupport { @RegisterExtension - public static MongoDBService service = MongoDBServiceFactory.createService(); + public static MongoDBService service = MongoDBServiceFactory.createSingletonService(); protected static final String FILE_NAME = "filename.for.db.txt"; protected static final String FILE_DATA = "This is some stuff to go into the db"; diff --git a/components/camel-nats/src/test/java/org/apache/camel/component/nats/integration/NatsITSupport.java b/components/camel-nats/src/test/java/org/apache/camel/component/nats/integration/NatsITSupport.java index 2ce8e2c09204e..b3ba6c165d2ef 100644 --- a/components/camel-nats/src/test/java/org/apache/camel/component/nats/integration/NatsITSupport.java +++ b/components/camel-nats/src/test/java/org/apache/camel/component/nats/integration/NatsITSupport.java @@ -31,7 +31,7 @@ public class NatsITSupport extends CamelTestSupport { @RegisterExtension - static NatsService service = NatsServiceFactory.createService(); + static NatsService service = NatsServiceFactory.createSingletonService(); static { try (InputStream is = NatsITSupport.class.getClassLoader().getResourceAsStream("logging.properties")) { diff --git a/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/integration/PahoMqtt5ITSupport.java b/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/integration/PahoMqtt5ITSupport.java index 6ccd2f8839ab2..7afd5244bf908 100644 --- a/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/integration/PahoMqtt5ITSupport.java +++ b/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/integration/PahoMqtt5ITSupport.java @@ -23,7 +23,7 @@ public abstract class PahoMqtt5ITSupport extends CamelTestSupport { @RegisterExtension - public static MosquittoService service = MosquittoServiceFactory.createService(); + public static MosquittoService service = MosquittoServiceFactory.createSingletonService(); protected int mqttPort; diff --git a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java index 2aa0b76c93dd5..088e56f511fc6 100644 --- a/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java +++ b/components/camel-pqc/src/test/java/org/apache/camel/component/pqc/HashicorpVaultKeyLifecycleIT.java @@ -48,7 +48,7 @@ public class HashicorpVaultKeyLifecycleIT extends CamelTestSupport { @RegisterExtension - public static HashicorpVaultService service = HashicorpServiceFactory.createService(); + public static HashicorpVaultService service = HashicorpServiceFactory.createSingletonService(); private HashicorpVaultKeyLifecycleManager keyManager; diff --git a/components/camel-redis/src/test/java/org/apache/camel/component/redis/processor/aggregate/integration/AggregateRedisIT.java b/components/camel-redis/src/test/java/org/apache/camel/component/redis/processor/aggregate/integration/AggregateRedisIT.java index bcb71f10570d9..e921fd0f5a12a 100644 --- a/components/camel-redis/src/test/java/org/apache/camel/component/redis/processor/aggregate/integration/AggregateRedisIT.java +++ b/components/camel-redis/src/test/java/org/apache/camel/component/redis/processor/aggregate/integration/AggregateRedisIT.java @@ -35,7 +35,7 @@ public class AggregateRedisIT extends CamelTestSupport { @RegisterExtension - static RedisService service = RedisServiceFactory.createService(); + static RedisService service = RedisServiceFactory.createSingletonService(); @Test public void testABC() throws Exception { diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java index 33bea4a09f4bc..39e5b7078431e 100644 --- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java +++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/integration/SolrTestSupport.java @@ -56,7 +56,7 @@ public abstract class SolrTestSupport implements CamelTestSupportHelper, Configu @Order(1) @RegisterExtension - public static final SolrService service = SolrServiceFactory.createService(); + public static final SolrService service = SolrServiceFactory.createSingletonService(); @Order(2) @RegisterExtension diff --git a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpSseIT.java b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpSseIT.java index decd9ff56efd4..b8ca660fc33c9 100644 --- a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpSseIT.java +++ b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpSseIT.java @@ -34,7 +34,7 @@ public class SpringAiChatMcpSseIT extends OllamaTestSupport { @RegisterExtension - static McpEverythingSseService MCP_EVERYTHING = McpEverythingSseServiceFactory.createService(); + static McpEverythingSseService MCP_EVERYTHING = McpEverythingSseServiceFactory.createSingletonService(); @Test public void testMcpEchoTool() { diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQBasicIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQBasicIT.java index c550090f0df40..523f2dff667bf 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQBasicIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQBasicIT.java @@ -37,11 +37,13 @@ public class RabbitMQBasicIT extends RabbitMQITSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { ConnectionProperties connectionProperties = service.connectionProperties(); - foo = String.format("spring-rabbitmq:%s:%d/foo?username=%s&password=%s", connectionProperties.hostname(), - connectionProperties.port(), connectionProperties.username(), connectionProperties.password()); + foo = String.format("spring-rabbitmq:%s:%d/%s?username=%s&password=%s", connectionProperties.hostname(), + connectionProperties.port(), uniqueName("foo"), connectionProperties.username(), + connectionProperties.password()); - bar = String.format("spring-rabbitmq:%s:%d/bar?username=%s&password=%s", connectionProperties.hostname(), - connectionProperties.port(), connectionProperties.username(), connectionProperties.password()); + bar = String.format("spring-rabbitmq:%s:%d/%s?username=%s&password=%s", connectionProperties.hostname(), + connectionProperties.port(), uniqueName("bar"), connectionProperties.username(), + connectionProperties.password()); return new RouteBuilder() { @Override diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQComponentNullBodyIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQComponentNullBodyIT.java index e29557a4d403b..9e3fcac38423f 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQComponentNullBodyIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQComponentNullBodyIT.java @@ -43,8 +43,8 @@ protected CamelContext createCamelContext() throws Exception { public void testProducer() { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -60,7 +60,7 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo?routingKey=foo.bar"); + .to("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=foo.bar"); } }; } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerIT.java index 2c54d27803556..964b812304e78 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerIT.java @@ -40,9 +40,9 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo"); + .to("spring-rabbitmq:" + uniqueName("foo")); - from("spring-rabbitmq:foo") + from("spring-rabbitmq:" + uniqueName("foo")) .to("log:result") .to("mock:result"); } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerPooledExchangeIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerPooledExchangeIT.java index 979ade17c1aca..1949700af55fe 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerPooledExchangeIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerPooledExchangeIT.java @@ -59,9 +59,9 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo"); + .to("spring-rabbitmq:" + uniqueName("foo")); - from("spring-rabbitmq:foo") + from("spring-rabbitmq:" + uniqueName("foo")) .to("log:result") .to("mock:result"); } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerQueuesIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerQueuesIT.java index 4cfa47e10953d..a94131af19cdb 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerQueuesIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerQueuesIT.java @@ -106,9 +106,9 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo"); + .to("spring-rabbitmq:" + uniqueName("foo")); - from("spring-rabbitmq:foo?queues=myqueue") + from("spring-rabbitmq:" + uniqueName("foo") + "?queues=" + uniqueName("myqueue")) .to("log:result") .to("mock:result"); } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerRoutingKeyIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerRoutingKeyIT.java index 8d3a0475f7b02..ec73929594900 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerRoutingKeyIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerRoutingKeyIT.java @@ -73,9 +73,9 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo?routingKey=foo.bar"); + .to("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=foo.bar"); - from("spring-rabbitmq:foo?queues=myqueue&routingKey=foo.bar") + from("spring-rabbitmq:" + uniqueName("foo") + "?queues=" + uniqueName("myqueue") + "&routingKey=foo.bar") .to("log:result") .to("mock:result"); } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerTopicIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerTopicIT.java index f577a52b79cde..2d5811eb02d97 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerTopicIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQConsumerTopicIT.java @@ -73,9 +73,10 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo?routingKey=foo.bar"); + .to("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=foo.bar"); - from("spring-rabbitmq:foo?exchangeType=topic&queues=myqueue&routingKey=foo.#") + from("spring-rabbitmq:" + uniqueName("foo") + "?exchangeType=topic&queues=" + uniqueName("myqueue") + + "&routingKey=foo.#") .to("log:result") .to("mock:result"); } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQITSupport.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQITSupport.java index 45434d2738253..fc87a6b33ac27 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQITSupport.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQITSupport.java @@ -30,10 +30,14 @@ public abstract class RabbitMQITSupport extends CamelTestSupport { @RegisterExtension - public static RabbitMQService service = RabbitMQServiceFactory.createService(); + public static RabbitMQService service = RabbitMQServiceFactory.createSingletonService(); protected Logger log = LoggerFactory.getLogger(getClass()); + protected String uniqueName(String baseName) { + return getClass().getSimpleName() + "-" + baseName; + } + ConnectionFactory createConnectionFactory(boolean confirm) { CachingConnectionFactory cf = new CachingConnectionFactory(); if (confirm) { diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQInOutIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQInOutIT.java index f0f873d2e202e..9ce6e8c90ff1c 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQInOutIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQInOutIT.java @@ -56,11 +56,12 @@ public void configure() throws Exception { from("direct:start") .setVariable("global:mycrmb", header(Exchange.BREADCRUMB_ID)) .to("log:request") - .to(ExchangePattern.InOut, "spring-rabbitmq:cheese?routingKey=foo.bar") + .to(ExchangePattern.InOut, "spring-rabbitmq:" + uniqueName("cheese") + "?routingKey=foo.bar") .to("log:response") .to("mock:result"); - from("spring-rabbitmq:cheese?queues=myqueue&routingKey=foo.bar") + from("spring-rabbitmq:" + uniqueName("cheese") + "?queues=" + uniqueName("myqueue") + + "&routingKey=foo.bar") .to("log:input") .to("mock:input") .transform(body().prepend("Hello ")); diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQPollingConsumerIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQPollingConsumerIT.java index 5a6b3ba5a8205..5e32ad8b80a96 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQPollingConsumerIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQPollingConsumerIT.java @@ -39,8 +39,8 @@ protected CamelContext createCamelContext() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - DirectExchange t = new DirectExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + DirectExchange t = new DirectExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); admin.declareExchange(t); @@ -57,8 +57,10 @@ public void testJmsPollingConsumerWait() throws Exception { // use another thread for polling consumer to demonstrate that we can wait before // the message is sent to the queue Executors.newSingleThreadExecutor().execute(() -> { - String body = consumer.receiveBody("spring-rabbitmq:foo?queues=myqueue&routingKey=mykey", String.class); - template.sendBody("spring-rabbitmq:foo?routingKey=mykey2", body + " Claus"); + String body = consumer.receiveBody( + "spring-rabbitmq:" + uniqueName("foo") + "?queues=" + uniqueName("myqueue") + "&routingKey=mykey", + String.class); + template.sendBody("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=mykey2", body + " Claus"); }); // wait a little to demonstrate we can start poll before we have a msg on the queue @@ -77,10 +79,12 @@ public void testJmsPollingConsumerLowTimeout() throws Exception { // use another thread for polling consumer to demonstrate that we can wait before // the message is sent to the queue Executors.newSingleThreadExecutor().execute(() -> { - String body = consumer.receiveBody("spring-rabbitmq:foo?queues=myqueue&routingKey=mykey", 100, String.class); + String body = consumer.receiveBody( + "spring-rabbitmq:" + uniqueName("foo") + "?queues=" + uniqueName("myqueue") + "&routingKey=mykey", + 100, String.class); assertNull(body, "Should be null"); - template.sendBody("spring-rabbitmq:foo?routingKey=mykey2", "Hello Claus"); + template.sendBody("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=mykey2", "Hello Claus"); }); // wait a little to demonstrate we can start poll before we have a msg on the queue @@ -99,8 +103,10 @@ public void testJmsPollingConsumerHighTimeout() throws Exception { // use another thread for polling consumer to demonstrate that we can wait before // the message is sent to the queue Executors.newSingleThreadExecutor().execute(() -> { - String body = consumer.receiveBody("spring-rabbitmq:foo?queues=myqueue&routingKey=mykey", 3000, String.class); - template.sendBody("spring-rabbitmq:foo?routingKey=mykey2", body + " Claus"); + String body = consumer.receiveBody( + "spring-rabbitmq:" + uniqueName("foo") + "?queues=" + uniqueName("myqueue") + "&routingKey=mykey", + 3000, String.class); + template.sendBody("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=mykey2", body + " Claus"); }); // wait a little to demonstrate we can start poll before we have a msg on the queue @@ -116,9 +122,11 @@ protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { - from("direct:start").log("Sending ${body} to myqueue").to("spring-rabbitmq:foo?routingKey=mykey"); + from("direct:start").log("Sending ${body} to myqueue") + .to("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=mykey"); - from("spring-rabbitmq:foo?queues=myqueue2&routingKey=mykey2").log("Received ${body} from myqueue2") + from("spring-rabbitmq:" + uniqueName("foo") + "?queues=" + uniqueName("myqueue2") + "&routingKey=mykey2") + .log("Received ${body} from myqueue2") .to("mock:result"); } }; diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerAutoDeclareIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerAutoDeclareIT.java index b932c776f064e..0481ddc1202fd 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerAutoDeclareIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerAutoDeclareIT.java @@ -42,7 +42,7 @@ public void testProducer() throws Exception { template.sendBody("direct:start", "Hello World"); AmqpTemplate template = new RabbitTemplate(cf); - String out = (String) template.receiveAndConvert("myqueue"); + String out = (String) template.receiveAndConvert(uniqueName("myqueue")); Assertions.assertEquals("Hello World", out); } @@ -53,7 +53,7 @@ public void testProducerWithHeader() throws Exception { template.sendBodyAndHeader("direct:start", "Hello World", "cheese", "gouda"); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); byte[] body = out.getBody(); Assertions.assertNotNull(body, "The body should not be null"); @@ -77,7 +77,7 @@ public void testProducerWithMessage() throws Exception { template.sendBody("direct:start", body); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); Assertions.assertEquals("foo", new String(out.getBody())); Assertions.assertEquals("baz", out.getMessageProperties().getHeader("bar")); } @@ -94,7 +94,7 @@ public void testProducerWithMessageProperties() throws Exception { SpringRabbitMQConstants.PRIORITY, 1)); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); final MessageProperties messageProperties = out.getMessageProperties(); Assertions.assertNotNull(messageProperties, "The message properties should not be null"); @@ -115,7 +115,9 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo?autoDeclareProducer=true&routingKey=foo.bar.#&queues=myqueue&exchangeType=topic"); + .to("spring-rabbitmq:" + uniqueName("foo") + + "?autoDeclareProducer=true&routingKey=foo.bar.#&queues=" + uniqueName("myqueue") + + "&exchangeType=topic"); } }; } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerIT.java index 95e43ebe48d2a..f272e3627c876 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerIT.java @@ -57,8 +57,8 @@ public void testProducerLoadAndReceive() throws Exception { // --- 1. AMQP Setup --- // Ensures the RabbitMQ queue, exchange, and binding exist before the test. ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); admin.declareExchange(t); @@ -115,7 +115,7 @@ public void testProducerLoadAndReceive() throws Exception { StopWatch lastMessageStopWatch = new StopWatch(); final long idleTimeoutMillis = 2000; // 2 seconds while (true) { - Object receivedMessage = rabbitConsumerTemplate.receiveAndConvert("myqueue"); + Object receivedMessage = rabbitConsumerTemplate.receiveAndConvert(uniqueName("myqueue")); if (receivedMessage != null) { // If we got a message, increment count and reset the idle timer. @@ -140,8 +140,8 @@ public void testProducerLoadAndReceive() throws Exception { public void testProducer() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -151,7 +151,7 @@ public void testProducer() throws Exception { template.sendBody("direct:start", "Hello World"); AmqpTemplate template = new RabbitTemplate(cf); - String out = (String) template.receiveAndConvert("myqueue"); + String out = (String) template.receiveAndConvert(uniqueName("myqueue")); Assertions.assertEquals("Hello World", out); } @@ -159,8 +159,8 @@ public void testProducer() throws Exception { public void testProducerWithHeader() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -170,7 +170,7 @@ public void testProducerWithHeader() throws Exception { template.sendBodyAndHeader("direct:start", "Hello World", "cheese", "gouda"); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); byte[] body = out.getBody(); Assertions.assertNotNull(body, "The body should not be null"); @@ -182,8 +182,8 @@ public void testProducerWithHeader() throws Exception { public void testProducerWithMessage() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -202,7 +202,7 @@ public void testProducerWithMessage() throws Exception { template.sendBody("direct:start", body); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); Assertions.assertEquals("foo", new String(out.getBody())); Assertions.assertEquals("baz", out.getMessageProperties().getHeader("bar")); } @@ -211,8 +211,8 @@ public void testProducerWithMessage() throws Exception { public void testProducerWithMessageProperties() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -227,7 +227,7 @@ public void testProducerWithMessageProperties() throws Exception { SpringRabbitMQConstants.PRIORITY, 1)); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); final MessageProperties messageProperties = out.getMessageProperties(); Assertions.assertNotNull(messageProperties, "The message properties should not be null"); @@ -246,8 +246,8 @@ public void testProducerWithMessageProperties() throws Exception { public void testProducerWithBreadcrumb() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -259,7 +259,7 @@ public void testProducerWithBreadcrumb() throws Exception { SpringRabbitMQConstants.TYPE, "price", Exchange.BREADCRUMB_ID, "mycrumb123")); AmqpTemplate template = new RabbitTemplate(cf); - Message out = template.receive("myqueue"); + Message out = template.receive(uniqueName("myqueue")); final MessageProperties messageProperties = out.getMessageProperties(); Assertions.assertNotNull(messageProperties, "The message properties should not be null"); @@ -277,7 +277,7 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo?routingKey=foo.bar"); + .to("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=foo.bar"); } }; } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java index efa4e5aef018c..f5777e6d3b85b 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java @@ -40,8 +40,8 @@ protected boolean confirmEnabled() { public void testProducer() { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -59,7 +59,7 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:unknown?routingKey=foo.bar"); + .to("spring-rabbitmq:" + uniqueName("unknown") + "?routingKey=foo.bar"); } }; } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerNullBodyIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerNullBodyIT.java index 788d4dd34cf87..7c011584a0103 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerNullBodyIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerNullBodyIT.java @@ -33,8 +33,8 @@ public class RabbitMQProducerNullBodyIT extends RabbitMQITSupport { public void testProducer() { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); @@ -50,7 +50,7 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:foo?routingKey=foo.bar&allowNullBody=true"); + .to("spring-rabbitmq:" + uniqueName("foo") + "?routingKey=foo.bar&allowNullBody=true"); } }; } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerSimpleIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerSimpleIT.java index e479a1c97c3d8..0cabe012a793e 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerSimpleIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerSimpleIT.java @@ -33,7 +33,7 @@ protected RoutesBuilder createRouteBuilder() throws Exception { @Override public void configure() throws Exception { from("direct:start") - .to("spring-rabbitmq:simple"); + .to("spring-rabbitmq:" + uniqueName("simple")); } }; } diff --git a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerToDIT.java b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerToDIT.java index d9aa0317697c8..7fc2ebd4a5882 100644 --- a/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerToDIT.java +++ b/components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerToDIT.java @@ -35,26 +35,26 @@ public class RabbitMQProducerToDIT extends RabbitMQITSupport { public void testToD() throws Exception { ConnectionFactory cf = context.getRegistry().lookupByNameAndType("myCF", ConnectionFactory.class); - Queue q = new Queue("myqueue"); - TopicExchange t = new TopicExchange("foo"); + Queue q = new Queue(uniqueName("myqueue")); + TopicExchange t = new TopicExchange(uniqueName("foo")); AmqpAdmin admin = new RabbitAdmin(cf); admin.declareQueue(q); admin.declareExchange(t); admin.declareBinding(BindingBuilder.bind(q).to(t).with("foo.bar.#")); - fluentTemplate.to("direct:start").withBody("Hello World").withHeader("whereTo", "foo").withHeader("myKey", "foo.bar") - .send(); + fluentTemplate.to("direct:start").withBody("Hello World").withHeader("whereTo", uniqueName("foo")) + .withHeader("myKey", "foo.bar").send(); AmqpTemplate template = new RabbitTemplate(cf); - String out = (String) template.receiveAndConvert("myqueue"); + String out = (String) template.receiveAndConvert(uniqueName("myqueue")); Assertions.assertEquals("Hello World", out); - fluentTemplate.to("direct:start").withBody("Bye World").withHeader("whereTo", "foo").withHeader("myKey", "foo.bar.baz") - .send(); + fluentTemplate.to("direct:start").withBody("Bye World").withHeader("whereTo", uniqueName("foo")) + .withHeader("myKey", "foo.bar.baz").send(); template = new RabbitTemplate(cf); - out = (String) template.receiveAndConvert("myqueue"); + out = (String) template.receiveAndConvert(uniqueName("myqueue")); Assertions.assertEquals("Bye World", out); // there should only be 1 rabbit endpoint diff --git a/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisConsumerManualIT.java b/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisConsumerManualIT.java index 521bddbbbf574..600ab61e8c732 100644 --- a/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisConsumerManualIT.java +++ b/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisConsumerManualIT.java @@ -33,7 +33,7 @@ public class RedisConsumerManualIT extends RedisTestSupport { @RegisterExtension - static RedisService service = RedisServiceFactory.createService(); + static RedisService service = RedisServiceFactory.createSingletonService(); private static final RedisMessageListenerContainer LISTENER_CONTAINER = new RedisMessageListenerContainer(); private static JedisConnectionFactory jedisConnectionFactory; diff --git a/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisProducerManualIT.java b/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisProducerManualIT.java index 6a15d127b7cd9..8f18ae486338a 100644 --- a/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisProducerManualIT.java +++ b/components/camel-spring-parent/camel-spring-redis/src/test/java/org/apache/camel/component/redis/integration/RedisProducerManualIT.java @@ -32,7 +32,7 @@ public class RedisProducerManualIT extends RedisTestSupport { @RegisterExtension - static RedisService service = RedisServiceFactory.createService(); + static RedisService service = RedisServiceFactory.createSingletonService(); private static JedisConnectionFactory connectionFactory; @BeforeAll diff --git a/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java b/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java index 8de4495263355..a126bc41169a7 100644 --- a/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java +++ b/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java @@ -35,7 +35,7 @@ @DisabledOnOs(value = OS.AIX, disabledReason = "has problem with all the new reconnection stuff and whatnot") public class XmppBaseIT extends CamelTestSupport { @RegisterExtension - static XmppService service = XmppServiceFactory.createService(); + static XmppService service = XmppServiceFactory.createSingletonService(); static { try (InputStream is = XmppBaseIT.class.getClassLoader().getResourceAsStream("logging.properties")) { diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java index e0d58f9ea190c..359b6cc66593c 100644 --- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java +++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java @@ -41,7 +41,7 @@ public class MasterEndpointIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); @Autowired protected CamelContext camelContext; diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartzEndpointIT.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartzEndpointIT.java index 643fc73fd5823..3e10a87c1d4d1 100644 --- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartzEndpointIT.java +++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterQuartzEndpointIT.java @@ -31,7 +31,7 @@ @ContextConfiguration public class MasterQuartzEndpointIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); @Autowired protected CamelContext camelContext; diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupIT.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupIT.java index 24cd968a7cca9..6ff6a0875ba64 100644 --- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupIT.java +++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupIT.java @@ -51,7 +51,7 @@ public class GroupIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(GroupIT.class); diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/integration/MasterEndpointFailoverIT.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/integration/MasterEndpointFailoverIT.java index ef8221f3a23de..c38b1209c5e64 100644 --- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/integration/MasterEndpointFailoverIT.java +++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/integration/MasterEndpointFailoverIT.java @@ -38,7 +38,7 @@ public class MasterEndpointFailoverIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); private static final transient Logger LOG = LoggerFactory.getLogger(MasterEndpointFailoverIT.class); diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java index c4338ff8a25f3..06eb707f08f3b 100644 --- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java +++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java @@ -41,7 +41,7 @@ public final class ZooKeeperClusteredRoutePolicyFactoryIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(ZooKeeperClusteredRoutePolicyFactoryIT.class); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java index ca11a6fca63c5..96ae127b6e7a8 100644 --- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java +++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java @@ -41,7 +41,7 @@ public final class ZooKeeperClusteredRoutePolicyIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(ZooKeeperClusteredRoutePolicyIT.class); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java index 02349fd7a06c6..3d6a91ad38f0d 100644 --- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java +++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java @@ -40,7 +40,7 @@ public final class ZooKeeperMasterIT { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); private static final Logger LOGGER = LoggerFactory.getLogger(ZooKeeperMasterIT.class); private static final List CLIENTS = IntStream.range(0, 3).mapToObj(Integer::toString).toList(); diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/integration/ZooKeeperITSupport.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/integration/ZooKeeperITSupport.java index c902797161aa1..0102a16a495b6 100644 --- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/integration/ZooKeeperITSupport.java +++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/integration/ZooKeeperITSupport.java @@ -45,7 +45,7 @@ public class ZooKeeperITSupport extends CamelTestSupport { @RegisterExtension - static ZooKeeperService service = ZooKeeperServiceFactory.createService(); + static ZooKeeperService service = ZooKeeperServiceFactory.createSingletonService(); protected String testPayload = "This is a test"; protected byte[] testPayloadBytes = testPayload.getBytes(); diff --git a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java index d81da695a2218..fa4d4e7dc915e 100644 --- a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java +++ b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java @@ -60,7 +60,7 @@ public abstract class JBangTestSupport { protected Logger logger = LoggerFactory.getLogger(getClass()); @RegisterExtension - protected static CliService containerService = CliServiceFactory.createService(); + protected static CliService containerService = CliServiceFactory.createSingletonService(); private static final String DATA_FOLDER = System.getProperty(CliProperties.DATA_FOLDER);