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

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


The following commit(s) were added to refs/heads/main by this push:
     new e32c11f  Use camel-test-infra instead of testcontainers directly (#80)
e32c11f is described below

commit e32c11f8ab1881c83805d98e7d0f9025f0d23302
Author: Nicolas Filotto <[email protected]>
AuthorDate: Sun Feb 27 10:38:46 2022 +0100

    Use camel-test-infra instead of testcontainers directly (#80)
---
 .../aws/main-endpointdsl-aws2-s3-kafka/pom.xml     |  7 +-
 .../org/apache/camel/example/AwsS3KafkaTest.java   | 45 +++-------
 .../java/org/apache/camel/example/AwsS3Test.java   | 35 ++------
 .../java/org/apache/camel/example/AwsS3Test.java   | 35 ++------
 .../java/org/apache/camel/example/AwsSQSTest.java  | 35 ++------
 .../pom.xml                                        |  7 +-
 .../org/apache/camel/example/KafkaAwsS3Test.java   | 45 +++-------
 .../aws/main-endpointdsl-kafka-aws2-s3/pom.xml     |  7 +-
 .../org/apache/camel/example/KafkaAwsS3Test.java   | 45 +++-------
 examples/aws/pom.xml                               | 13 +--
 examples/couchbase-log/pom.xml                     | 13 +--
 .../org/apache/camel/example/CouchbaseTest.java    | 60 ++++++--------
 examples/debezium/pom.xml                          | 27 +++---
 .../debezium/KinesisProducerToCassandra.java       |  2 +-
 .../src/main/resources/application.properties      |  2 +-
 .../camel/example/debezium/DebeziumTest.java       | 95 +++++++++-------------
 examples/kafka/pom.xml                             | 13 +--
 .../example/kafka/MessagePublisherClient.java      |  2 +-
 .../src/main/resources/application.properties      |  3 +-
 .../org/apache/camel/example/kafka/KafkaTest.java  | 18 ++--
 examples/mongodb/pom.xml                           | 13 +--
 .../apache/camel/example/mongodb/MongoDBTest.java  | 19 ++---
 examples/spring-pulsar/pom.xml                     | 13 +--
 .../src/main/resources/camel-common.xml            | 10 +--
 .../org/apache/camel/example/SpringPulsarTest.java | 26 ++----
 examples/vertx-kafka/pom.xml                       | 13 +--
 .../vertx/kafka/MessagePublisherClient.java        |  2 +-
 .../src/main/resources/application.properties      |  3 +-
 .../camel/example/vertx/kafka/VertxKafkaTest.java  | 17 ++--
 29 files changed, 204 insertions(+), 421 deletions(-)

diff --git a/examples/aws/main-endpointdsl-aws2-s3-kafka/pom.xml 
b/examples/aws/main-endpointdsl-aws2-s3-kafka/pom.xml
index 38404a0..f1d2178 100644
--- a/examples/aws/main-endpointdsl-aws2-s3-kafka/pom.xml
+++ b/examples/aws/main-endpointdsl-aws2-s3-kafka/pom.xml
@@ -88,9 +88,10 @@
         </dependency>
         <!-- for testing -->
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>kafka</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-kafka</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/aws/main-endpointdsl-aws2-s3-kafka/src/test/java/org/apache/camel/example/AwsS3KafkaTest.java
 
b/examples/aws/main-endpointdsl-aws2-s3-kafka/src/test/java/org/apache/camel/example/AwsS3KafkaTest.java
index 8b22514..2032301 100644
--- 
a/examples/aws/main-endpointdsl-aws2-s3-kafka/src/test/java/org/apache/camel/example/AwsS3KafkaTest.java
+++ 
b/examples/aws/main-endpointdsl-aws2-s3-kafka/src/test/java/org/apache/camel/example/AwsS3KafkaTest.java
@@ -25,61 +25,40 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.component.aws2.s3.AWS2S3Constants;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
+import org.apache.camel.test.infra.kafka.services.KafkaService;
+import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.KafkaContainer;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.S3;
 
 /**
  * A unit test checking that Camel can poll an Amazon S3 bucket and put the 
data into a Kafka topic.
  */
-@Testcontainers
 class AwsS3KafkaTest extends CamelMainTestSupport {
 
-    private static final String AWS_IMAGE = "localstack/localstack:0.13.3";
-    private static final String KAFKA_IMAGE = "confluentinc/cp-kafka:6.2.2";
-
-    @Container
-    private final LocalStackContainer awsContainer = new 
LocalStackContainer(DockerImageName.parse(AWS_IMAGE))
-            .withServices(S3)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
-    @Container
-    private final KafkaContainer kafkaContainer = new 
KafkaContainer(DockerImageName.parse(KAFKA_IMAGE));
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createS3Service();
+    @RegisterExtension
+    private static final KafkaService KAFKA_SERVICE = 
KafkaServiceFactory.createService();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
-        s3.getConfiguration().setAmazonS3Client(
-                S3Client.builder()
-                .endpointOverride(awsContainer.getEndpointOverride(S3))
-                .credentialsProvider(
-                    StaticCredentialsProvider.create(
-                        
AwsBasicCredentials.create(awsContainer.getAccessKey(), 
awsContainer.getSecretKey())
-                    )
-                )
-                .region(Region.of(awsContainer.getRegion()))
-                .build()
-        );
+        
s3.getConfiguration().setAmazonS3Client(AWSSDKClientUtils.newS3Client());
         return camelContext;
     }
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
         return asProperties(
-            "kafkaBrokers", String.format("%s:%d", kafkaContainer.getHost(), 
kafkaContainer.getMappedPort(9093))
+            "kafkaBrokers", KAFKA_SERVICE.getBootstrapServers()
         );
     }
 
diff --git 
a/examples/aws/main-endpointdsl-aws2-s3/src/test/java/org/apache/camel/example/AwsS3Test.java
 
b/examples/aws/main-endpointdsl-aws2-s3/src/test/java/org/apache/camel/example/AwsS3Test.java
index 48bf872..85fb79c 100644
--- 
a/examples/aws/main-endpointdsl-aws2-s3/src/test/java/org/apache/camel/example/AwsS3Test.java
+++ 
b/examples/aws/main-endpointdsl-aws2-s3/src/test/java/org/apache/camel/example/AwsS3Test.java
@@ -24,49 +24,28 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.component.aws2.s3.AWS2S3Constants;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.S3;
 
 /**
  * A unit test checking that Camel can poll an Amazon S3 bucket.
  */
-@Testcontainers
 class AwsS3Test extends CamelMainTestSupport {
 
-    private static final String IMAGE = "localstack/localstack:0.13.3";
-
-    @Container
-    private final LocalStackContainer container = new 
LocalStackContainer(DockerImageName.parse(IMAGE))
-            .withServices(S3)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createS3Service();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
-        s3.getConfiguration().setAmazonS3Client(
-                S3Client.builder()
-                .endpointOverride(container.getEndpointOverride(S3))
-                .credentialsProvider(
-                    StaticCredentialsProvider.create(
-                        AwsBasicCredentials.create(container.getAccessKey(), 
container.getSecretKey())
-                    )
-                )
-                .region(Region.of(container.getRegion()))
-                .build()
-        );
+        
s3.getConfiguration().setAmazonS3Client(AWSSDKClientUtils.newS3Client());
         return camelContext;
     }
 
diff --git 
a/examples/aws/main-endpointdsl-aws2/aws2-s3-events-inject/src/test/java/org/apache/camel/example/AwsS3Test.java
 
b/examples/aws/main-endpointdsl-aws2/aws2-s3-events-inject/src/test/java/org/apache/camel/example/AwsS3Test.java
index 01ad71c..481b2e6 100644
--- 
a/examples/aws/main-endpointdsl-aws2/aws2-s3-events-inject/src/test/java/org/apache/camel/example/AwsS3Test.java
+++ 
b/examples/aws/main-endpointdsl-aws2/aws2-s3-events-inject/src/test/java/org/apache/camel/example/AwsS3Test.java
@@ -22,49 +22,28 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.S3;
 
 /**
  * A unit test checking that Camel can store content into an Amazon S3 bucket.
  */
-@Testcontainers
 class AwsS3Test extends CamelMainTestSupport {
 
-    private static final String IMAGE = "localstack/localstack:0.13.3";
-
-    @Container
-    private final LocalStackContainer container = new 
LocalStackContainer(DockerImageName.parse(IMAGE))
-            .withServices(S3)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createS3Service();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
-        s3.getConfiguration().setAmazonS3Client(
-                S3Client.builder()
-                .endpointOverride(container.getEndpointOverride(S3))
-                .credentialsProvider(
-                    StaticCredentialsProvider.create(
-                        AwsBasicCredentials.create(container.getAccessKey(), 
container.getSecretKey())
-                    )
-                )
-                .region(Region.of(container.getRegion()))
-                .build()
-        );
+        
s3.getConfiguration().setAmazonS3Client(AWSSDKClientUtils.newS3Client());
         return camelContext;
     }
 
diff --git 
a/examples/aws/main-endpointdsl-aws2/aws2-sqs-consumer/src/test/java/org/apache/camel/example/AwsSQSTest.java
 
b/examples/aws/main-endpointdsl-aws2/aws2-sqs-consumer/src/test/java/org/apache/camel/example/AwsSQSTest.java
index 46a1ec6..75bf570 100644
--- 
a/examples/aws/main-endpointdsl-aws2/aws2-sqs-consumer/src/test/java/org/apache/camel/example/AwsSQSTest.java
+++ 
b/examples/aws/main-endpointdsl-aws2/aws2-sqs-consumer/src/test/java/org/apache/camel/example/AwsSQSTest.java
@@ -23,49 +23,28 @@ import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.sqs.Sqs2Component;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.sqs.SqsClient;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.SQS;
 
 /**
  * A unit test checking that Camel can consume messages from Amazon SQS.
  */
-@Testcontainers
 class AwsSQSTest extends CamelMainTestSupport {
 
-    private static final String IMAGE = "localstack/localstack:0.13.3";
-
-    @Container
-    private final LocalStackContainer container = new 
LocalStackContainer(DockerImageName.parse(IMAGE))
-            .withServices(SQS)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createSQSService();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         Sqs2Component sqs = camelContext.getComponent("aws2-sqs", 
Sqs2Component.class);
-        sqs.getConfiguration().setAmazonSQSClient(
-                SqsClient.builder()
-                .endpointOverride(container.getEndpointOverride(SQS))
-                .credentialsProvider(
-                    StaticCredentialsProvider.create(
-                        AwsBasicCredentials.create(container.getAccessKey(), 
container.getSecretKey())
-                    )
-                )
-                .region(Region.of(container.getRegion()))
-                .build()
-        );
+        
sqs.getConfiguration().setAmazonSQSClient(AWSSDKClientUtils.newSQSClient());
         return camelContext;
     }
 
diff --git 
a/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/pom.xml 
b/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/pom.xml
index 12c1187..a2ed276 100644
--- a/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/pom.xml
+++ b/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/pom.xml
@@ -88,9 +88,10 @@
         </dependency>
         <!-- for testing -->
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>kafka</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-kafka</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
 
b/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
index b96fc05..0b477b7 100644
--- 
a/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
+++ 
b/examples/aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
@@ -24,61 +24,40 @@ import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
+import org.apache.camel.test.infra.kafka.services.KafkaService;
+import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.KafkaContainer;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.S3;
 
 /**
  * A unit test checking that Camel can poll data from a Kafka topic and put it 
into an Amazon S3 bucket.
  */
-@Testcontainers
 class KafkaAwsS3Test extends CamelMainTestSupport {
 
-    private static final String AWS_IMAGE = "localstack/localstack:0.13.3";
-    private static final String KAFKA_IMAGE = "confluentinc/cp-kafka:6.2.2";
-
-    @Container
-    private final LocalStackContainer awsContainer = new 
LocalStackContainer(DockerImageName.parse(AWS_IMAGE))
-            .withServices(S3)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
-    @Container
-    private final KafkaContainer kafkaContainer = new 
KafkaContainer(DockerImageName.parse(KAFKA_IMAGE));
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createS3Service();
+    @RegisterExtension
+    private static final KafkaService KAFKA_SERVICE = 
KafkaServiceFactory.createService();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
-        s3.getConfiguration().setAmazonS3Client(
-                S3Client.builder()
-                .endpointOverride(awsContainer.getEndpointOverride(S3))
-                .credentialsProvider(
-                    StaticCredentialsProvider.create(
-                        
AwsBasicCredentials.create(awsContainer.getAccessKey(), 
awsContainer.getSecretKey())
-                    )
-                )
-                .region(Region.of(awsContainer.getRegion()))
-                .build()
-        );
+        
s3.getConfiguration().setAmazonS3Client(AWSSDKClientUtils.newS3Client());
         return camelContext;
     }
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
         return asProperties(
-            "kafkaBrokers", String.format("%s:%d", kafkaContainer.getHost(), 
kafkaContainer.getMappedPort(9093))
+            "kafkaBrokers", KAFKA_SERVICE.getBootstrapServers()
         );
     }
 
diff --git a/examples/aws/main-endpointdsl-kafka-aws2-s3/pom.xml 
b/examples/aws/main-endpointdsl-kafka-aws2-s3/pom.xml
index 86f2f7e..591e81a 100644
--- a/examples/aws/main-endpointdsl-kafka-aws2-s3/pom.xml
+++ b/examples/aws/main-endpointdsl-kafka-aws2-s3/pom.xml
@@ -88,9 +88,10 @@
         </dependency>
         <!-- for testing -->
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>kafka</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-kafka</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/aws/main-endpointdsl-kafka-aws2-s3/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
 
b/examples/aws/main-endpointdsl-kafka-aws2-s3/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
index b0ff334..6eca136 100644
--- 
a/examples/aws/main-endpointdsl-kafka-aws2-s3/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
+++ 
b/examples/aws/main-endpointdsl-kafka-aws2-s3/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java
@@ -24,61 +24,40 @@ import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
+import org.apache.camel.test.infra.kafka.services.KafkaService;
+import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.KafkaContainer;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.S3;
 
 /**
  * A unit test checking that Camel can poll data from a Kafka topic and put it 
into an Amazon S3 bucket.
  */
-@Testcontainers
 class KafkaAwsS3Test extends CamelMainTestSupport {
 
-    private static final String AWS_IMAGE = "localstack/localstack:0.13.3";
-    private static final String KAFKA_IMAGE = "confluentinc/cp-kafka:6.2.2";
-
-    @Container
-    private final LocalStackContainer awsContainer = new 
LocalStackContainer(DockerImageName.parse(AWS_IMAGE))
-            .withServices(S3)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
-    @Container
-    private final KafkaContainer kafkaContainer = new 
KafkaContainer(DockerImageName.parse(KAFKA_IMAGE));
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createS3Service();
+    @RegisterExtension
+    private static final KafkaService KAFKA_SERVICE = 
KafkaServiceFactory.createService();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
-        s3.getConfiguration().setAmazonS3Client(
-                S3Client.builder()
-                .endpointOverride(awsContainer.getEndpointOverride(S3))
-                .credentialsProvider(
-                    StaticCredentialsProvider.create(
-                        
AwsBasicCredentials.create(awsContainer.getAccessKey(), 
awsContainer.getSecretKey())
-                    )
-                )
-                .region(Region.of(awsContainer.getRegion()))
-                .build()
-        );
+        
s3.getConfiguration().setAmazonS3Client(AWSSDKClientUtils.newS3Client());
         return camelContext;
     }
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
         return asProperties(
-            "kafkaBrokers", String.format("%s:%d", kafkaContainer.getHost(), 
kafkaContainer.getMappedPort(9093))
+            "kafkaBrokers", KAFKA_SERVICE.getBootstrapServers()
         );
     }
 
diff --git a/examples/aws/pom.xml b/examples/aws/pom.xml
index a3e3d28..96c0473 100644
--- a/examples/aws/pom.xml
+++ b/examples/aws/pom.xml
@@ -53,15 +53,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>localstack</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-aws-v2</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/examples/couchbase-log/pom.xml b/examples/couchbase-log/pom.xml
index 35c5100..bbbc3af 100644
--- a/examples/couchbase-log/pom.xml
+++ b/examples/couchbase-log/pom.xml
@@ -84,15 +84,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>couchbase</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-couchbase</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/couchbase-log/src/test/java/org/apache/camel/example/CouchbaseTest.java
 
b/examples/couchbase-log/src/test/java/org/apache/camel/example/CouchbaseTest.java
index 825d622..b89a128 100644
--- 
a/examples/couchbase-log/src/test/java/org/apache/camel/example/CouchbaseTest.java
+++ 
b/examples/couchbase-log/src/test/java/org/apache/camel/example/CouchbaseTest.java
@@ -24,20 +24,21 @@ import java.util.concurrent.TimeUnit;
 import com.couchbase.client.java.Bucket;
 import com.couchbase.client.java.Cluster;
 import com.couchbase.client.java.json.JsonObject;
+import com.couchbase.client.java.manager.bucket.BucketSettings;
+import com.couchbase.client.java.manager.bucket.BucketType;
 import com.couchbase.client.java.manager.view.DesignDocument;
 import com.couchbase.client.java.manager.view.View;
 import com.couchbase.client.java.view.DesignDocumentNamespace;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.component.couchbase.CouchbaseConstants;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.couchbase.services.CouchbaseService;
+import org.apache.camel.test.infra.couchbase.services.CouchbaseServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.couchbase.BucketDefinition;
-import org.testcontainers.couchbase.CouchbaseContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -45,28 +46,18 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel consume data from Couchbase.
  */
-@Testcontainers
 class CouchbaseTest extends CamelMainTestSupport {
 
-    private static final String IMAGE = "couchbase/server:7.0.3";
     private static final String BUCKET = "test-bucket-" + 
System.currentTimeMillis();
 
-    @Container
-    private final CouchbaseContainer container = new CouchbaseContainer(IMAGE) 
{
-        {
-            // Camel component tries to use the default port of the KV 
Service, so we need to fix it
-            final int kvPort = 11210;
-            addFixedExposedPort(kvPort, kvPort);
-        }
-    }.withBucket(new BucketDefinition(BUCKET));
-    private Cluster cluster;
+    @RegisterExtension
+    private static final CouchbaseService SERVICE = 
CouchbaseServiceFactory.createService();
+    private static Cluster CLUSTER;
 
-    @BeforeEach
-    void init() {
-        cluster = Cluster.connect(
-            container.getConnectionString(),
-            container.getUsername(),
-            container.getPassword()
+    @BeforeAll
+    static void init() {
+        CLUSTER = Cluster.connect(
+            SERVICE.getConnectionString(), SERVICE.getUsername(), 
SERVICE.getPassword()
         );
         DesignDocument designDoc = new DesignDocument(
             CouchbaseConstants.DEFAULT_DESIGN_DOCUMENT_NAME,
@@ -75,30 +66,33 @@ class CouchbaseTest extends CamelMainTestSupport {
                 new View("function (doc, meta) {  emit(meta.id, doc);}")
             )
         );
-        cluster.bucket(BUCKET).viewIndexes().upsertDesignDocument(designDoc, 
DesignDocumentNamespace.PRODUCTION);
+        CLUSTER.buckets().createBucket(
+                
BucketSettings.create(BUCKET).bucketType(BucketType.COUCHBASE).flushEnabled(true));
+        CLUSTER.bucket(BUCKET).viewIndexes().upsertDesignDocument(designDoc, 
DesignDocumentNamespace.PRODUCTION);
     }
 
-    @AfterEach
-    void destroy() {
-        if (cluster != null) {
-            cluster.disconnect();
+    @AfterAll
+    static void destroy() {
+        if (CLUSTER != null) {
+            CLUSTER.buckets().dropBucket(BUCKET);
+            CLUSTER.disconnect();
         }
     }
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
         return asProperties(
-            "couchbase.host", container.getHost(),
-            "couchbase.port", 
Integer.toString(container.getBootstrapHttpDirectPort()),
-            "couchbase.username", container.getUsername(),
-            "couchbase.password", container.getPassword(),
+            "couchbase.host", SERVICE.getHostname(),
+            "couchbase.port", Integer.toString(SERVICE.getPort()),
+            "couchbase.username", SERVICE.getUsername(),
+            "couchbase.password", SERVICE.getPassword(),
             "couchbase.bucket", BUCKET
         );
     }
 
     @Test
     void should_consume_bucket() {
-        Bucket bucket = cluster.bucket(BUCKET);
+        Bucket bucket = CLUSTER.bucket(BUCKET);
         bucket.waitUntilReady(Duration.ofSeconds(10L));
         for (int i = 0; i < 10; i++) {
             bucket.defaultCollection().upsert("my-doc-" + i, 
JsonObject.create().put("name", "My Name " + i));
diff --git a/examples/debezium/pom.xml b/examples/debezium/pom.xml
index 6891771..592f1e2 100644
--- a/examples/debezium/pom.xml
+++ b/examples/debezium/pom.xml
@@ -99,27 +99,24 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>localstack</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>postgresql</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-aws-v2</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>cassandra</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-postgres</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-cassandra</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/examples/debezium/src/main/java/org/apache/camel/example/debezium/KinesisProducerToCassandra.java
 
b/examples/debezium/src/main/java/org/apache/camel/example/debezium/KinesisProducerToCassandra.java
index c83d30c..fd2943c 100644
--- 
a/examples/debezium/src/main/java/org/apache/camel/example/debezium/KinesisProducerToCassandra.java
+++ 
b/examples/debezium/src/main/java/org/apache/camel/example/debezium/KinesisProducerToCassandra.java
@@ -101,7 +101,7 @@ public final class KinesisProducerToCassandra {
                         // We just make sure we ONLY handle INSERT, UPDATE and 
DELETE and nothing else
                         .when(exchangeProperty("DBOperation").in("c", "u", 
"d"))
                         // Send query to Cassandra
-                        
.recipientList(simple("cql:{{cassandra.host}}/{{cassandra.keyspace}}?cql=RAW(${header.CQLQuery})"))
+                        
.recipientList(simple("cql:{{cassandra.node}}/{{cassandra.keyspace}}?cql=RAW(${header.CQLQuery})"))
                         .end();
             }
         };
diff --git a/examples/debezium/src/main/resources/application.properties 
b/examples/debezium/src/main/resources/application.properties
index 56eab2f..8590204 100644
--- a/examples/debezium/src/main/resources/application.properties
+++ b/examples/debezium/src/main/resources/application.properties
@@ -32,5 +32,5 @@ kinesis.accessKey = generated-access-key
 kinesis.secretKey = generated-secret-key
 kinesis.region = EU_CENTRAL_1
 
-cassandra.host = localhost:9042
+cassandra.node = localhost:9042
 cassandra.keyspace = dbzSink
\ No newline at end of file
diff --git 
a/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java
 
b/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java
index aa659ea..3a0fefa 100644
--- 
a/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java
+++ 
b/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java
@@ -28,20 +28,21 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.aws2.kinesis.Kinesis2Component;
 import org.apache.camel.component.sql.SqlComponent;
 import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
+import 
org.apache.camel.test.infra.cassandra.services.CassandraLocalContainerService;
+import org.apache.camel.test.infra.cassandra.services.CassandraService;
+import 
org.apache.camel.test.infra.postgres.services.PostgresLocalContainerService;
+import org.apache.camel.test.infra.postgres.services.PostgresService;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.postgresql.ds.PGSimpleDataSource;
 import org.testcontainers.containers.CassandraContainer;
 import org.testcontainers.containers.PostgreSQLContainer;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
 import org.testcontainers.utility.DockerImageName;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.kinesis.KinesisClient;
 import software.amazon.awssdk.services.kinesis.model.CreateStreamRequest;
 
@@ -51,15 +52,12 @@ import static org.awaitility.Awaitility.await;
 import static org.hamcrest.Matchers.equalTo;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static 
org.testcontainers.containers.localstack.LocalStackContainer.Service.KINESIS;
 
 /**
  * A unit test checking that Camel can propagate changes from one Database to 
another thanks to Debezium.
  */
-@Testcontainers
 class DebeziumTest extends CamelMainTestSupport {
 
-    private static final String AWS_IMAGE = "localstack/localstack:0.13.3";
     private static final String PGSQL_IMAGE = "debezium/example-postgres:1.9";
     private static final String CASSANDRA_IMAGE = "cassandra:4.0.1";
 
@@ -68,18 +66,21 @@ class DebeziumTest extends CamelMainTestSupport {
     private static final String SOURCE_DB_USERNAME = "pgsql-user";
     private static final String SOURCE_DB_PASSWORD = "pgsql-pw";
 
-    @Container
-    private final LocalStackContainer awsContainer = new 
LocalStackContainer(DockerImageName.parse(AWS_IMAGE))
-            .withServices(KINESIS)
-            .waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
-    @Container
-    private final PostgreSQLContainer<?> pgsqlContainer = new 
PostgreSQLContainer<>(DockerImageName.parse(PGSQL_IMAGE).asCompatibleSubstituteFor("postgres"))
-            .withDatabaseName(SOURCE_DB_NAME)
-            .withUsername(SOURCE_DB_USERNAME)
-            .withPassword(SOURCE_DB_PASSWORD);
-    @Container
-    private final CassandraContainer<?> cassandraContainer = new 
CassandraContainer<>(CASSANDRA_IMAGE)
-            .withInitScript("org/apache/camel/example/debezium/db-init.cql");
+    @RegisterExtension
+    private static final AWSService AWS_SERVICE = 
AWSServiceFactory.createKinesisService();
+    @RegisterExtension
+    private static final PostgresService POSTGRES_SERVICE = new 
PostgresLocalContainerService(
+        new 
PostgreSQLContainer<>(DockerImageName.parse(PGSQL_IMAGE).asCompatibleSubstituteFor("postgres"))
+                .withDatabaseName(SOURCE_DB_NAME)
+                .withUsername(SOURCE_DB_USERNAME)
+                .withPassword(SOURCE_DB_PASSWORD)
+    );
+    @RegisterExtension
+    private static final CassandraService CASSANDRA_SERVICE = new 
CassandraLocalContainerService(
+        new CassandraContainer<>(CASSANDRA_IMAGE)
+            .withInitScript("org/apache/camel/example/debezium/db-init.cql")
+    );
+
 
     @BeforeEach
     void init() throws IOException {
@@ -90,18 +91,19 @@ class DebeziumTest extends CamelMainTestSupport {
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         Kinesis2Component component = 
camelContext.getComponent("aws2-kinesis", Kinesis2Component.class);
-        KinesisClient kinesisClient = KinesisClient.builder()
-                .endpointOverride(awsContainer.getEndpointOverride(KINESIS))
-                .credentialsProvider(
-                        StaticCredentialsProvider.create(
-                                
AwsBasicCredentials.create(awsContainer.getAccessKey(), 
awsContainer.getSecretKey())
-                        )
-                )
-                .region(Region.of(awsContainer.getRegion()))
-                .build();
+        KinesisClient kinesisClient = AWSSDKClientUtils.newKinesisClient();
         // Create the stream
         
kinesisClient.createStream(CreateStreamRequest.builder().streamName("camel-debezium-example").shardCount(1).build());
         component.getConfiguration().setAmazonKinesisClient(kinesisClient);
+        // required for the sql component
+        PGSimpleDataSource db = new PGSimpleDataSource();
+        db.setServerNames(new String[]{POSTGRES_SERVICE.host()});
+        db.setPortNumbers(new int[]{POSTGRES_SERVICE.port()});
+        db.setUser(SOURCE_DB_USERNAME);
+        db.setPassword(SOURCE_DB_PASSWORD);
+        db.setDatabaseName(SOURCE_DB_NAME);
+
+        camelContext.getComponent("sql", SqlComponent.class).setDataSource(db);
         return camelContext;
     }
 
@@ -109,11 +111,11 @@ class DebeziumTest extends CamelMainTestSupport {
     protected Properties useOverridePropertiesWithPropertiesComponent() {
         // Override the host and port of the broker
         return asProperties(
-            "debezium.postgres.databaseHostName", pgsqlContainer.getHost(),
-            "debezium.postgres.databasePort", 
Integer.toString(pgsqlContainer.getMappedPort(5432)),
+            "debezium.postgres.databaseHostName", POSTGRES_SERVICE.host(),
+            "debezium.postgres.databasePort", 
Integer.toString(POSTGRES_SERVICE.port()),
             "debezium.postgres.databaseUser", SOURCE_DB_USERNAME,
             "debezium.postgres.databasePassword", SOURCE_DB_PASSWORD,
-            "cassandra.host", String.format("%s:%d", 
cassandraContainer.getHost(), cassandraContainer.getMappedPort(9042))
+            "cassandra.node", String.format("%s:%d", 
CASSANDRA_SERVICE.getCassandraHost(), CASSANDRA_SERVICE.getCQL3Port())
         );
     }
 
@@ -152,39 +154,18 @@ class DebeziumTest extends CamelMainTestSupport {
     protected void configure(MainConfigurationProperties configuration) {
         
configuration.addRoutesBuilder(DebeziumPgSQLConsumerToKinesis.createRouteBuilder());
         
configuration.addRoutesBuilder(KinesisProducerToCassandra.createRouteBuilder());
-        configuration.addRoutesBuilder(
-            new ApplyChangesToPgSQLRouteBuilder(
-                pgsqlContainer.getHost(), pgsqlContainer.getMappedPort(5432)
-            )
-        );
+        configuration.addRoutesBuilder(new ApplyChangesToPgSQLRouteBuilder());
     }
 
     private static class ApplyChangesToPgSQLRouteBuilder extends RouteBuilder {
 
-        private final String hostname;
-        private final int port;
-
-        ApplyChangesToPgSQLRouteBuilder(String hostname, int port) {
-            this.hostname = hostname;
-            this.port = port;
-        }
-
         @Override
         public void configure() {
-            // required for the sql component
-            PGSimpleDataSource db = new PGSimpleDataSource();
-            db.setServerNames(new String[]{hostname});
-            db.setPortNumbers(new int[]{port});
-            db.setUser(SOURCE_DB_USERNAME);
-            db.setPassword(SOURCE_DB_PASSWORD);
-            db.setDatabaseName(SOURCE_DB_NAME);
-
-            getContext().getComponent("sql", 
SqlComponent.class).setDataSource(db);
             from("direct:select").toF("sql:select * from %s.products", 
SOURCE_DB_SCHEMA).to("mock:query");
             from("direct:insert").toF("sql:insert into %s.products (id, name, 
description, weight) values (#, #, #, #)", SOURCE_DB_SCHEMA).to("mock:insert");
             from("direct:update").toF("sql:update %s.products set name=# where 
id=#", SOURCE_DB_SCHEMA).to("mock:update");
             from("direct:delete").toF("sql:delete from %s.products where 
id=#", SOURCE_DB_SCHEMA).to("mock:delete");
-            
from("direct:result").to("cql://{{cassandra.host}}/{{cassandra.keyspace}}?cql=select
 * from dbzSink.products").to("mock:result");
+            
from("direct:result").to("cql:{{cassandra.node}}/{{cassandra.keyspace}}?cql=select
 * from dbzSink.products").to("mock:result");
         }
     }
 }
diff --git a/examples/kafka/pom.xml b/examples/kafka/pom.xml
index ade4a26..b64b9fc 100644
--- a/examples/kafka/pom.xml
+++ b/examples/kafka/pom.xml
@@ -91,15 +91,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>kafka</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-kafka</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/kafka/src/main/java/org/apache/camel/example/kafka/MessagePublisherClient.java
 
b/examples/kafka/src/main/java/org/apache/camel/example/kafka/MessagePublisherClient.java
index 00f9fc1..3b36b47 100644
--- 
a/examples/kafka/src/main/java/org/apache/camel/example/kafka/MessagePublisherClient.java
+++ 
b/examples/kafka/src/main/java/org/apache/camel/example/kafka/MessagePublisherClient.java
@@ -119,7 +119,7 @@ public final class MessagePublisherClient {
     static void setUpKafkaComponent(CamelContext camelContext) {
         // setup kafka component with the brokers
         ComponentsBuilderFactory.kafka()
-                .brokers("{{kafka.host}}:{{kafka.port}}")
+                .brokers("{{kafka.brokers}}")
                 .register(camelContext, "kafka");
     }
 
diff --git a/examples/kafka/src/main/resources/application.properties 
b/examples/kafka/src/main/resources/application.properties
index ab11ae6..b3fad90 100644
--- a/examples/kafka/src/main/resources/application.properties
+++ b/examples/kafka/src/main/resources/application.properties
@@ -17,8 +17,7 @@
 
 ## Modify value of kafka.host and kafka.port before running application
 
-kafka.host=localhost
-kafka.port=9092
+kafka.brokers=localhost:9092
 
 # Producer properties
 producer.topic=TestLog
diff --git 
a/examples/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java 
b/examples/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java
index 5dfb813..70ba238 100644
--- a/examples/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java
+++ b/examples/kafka/src/test/java/org/apache/camel/example/kafka/KafkaTest.java
@@ -22,13 +22,12 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.CamelContext;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.test.infra.kafka.services.KafkaService;
+import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.KafkaContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static 
org.apache.camel.example.kafka.MessagePublisherClient.setUpKafkaComponent;
 import static org.apache.camel.util.PropertiesHelper.asProperties;
@@ -37,24 +36,21 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel can produce and consume messages to / from 
a Kafka broker.
  */
-@Testcontainers
 class KafkaTest extends CamelTestSupport {
 
-    private static final String IMAGE = "confluentinc/cp-kafka:6.2.2";
-
-    @Container
-    private final KafkaContainer container = new 
KafkaContainer(DockerImageName.parse(IMAGE));
+    @RegisterExtension
+    private static final KafkaService SERVICE = 
KafkaServiceFactory.createService();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
         // Set the location of the configuration
         
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
+
         // Override the host and port of the broker
         camelContext.getPropertiesComponent().setOverrideProperties(
             asProperties(
-                "kafka.host", container.getHost(),
-                "kafka.port", Integer.toString(container.getMappedPort(9093))
+                "kafka.brokers", SERVICE.getBootstrapServers()
             )
         );
         setUpKafkaComponent(camelContext);
diff --git a/examples/mongodb/pom.xml b/examples/mongodb/pom.xml
index 4548bde..5152844 100644
--- a/examples/mongodb/pom.xml
+++ b/examples/mongodb/pom.xml
@@ -83,15 +83,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>mongodb</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-mongodb</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/examples/mongodb/src/test/java/org/apache/camel/example/mongodb/MongoDBTest.java
 
b/examples/mongodb/src/test/java/org/apache/camel/example/mongodb/MongoDBTest.java
index 647c82e..be6f62b 100644
--- 
a/examples/mongodb/src/test/java/org/apache/camel/example/mongodb/MongoDBTest.java
+++ 
b/examples/mongodb/src/test/java/org/apache/camel/example/mongodb/MongoDBTest.java
@@ -23,12 +23,11 @@ import com.mongodb.client.MongoClients;
 import io.restassured.response.Response;
 import org.apache.camel.main.MainConfigurationProperties;
 import org.apache.camel.spi.Registry;
+import org.apache.camel.test.infra.mongodb.services.MongoDBService;
+import org.apache.camel.test.infra.mongodb.services.MongoDBServiceFactory;
 import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.MongoDBContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static io.restassured.RestAssured.given;
 import static org.hamcrest.Matchers.containsString;
@@ -38,22 +37,16 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel can execute CRUD operations against MongoDB.
  */
-@Testcontainers
 class MongoDBTest extends CamelMainTestSupport {
 
-    private static final String IMAGE = "mongo:5.0";
-
     private static final String BASE_URI = "http://localhost:8081";;
 
-    @Container
-    private final MongoDBContainer container = new 
MongoDBContainer(DockerImageName.parse(IMAGE));
+    @RegisterExtension
+    private static final MongoDBService SERVICE = 
MongoDBServiceFactory.createService();
 
     @Override
     protected void bindToRegistry(Registry registry) throws Exception {
-        registry.bind(
-            "myDb",
-            MongoClients.create(String.format("mongodb://%s:%d", 
container.getHost(), container.getMappedPort(27017)))
-        );
+        registry.bind("myDb", MongoClients.create(SERVICE.getReplicaSetUrl()));
     }
 
     @Test
diff --git a/examples/spring-pulsar/pom.xml b/examples/spring-pulsar/pom.xml
index 768a71f..8a891a7 100644
--- a/examples/spring-pulsar/pom.xml
+++ b/examples/spring-pulsar/pom.xml
@@ -98,15 +98,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>pulsar</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-pulsar</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/examples/spring-pulsar/src/main/resources/camel-common.xml 
b/examples/spring-pulsar/src/main/resources/camel-common.xml
index a56cc51..5b4c133 100644
--- a/examples/spring-pulsar/src/main/resources/camel-common.xml
+++ b/examples/spring-pulsar/src/main/resources/camel-common.xml
@@ -29,10 +29,8 @@
     <!-- let Spring do its IoC stuff in this package -->
     <context:component-scan 
base-package="org.apache.camel.example.pulsar.common"/>
 
-    <!-- spring property placeholder, ignore resource not found as the file 
resource is for unit testing -->
-    <context:property-placeholder location="file:target/custom.properties"
-                                  ignore-resource-not-found="true"/>
-
+    <!-- Allow using placeholders -->
+    <bean id="placeholder" 
class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
     <bean id="myTypeConverters" 
class="org.apache.camel.example.pulsar.common.TypeConverters"/>
 
     <!-- pulsar configurations -->
@@ -40,14 +38,14 @@
         <value>standalone</value>
     </util:set>
     <bean id="pulsarAdminHost" class="java.lang.String">
-        <constructor-arg value="${serviceUrl:http://localhost:8080}"/>
+        <constructor-arg value="${pulsar.admin.url:http://localhost:8080}"/>
     </bean>
     <bean id="autoconfig" 
class="org.apache.camel.component.pulsar.utils.AutoConfiguration">
         <constructor-arg ref="pulsarAdmin"/>
         <constructor-arg ref="clusters"/>
     </bean>
     <bean id="pulsarClientConfig" 
class="org.apache.pulsar.client.impl.conf.ClientConfigurationData">
-        <property name="serviceUrl" 
value="${brokerUrl:pulsar://localhost:6650}"/>
+        <property name="serviceUrl" 
value="${pulsar.broker.url:pulsar://localhost:6650}"/>
     </bean>
     <bean id="pulsarClientBuilder" 
class="org.apache.pulsar.client.impl.ClientBuilderImpl">
         <constructor-arg ref="pulsarClientConfig"/>
diff --git 
a/examples/spring-pulsar/src/test/java/org/apache/camel/example/SpringPulsarTest.java
 
b/examples/spring-pulsar/src/test/java/org/apache/camel/example/SpringPulsarTest.java
index 0f2c8d0..29bb5ba 100644
--- 
a/examples/spring-pulsar/src/test/java/org/apache/camel/example/SpringPulsarTest.java
+++ 
b/examples/spring-pulsar/src/test/java/org/apache/camel/example/SpringPulsarTest.java
@@ -16,19 +16,16 @@
  */
 package org.apache.camel.example;
 
-import java.nio.file.Files;
-import java.nio.file.Paths;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.test.infra.pulsar.services.PulsarService;
+import org.apache.camel.test.infra.pulsar.services.PulsarServiceFactory;
 import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.testcontainers.containers.PulsarContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
 
 import static org.apache.camel.example.pulsar.client.CamelClient.ENDPOINT_URI;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -36,23 +33,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  *  A unit test checking that Camel can exchange messages with Apache Pulsar.
  */
-@Testcontainers
 class SpringPulsarTest extends CamelSpringTestSupport {
 
-    private static final String IMAGE = "apachepulsar/pulsar";
-
-    @Container
-    private final PulsarContainer container = new 
PulsarContainer(DockerImageName.parse(IMAGE));
-
-    @Override
-    protected void setupResources() throws Exception {
-        super.setupResources();
-        final String fileContent = String.format(
-            "serviceUrl=%s%nbrokerUrl=%s%n", container.getHttpServiceUrl(),
-            container.getPulsarBrokerUrl()
-        );
-        Files.writeString(Paths.get("target/custom.properties"), fileContent);
-    }
+    @RegisterExtension
+    private static final PulsarService SERVICE = 
PulsarServiceFactory.createService();
 
     @Override
     protected AbstractApplicationContext createApplicationContext() {
diff --git a/examples/vertx-kafka/pom.xml b/examples/vertx-kafka/pom.xml
index 5aad0c3..74b690c 100644
--- a/examples/vertx-kafka/pom.xml
+++ b/examples/vertx-kafka/pom.xml
@@ -99,15 +99,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>kafka</artifactId>
-            <version>${testcontainers-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${testcontainers-version}</version>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-infra-kafka</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/vertx-kafka/src/main/java/org/apache/camel/example/vertx/kafka/MessagePublisherClient.java
 
b/examples/vertx-kafka/src/main/java/org/apache/camel/example/vertx/kafka/MessagePublisherClient.java
index e3f9f49..7da7d9a 100644
--- 
a/examples/vertx-kafka/src/main/java/org/apache/camel/example/vertx/kafka/MessagePublisherClient.java
+++ 
b/examples/vertx-kafka/src/main/java/org/apache/camel/example/vertx/kafka/MessagePublisherClient.java
@@ -112,7 +112,7 @@ public final class MessagePublisherClient {
     static void setUpKafkaComponent(CamelContext camelContext) {
         // setup kafka component with the brokers using component DSL
         ComponentsBuilderFactory.vertxKafka()
-                .bootstrapServers("{{kafka.host}}:{{kafka.port}}")
+                .bootstrapServers("{{kafka.brokers}}")
                 .register(camelContext, "vertx-kafka");
     }
 }
diff --git a/examples/vertx-kafka/src/main/resources/application.properties 
b/examples/vertx-kafka/src/main/resources/application.properties
index 3b0af4f..edbc41c 100644
--- a/examples/vertx-kafka/src/main/resources/application.properties
+++ b/examples/vertx-kafka/src/main/resources/application.properties
@@ -17,8 +17,7 @@
 
 ## Modify value of kafka.host and kafka.port before running application
 
-kafka.host=localhost
-kafka.port=9092
+kafka.brokers=localhost:9092
 
 # Producer properties
 producer.topic=TestLog
diff --git 
a/examples/vertx-kafka/src/test/java/org/apache/camel/example/vertx/kafka/VertxKafkaTest.java
 
b/examples/vertx-kafka/src/test/java/org/apache/camel/example/vertx/kafka/VertxKafkaTest.java
index a66b741..fccd816 100644
--- 
a/examples/vertx-kafka/src/test/java/org/apache/camel/example/vertx/kafka/VertxKafkaTest.java
+++ 
b/examples/vertx-kafka/src/test/java/org/apache/camel/example/vertx/kafka/VertxKafkaTest.java
@@ -22,13 +22,12 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.CamelContext;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.test.infra.kafka.services.KafkaService;
+import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.testcontainers.containers.KafkaContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-import org.testcontainers.utility.DockerImageName;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import static 
org.apache.camel.example.vertx.kafka.MessagePublisherClient.setUpKafkaComponent;
 import static org.apache.camel.util.PropertiesHelper.asProperties;
@@ -38,13 +37,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  * A unit test checking that Camel can produce and consume messages to / from 
a Kafka broker using the Kafka Vertx
  * component.
  */
-@Testcontainers
 class VertxKafkaTest extends CamelTestSupport {
 
-    private static final String IMAGE = "confluentinc/cp-kafka:6.2.2";
-
-    @Container
-    private final KafkaContainer container = new 
KafkaContainer(DockerImageName.parse(IMAGE));
+    @RegisterExtension
+    private static final KafkaService SERVICE = 
KafkaServiceFactory.createService();
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
@@ -54,8 +50,7 @@ class VertxKafkaTest extends CamelTestSupport {
         // Override the host and port of the broker
         camelContext.getPropertiesComponent().setOverrideProperties(
             asProperties(
-                "kafka.host", container.getHost(),
-                "kafka.port", Integer.toString(container.getMappedPort(9093))
+                "kafka.brokers", SERVICE.getBootstrapServers()
             )
         );
         setUpKafkaComponent(camelContext);

Reply via email to