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 bd8bb4f  CAMEL-17574: Migrate tests to use camel-test-main-junit5 (#74)
bd8bb4f is described below

commit bd8bb4f42b385ed83139fa824c05e9024602cf76
Author: Nicolas Filotto <essob...@users.noreply.github.com>
AuthorDate: Fri Feb 18 13:04:38 2022 +0100

    CAMEL-17574: Migrate tests to use camel-test-main-junit5 (#74)
---
 examples/artemis/pom.xml                           |  2 +-
 .../apache/camel/example/artemis/ArtemisTest.java  | 25 +++++++-------
 .../org/apache/camel/example/AwsS3KafkaTest.java   | 27 ++++++++-------
 .../java/org/apache/camel/example/AwsS3Test.java   | 13 ++++---
 .../java/org/apache/camel/example/AwsS3Test.java   | 13 ++++---
 .../java/org/apache/camel/example/AwsSQSTest.java  | 13 ++++---
 .../org/apache/camel/example/KafkaAwsS3Test.java   | 27 ++++++++-------
 .../org/apache/camel/example/KafkaAwsS3Test.java   | 27 ++++++++-------
 examples/aws/pom.xml                               |  2 +-
 examples/couchbase-log/pom.xml                     |  2 +-
 .../org/apache/camel/example/CouchbaseTest.java    | 28 ++++++---------
 examples/csimple-joor/pom.xml                      |  2 +-
 .../org/apache/camel/example/CSimpleJOORTest.java  | 10 +++---
 examples/csimple/pom.xml                           |  2 +-
 .../java/org/apache/camel/example/CSimpleTest.java | 10 +++---
 examples/debezium/pom.xml                          |  2 +-
 .../camel/example/debezium/DebeziumTest.java       | 38 ++++++++++----------
 examples/ftp/pom.xml                               |  2 +-
 .../java/org/apache/camel/example/ftp/FtpTest.java | 29 +++++++---------
 examples/java8/pom.xml                             |  2 +-
 .../org/apache/camel/example/java8/Java8Test.java  | 10 +++---
 examples/kamelet-chucknorris/pom.xml               |  2 +-
 .../camel/example/KameletChuckNorrisTest.java      | 25 ++++----------
 examples/kamelet-main/pom.xml                      |  2 +-
 .../org/apache/camel/example/KameletMainTest.java  | 21 +++---------
 examples/kamelet/pom.xml                           |  2 +-
 .../java/org/apache/camel/example/KameletTest.java | 10 +++---
 examples/kotlin/pom.xml                            |  2 +-
 .../kotlin/org/apache/camel/example/KotlinTest.kt  | 10 +++---
 examples/main-artemis/pom.xml                      |  2 +-
 .../org/apache/camel/example/MainArtemisTest.java  | 30 +++++++---------
 examples/main-endpointdsl/pom.xml                  |  2 +-
 .../apache/camel/example/MainEndpointDSLTest.java  | 16 ++++-----
 examples/main-health/pom.xml                       |  2 +-
 .../org/apache/camel/example/MainHealthTest.java   | 34 +++++++++---------
 examples/main-joor/pom.xml                         |  2 +-
 .../org/apache/camel/example/MainJOORTest.java     | 16 ++++-----
 examples/main-lambda/pom.xml                       |  2 +-
 .../org/apache/camel/example/MainLambdaTest.java   | 39 ++++++---------------
 examples/main-tiny/pom.xml                         |  2 +-
 .../org/apache/camel/example/MainTinyTest.java     | 26 +++++---------
 examples/main-xml/pom.xml                          |  2 +-
 .../java/org/apache/camel/example/MainXMLTest.java | 40 +++++-----------------
 examples/main-yaml/pom.xml                         |  2 +-
 .../org/apache/camel/example/MainYAMLTest.java     | 38 ++++----------------
 examples/main/pom.xml                              |  2 +-
 .../java/org/apache/camel/example/MainTest.java    | 29 ++++------------
 examples/mongodb/pom.xml                           |  2 +-
 .../apache/camel/example/mongodb/MongoDBTest.java  | 29 +++++++---------
 examples/netty-custom-correlation/pom.xml          |  2 +-
 .../org/apache/camel/example/netty/NettyTest.java  | 27 +++++++--------
 examples/reactive-executor-vertx/pom.xml           |  2 +-
 .../java/org/apache/camel/example/VertxTest.java   | 22 ++++++------
 examples/routeloader/pom.xml                       |  2 +-
 .../org/apache/camel/example/RouteLoaderTest.java  | 25 +++-----------
 examples/routes-configuration/pom.xml              |  2 +-
 .../camel/example/RoutesConfigurationTest.java     | 29 ++++------------
 examples/routetemplate-xml/pom.xml                 |  2 +-
 .../apache/camel/example/RouteTemplateXMLTest.java | 27 ++++-----------
 examples/routetemplate/pom.xml                     |  2 +-
 .../apache/camel/example/RouteTemplateTest.java    | 14 ++++----
 examples/twitter-websocket/pom.xml                 |  2 +-
 .../websocket/CamelTwitterWebSocketMain.java       |  4 +--
 .../websocket/CamelTwitterWebSocketTest.java       | 10 +++---
 examples/widget-gadget-java/pom.xml                |  2 +-
 .../camel/example/widget/WidgetGadgetTest.java     | 23 ++++++-------
 66 files changed, 343 insertions(+), 531 deletions(-)

diff --git a/examples/artemis/pom.xml b/examples/artemis/pom.xml
index 64be097..c8ef1e6 100644
--- a/examples/artemis/pom.xml
+++ b/examples/artemis/pom.xml
@@ -102,7 +102,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/artemis/src/test/java/org/apache/camel/example/artemis/ArtemisTest.java
 
b/examples/artemis/src/test/java/org/apache/camel/example/artemis/ArtemisTest.java
index a597b55..926e3c0 100644
--- 
a/examples/artemis/src/test/java/org/apache/camel/example/artemis/ArtemisTest.java
+++ 
b/examples/artemis/src/test/java/org/apache/camel/example/artemis/ArtemisTest.java
@@ -19,10 +19,10 @@ package org.apache.camel.example.artemis;
 import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -37,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  * A unit test checking that the Widget and Gadget use-case from the 
Enterprise Integration Patterns book works
  * properly using Apache ActiveMQ Artemis.
  */
-class ArtemisTest extends CamelTestSupport {
+class ArtemisTest extends CamelMainTestSupport {
 
     private static ActiveMQServer SERVER;
 
@@ -61,13 +61,8 @@ class ArtemisTest extends CamelTestSupport {
     }
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        // create CamelContext
-        CamelContext camelContext = super.createCamelContext();
-        // connect to ActiveMQ Artemis JMS broker
-        camelContext.addComponent("jms", ArtemisMain.createArtemisComponent());
-
-        return camelContext;
+    protected void bindToRegistry(Registry registry) throws Exception {
+        registry.bind("jms", ArtemisMain.createArtemisComponent());
     }
 
     @Test
@@ -85,7 +80,11 @@ class ArtemisTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new CreateOrderRoute(), new 
WidgetGadgetRoute()};
+    protected void configure(MainConfigurationProperties configuration) {
+        // add the widget/gadget route
+        configuration.addRoutesBuilder(new WidgetGadgetRoute());
+
+        // add a 2nd route that routes files from src/data to the order queue
+        configuration.addRoutesBuilder(new CreateOrderRoute());
     }
 }
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 e02d9a4..9c031b8 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
@@ -16,15 +16,16 @@
  */
 package org.apache.camel.example;
 
+import java.util.Properties;
 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.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.component.aws2.s3.AWS2S3Constants;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -44,7 +45,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can poll an Amazon S3 bucket and put the 
data into a Kafka topic.
  */
-class AwsS3KafkaTest extends CamelTestSupport {
+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";
@@ -74,8 +75,6 @@ class AwsS3KafkaTest extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
         s3.getConfiguration().setAmazonS3Client(
                 S3Client.builder()
@@ -88,15 +87,16 @@ class AwsS3KafkaTest extends CamelTestSupport {
                 .region(Region.of(AWS_CONTAINER.getRegion()))
                 .build()
         );
-        // Override the host and port of the broker
-        camelContext.getPropertiesComponent().setOverrideProperties(
-            asProperties(
-                "kafkaBrokers", String.format("%s:%d", 
KAFKA_CONTAINER.getHost(), KAFKA_CONTAINER.getMappedPort(9093))
-            )
-        );
         return camelContext;
     }
 
+    @Override
+    protected Properties useOverridePropertiesWithPropertiesComponent() {
+        return asProperties(
+            "kafkaBrokers", String.format("%s:%d", KAFKA_CONTAINER.getHost(), 
KAFKA_CONTAINER.getMappedPort(9093))
+        );
+    }
+
     @Test
     void should_poll_s3_bucket_and_push_to_kafka() {
         // Add a bucket first
@@ -113,8 +113,9 @@ class AwsS3KafkaTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteBuilder(), new 
AddBucketRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
+        configuration.addRoutesBuilder(new AddBucketRouteBuilder());
     }
 
     private static class AddBucketRouteBuilder extends RouteBuilder {
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 02e0c2d..9fd16ce 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
@@ -19,12 +19,12 @@ package org.apache.camel.example;
 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.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
 import org.apache.camel.component.aws2.s3.AWS2S3Constants;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -42,7 +42,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can poll an Amazon S3 bucket.
  */
-class AwsS3Test extends CamelTestSupport {
+class AwsS3Test extends CamelMainTestSupport {
 
     private static final String IMAGE = "localstack/localstack:0.13.3";
     private static LocalStackContainer CONTAINER;
@@ -65,8 +65,6 @@ class AwsS3Test extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
         s3.getConfiguration().setAmazonS3Client(
                 S3Client.builder()
@@ -98,8 +96,9 @@ class AwsS3Test extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteBuilder(), new 
AddBucketRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
+        configuration.addRoutesBuilder(new AddBucketRouteBuilder());
     }
 
     private static class AddBucketRouteBuilder extends RouteBuilder {
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 e4c410f..a54d130 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
@@ -19,10 +19,11 @@ package org.apache.camel.example;
 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.component.aws2.s3.AWS2S3Component;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -40,7 +41,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can store content into an Amazon S3 bucket.
  */
-class AwsS3Test extends CamelTestSupport {
+class AwsS3Test extends CamelMainTestSupport {
 
     private static final String IMAGE = "localstack/localstack:0.13.3";
     private static LocalStackContainer CONTAINER;
@@ -63,8 +64,6 @@ class AwsS3Test extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
         s3.getConfiguration().setAmazonS3Client(
                 S3Client.builder()
@@ -89,7 +88,7 @@ class AwsS3Test extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
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 d6fd2a9..8d396fd 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
@@ -19,11 +19,11 @@ package org.apache.camel.example;
 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.builder.RouteBuilder;
 import org.apache.camel.component.aws2.sqs.Sqs2Component;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -41,7 +41,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can consume messages from Amazon SQS.
  */
-class AwsSQSTest extends CamelTestSupport {
+class AwsSQSTest extends CamelMainTestSupport {
 
     private static final String IMAGE = "localstack/localstack:0.13.3";
     private static LocalStackContainer CONTAINER;
@@ -64,8 +64,6 @@ class AwsSQSTest extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         Sqs2Component sqs = camelContext.getComponent("aws2-sqs", 
Sqs2Component.class);
         sqs.getConfiguration().setAmazonSQSClient(
                 SqsClient.builder()
@@ -95,8 +93,9 @@ class AwsSQSTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteBuilder(), new 
PublishMessageRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
+        configuration.addRoutesBuilder(new PublishMessageRouteBuilder());
     }
 
     private static class PublishMessageRouteBuilder extends RouteBuilder {
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 c3f4417..8db62bd 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
@@ -16,14 +16,15 @@
  */
 package org.apache.camel.example;
 
+import java.util.Properties;
 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.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -43,7 +44,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can poll data from a Kafka topic and put it 
into an Amazon S3 bucket.
  */
-class KafkaAwsS3Test extends CamelTestSupport {
+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";
@@ -73,8 +74,6 @@ class KafkaAwsS3Test extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
         s3.getConfiguration().setAmazonS3Client(
                 S3Client.builder()
@@ -87,15 +86,16 @@ class KafkaAwsS3Test extends CamelTestSupport {
                 .region(Region.of(AWS_CONTAINER.getRegion()))
                 .build()
         );
-        // Override the host and port of the broker
-        camelContext.getPropertiesComponent().setOverrideProperties(
-            asProperties(
-                "kafkaBrokers", String.format("%s:%d", 
KAFKA_CONTAINER.getHost(), KAFKA_CONTAINER.getMappedPort(9093))
-            )
-        );
         return camelContext;
     }
 
+    @Override
+    protected Properties useOverridePropertiesWithPropertiesComponent() {
+        return asProperties(
+            "kafkaBrokers", String.format("%s:%d", KAFKA_CONTAINER.getHost(), 
KAFKA_CONTAINER.getMappedPort(9093))
+        );
+    }
+
     @Test
     void should_poll_kafka_and_push_to_s3_bucket() {
         NotifyBuilder notify = new 
NotifyBuilder(context).from("kafka:*").whenCompleted(1).create();
@@ -107,8 +107,9 @@ class KafkaAwsS3Test extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteBuilder(), new 
LoadKafkaRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
+        configuration.addRoutesBuilder(new LoadKafkaRouteBuilder());
     }
 
     private static class LoadKafkaRouteBuilder extends RouteBuilder {
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 4063ee7..78bbe93 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
@@ -16,14 +16,15 @@
  */
 package org.apache.camel.example;
 
+import java.util.Properties;
 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.builder.RouteBuilder;
 import org.apache.camel.component.aws2.s3.AWS2S3Component;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -43,7 +44,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can poll data from a Kafka topic and put it 
into an Amazon S3 bucket.
  */
-class KafkaAwsS3Test extends CamelTestSupport {
+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";
@@ -73,8 +74,6 @@ class KafkaAwsS3Test extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         AWS2S3Component s3 = camelContext.getComponent("aws2-s3", 
AWS2S3Component.class);
         s3.getConfiguration().setAmazonS3Client(
                 S3Client.builder()
@@ -87,15 +86,16 @@ class KafkaAwsS3Test extends CamelTestSupport {
                 .region(Region.of(AWS_CONTAINER.getRegion()))
                 .build()
         );
-        // Override the host and port of the broker
-        camelContext.getPropertiesComponent().setOverrideProperties(
-            asProperties(
-                "kafkaBrokers", String.format("%s:%d", 
KAFKA_CONTAINER.getHost(), KAFKA_CONTAINER.getMappedPort(9093))
-            )
-        );
         return camelContext;
     }
 
+    @Override
+    protected Properties useOverridePropertiesWithPropertiesComponent() {
+        return asProperties(
+            "kafkaBrokers", String.format("%s:%d", KAFKA_CONTAINER.getHost(), 
KAFKA_CONTAINER.getMappedPort(9093))
+        );
+    }
+
     @Test
     void should_poll_kafka_and_push_to_s3_bucket() {
         NotifyBuilder notify = new 
NotifyBuilder(context).from("kafka:*").whenCompleted(2).create();
@@ -108,8 +108,9 @@ class KafkaAwsS3Test extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteBuilder(), new 
LoadKafkaRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
+        configuration.addRoutesBuilder(new LoadKafkaRouteBuilder());
     }
 
     private static class LoadKafkaRouteBuilder extends RouteBuilder {
diff --git a/examples/aws/pom.xml b/examples/aws/pom.xml
index d5b12df..bdaab06 100644
--- a/examples/aws/pom.xml
+++ b/examples/aws/pom.xml
@@ -48,7 +48,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <version>${camel.version}</version>
             <scope>test</scope>
         </dependency>
diff --git a/examples/couchbase-log/pom.xml b/examples/couchbase-log/pom.xml
index 1389925..822d36c 100644
--- a/examples/couchbase-log/pom.xml
+++ b/examples/couchbase-log/pom.xml
@@ -80,7 +80,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
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 443471b..2e64b6f 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
@@ -16,35 +16,34 @@
  */
 package org.apache.camel.example;
 
+import java.time.Duration;
+import java.util.Collections;
+import java.util.Properties;
+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.view.DesignDocument;
 import com.couchbase.client.java.manager.view.View;
 import com.couchbase.client.java.view.DesignDocumentNamespace;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.component.couchbase.CouchbaseConstants;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 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 java.time.Duration;
-import java.util.Collections;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel consume data from Couchbase.
  */
-class CouchbaseTest extends CamelTestSupport {
+class CouchbaseTest extends CamelMainTestSupport {
 
     private static final String IMAGE = "couchbase/server:7.0.3";
     private static final String BUCKET = "test-bucket-" + 
System.currentTimeMillis();
@@ -90,13 +89,6 @@ class CouchbaseTest extends CamelTestSupport {
     }
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
-        return camelContext;
-    }
-
-    @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
         return asProperties(
             "couchbase.host", CONTAINER.getHost(),
@@ -122,7 +114,7 @@ class CouchbaseTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/csimple-joor/pom.xml b/examples/csimple-joor/pom.xml
index 7bf5639..a65c656 100644
--- a/examples/csimple-joor/pom.xml
+++ b/examples/csimple-joor/pom.xml
@@ -92,7 +92,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/csimple-joor/src/test/java/org/apache/camel/example/CSimpleJOORTest.java
 
b/examples/csimple-joor/src/test/java/org/apache/camel/example/CSimpleJOORTest.java
index 98a26aa..efabe48 100644
--- 
a/examples/csimple-joor/src/test/java/org/apache/camel/example/CSimpleJOORTest.java
+++ 
b/examples/csimple-joor/src/test/java/org/apache/camel/example/CSimpleJOORTest.java
@@ -16,9 +16,9 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
 import java.util.Properties;
@@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that the compiled simple expressions using jooR 
compiler are evaluated as expected.
  */
-class CSimpleJOORTest extends CamelTestSupport {
+class CSimpleJOORTest extends CamelMainTestSupport {
 
 
     @Override
@@ -48,7 +48,7 @@ class CSimpleJOORTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/csimple/pom.xml b/examples/csimple/pom.xml
index 2092f2b..d8db0c3 100644
--- a/examples/csimple/pom.xml
+++ b/examples/csimple/pom.xml
@@ -85,7 +85,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/csimple/src/test/java/org/apache/camel/example/CSimpleTest.java 
b/examples/csimple/src/test/java/org/apache/camel/example/CSimpleTest.java
index 3be3d7e..b6b5643 100644
--- a/examples/csimple/src/test/java/org/apache/camel/example/CSimpleTest.java
+++ b/examples/csimple/src/test/java/org/apache/camel/example/CSimpleTest.java
@@ -16,9 +16,9 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
 import java.util.Properties;
@@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that the compiled simple expressions are evaluated as 
expected.
  */
-class CSimpleTest extends CamelTestSupport {
+class CSimpleTest extends CamelMainTestSupport {
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
@@ -47,7 +47,7 @@ class CSimpleTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/debezium/pom.xml b/examples/debezium/pom.xml
index 47dac9e..3090864 100644
--- a/examples/debezium/pom.xml
+++ b/examples/debezium/pom.xml
@@ -95,7 +95,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
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 52fe8c8..7cdd8bf 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
@@ -20,14 +20,15 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
 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.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -54,7 +55,7 @@ import static 
org.testcontainers.containers.localstack.LocalStackContainer.Servi
 /**
  * A unit test checking that Camel can propagate changes from one Database to 
another thanks to Debezium.
  */
-class DebeziumTest extends CamelTestSupport {
+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";
@@ -101,8 +102,6 @@ class DebeziumTest extends CamelTestSupport {
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
-        // Set the location of the configuration
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
         Kinesis2Component component = 
camelContext.getComponent("aws2-kinesis", Kinesis2Component.class);
         KinesisClient kinesisClient = KinesisClient.builder()
                 .endpointOverride(AWS_CONTAINER.getEndpointOverride(KINESIS))
@@ -116,17 +115,19 @@ class DebeziumTest extends CamelTestSupport {
         // Create the stream
         
kinesisClient.createStream(CreateStreamRequest.builder().streamName("camel-debezium-example").shardCount(1).build());
         component.getConfiguration().setAmazonKinesisClient(kinesisClient);
+        return camelContext;
+    }
+
+    @Override
+    protected Properties useOverridePropertiesWithPropertiesComponent() {
         // Override the host and port of the broker
-        camelContext.getPropertiesComponent().setOverrideProperties(
-            asProperties(
-                "debezium.postgres.databaseHostName", 
PGSQL_CONTAINER.getHost(),
-                "debezium.postgres.databasePort", 
Integer.toString(PGSQL_CONTAINER.getMappedPort(5432)),
-                "debezium.postgres.databaseUser", SOURCE_DB_USERNAME,
-                "debezium.postgres.databasePassword", SOURCE_DB_PASSWORD,
-                "cassandra.host", String.format("%s:%d", 
CASSANDRA_CONTAINER.getHost(), CASSANDRA_CONTAINER.getMappedPort(9042))
-            )
+        return asProperties(
+            "debezium.postgres.databaseHostName", PGSQL_CONTAINER.getHost(),
+            "debezium.postgres.databasePort", 
Integer.toString(PGSQL_CONTAINER.getMappedPort(5432)),
+            "debezium.postgres.databaseUser", SOURCE_DB_USERNAME,
+            "debezium.postgres.databasePassword", SOURCE_DB_PASSWORD,
+            "cassandra.host", String.format("%s:%d", 
CASSANDRA_CONTAINER.getHost(), CASSANDRA_CONTAINER.getMappedPort(9042))
         );
-        return camelContext;
     }
 
     @Test
@@ -161,11 +162,10 @@ class DebeziumTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{
-                DebeziumPgSQLConsumerToKinesis.createRouteBuilder(), 
KinesisProducerToCassandra.createRouteBuilder(),
-            new ApplyChangesToPgSQLRouteBuilder()
-        };
+    protected void configure(MainConfigurationProperties configuration) {
+        
configuration.addRoutesBuilder(DebeziumPgSQLConsumerToKinesis.createRouteBuilder());
+        
configuration.addRoutesBuilder(KinesisProducerToCassandra.createRouteBuilder());
+        configuration.addRoutesBuilder(new ApplyChangesToPgSQLRouteBuilder());
     }
 
     private static class ApplyChangesToPgSQLRouteBuilder extends RouteBuilder {
diff --git a/examples/ftp/pom.xml b/examples/ftp/pom.xml
index 12fb655..604ad59 100644
--- a/examples/ftp/pom.xml
+++ b/examples/ftp/pom.xml
@@ -85,7 +85,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/examples/ftp/src/test/java/org/apache/camel/example/ftp/FtpTest.java 
b/examples/ftp/src/test/java/org/apache/camel/example/ftp/FtpTest.java
index b75ecb6..53cd31b 100644
--- a/examples/ftp/src/test/java/org/apache/camel/example/ftp/FtpTest.java
+++ b/examples/ftp/src/test/java/org/apache/camel/example/ftp/FtpTest.java
@@ -16,10 +16,15 @@
  */
 package org.apache.camel.example.ftp;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.apache.ftpserver.FtpServer;
 import org.apache.ftpserver.FtpServerFactory;
 import org.apache.ftpserver.filesystem.nativefs.NativeFileSystemFactory;
@@ -32,19 +37,13 @@ import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can read/write from/to a ftp server.
  */
-class FtpTest extends CamelTestSupport {
+class FtpTest extends CamelMainTestSupport {
 
     private static FtpServer SERVER;
     private static int PORT;
@@ -83,10 +82,8 @@ class FtpTest extends CamelTestSupport {
     }
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        
camelContext.getPropertiesComponent().setLocation("classpath:ftp.properties");
-        return camelContext;
+    protected String getPropertyPlaceholderLocations() {
+        return "classpath:ftp.properties";
     }
 
     @Override
@@ -119,7 +116,7 @@ class FtpTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyFtpClientRouteBuilder(), new 
MyFtpServerRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyFtpClientRouteBuilder.class, 
MyFtpServerRouteBuilder.class);
     }
 }
diff --git a/examples/java8/pom.xml b/examples/java8/pom.xml
index edbab93..fd8d448 100644
--- a/examples/java8/pom.xml
+++ b/examples/java8/pom.xml
@@ -96,7 +96,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/java8/src/test/java/org/apache/camel/example/java8/Java8Test.java 
b/examples/java8/src/test/java/org/apache/camel/example/java8/Java8Test.java
index 6913a72..a0c8c47 100644
--- a/examples/java8/src/test/java/org/apache/camel/example/java8/Java8Test.java
+++ b/examples/java8/src/test/java/org/apache/camel/example/java8/Java8Test.java
@@ -16,9 +16,9 @@
  */
 package org.apache.camel.example.java8;
 
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
 import java.util.concurrent.TimeUnit;
@@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel supports properly lambda expressions and 
method references.
  */
-class Java8Test extends CamelTestSupport {
+class Java8Test extends CamelMainTestSupport {
 
     @Test
     void should_be_evaluated() {
@@ -40,7 +40,7 @@ class Java8Test extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyApplication.MyRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(new MyApplication.MyRouteBuilder());
     }
 }
diff --git a/examples/kamelet-chucknorris/pom.xml 
b/examples/kamelet-chucknorris/pom.xml
index ff4baf4..5004969 100644
--- a/examples/kamelet-chucknorris/pom.xml
+++ b/examples/kamelet-chucknorris/pom.xml
@@ -97,7 +97,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/kamelet-chucknorris/src/test/java/org/apache/camel/example/KameletChuckNorrisTest.java
 
b/examples/kamelet-chucknorris/src/test/java/org/apache/camel/example/KameletChuckNorrisTest.java
index 7b575ba..447ad03 100644
--- 
a/examples/kamelet-chucknorris/src/test/java/org/apache/camel/example/KameletChuckNorrisTest.java
+++ 
b/examples/kamelet-chucknorris/src/test/java/org/apache/camel/example/KameletChuckNorrisTest.java
@@ -16,24 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can use a simple Kamelet.
  */
-class KameletChuckNorrisTest extends CamelTestSupport {
+class KameletChuckNorrisTest extends CamelMainTestSupport {
 
     @Test
     void should_use_a_simple_kamelet() {
@@ -44,13 +39,7 @@ class KameletChuckNorrisTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        final List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        for (Resource resource : resolver.findResources("camel/*")) {
-            
routesBuilders.addAll(ecc.getRoutesLoader().findRoutesBuilders(resource));
-        }
-        return routesBuilders.toArray(RoutesBuilder[]::new);
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.withRoutesIncludePattern("camel/*");
     }
 }
diff --git a/examples/kamelet-main/pom.xml b/examples/kamelet-main/pom.xml
index 3c1323a..c4514ab 100644
--- a/examples/kamelet-main/pom.xml
+++ b/examples/kamelet-main/pom.xml
@@ -79,7 +79,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <!-- Dependencies of the Kamelet that we need to add explicitly for 
the test -->
diff --git 
a/examples/kamelet-main/src/test/java/org/apache/camel/example/KameletMainTest.java
 
b/examples/kamelet-main/src/test/java/org/apache/camel/example/KameletMainTest.java
index fca0bfc..653effc 100644
--- 
a/examples/kamelet-main/src/test/java/org/apache/camel/example/KameletMainTest.java
+++ 
b/examples/kamelet-main/src/test/java/org/apache/camel/example/KameletMainTest.java
@@ -16,18 +16,13 @@
  */
 package org.apache.camel.example;
 
-import java.util.ArrayList;
-import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.component.kamelet.KameletComponent;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -35,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel can use a simple Kamelet from the catalog.
  */
-class KameletMainTest extends CamelTestSupport {
+class KameletMainTest extends CamelMainTestSupport {
 
     @Test
     void should_use_a_simple_kamelet_from_catalog() {
@@ -55,13 +50,7 @@ class KameletMainTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        final List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        for (Resource resource : resolver.findResources("camel/*")) {
-            
routesBuilders.addAll(ecc.getRoutesLoader().findRoutesBuilders(resource));
-        }
-        return routesBuilders.toArray(RoutesBuilder[]::new);
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.withRoutesIncludePattern("camel/*");
     }
 }
diff --git a/examples/kamelet/pom.xml b/examples/kamelet/pom.xml
index b97c172..a73a2dd 100644
--- a/examples/kamelet/pom.xml
+++ b/examples/kamelet/pom.xml
@@ -84,7 +84,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/kamelet/src/test/java/org/apache/camel/example/KameletTest.java 
b/examples/kamelet/src/test/java/org/apache/camel/example/KameletTest.java
index ed7c19c..7b7b036 100644
--- a/examples/kamelet/src/test/java/org/apache/camel/example/KameletTest.java
+++ b/examples/kamelet/src/test/java/org/apache/camel/example/KameletTest.java
@@ -16,9 +16,9 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
 import java.util.concurrent.TimeUnit;
@@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel can build routes thanks to Kamelet.
  */
-class KameletTest extends CamelTestSupport {
+class KameletTest extends CamelMainTestSupport {
 
     @Test
     void should_build_routes_from_kamelets() {
@@ -40,7 +40,7 @@ class KameletTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteTemplates(), new MyRoutes()};
+    protected void configure(MainConfigurationProperties configuration) {
+        
configuration.withBasePackageScan(MyApplication.class.getPackageName());
     }
 }
diff --git a/examples/kotlin/pom.xml b/examples/kotlin/pom.xml
index 55fbd75..1f1b9e5 100644
--- a/examples/kotlin/pom.xml
+++ b/examples/kotlin/pom.xml
@@ -93,7 +93,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/examples/kotlin/src/test/kotlin/org/apache/camel/example/KotlinTest.kt 
b/examples/kotlin/src/test/kotlin/org/apache/camel/example/KotlinTest.kt
index 85510b4..b507a18 100644
--- a/examples/kotlin/src/test/kotlin/org/apache/camel/example/KotlinTest.kt
+++ b/examples/kotlin/src/test/kotlin/org/apache/camel/example/KotlinTest.kt
@@ -19,8 +19,8 @@ package org.apache.camel.example
 import io.restassured.module.kotlin.extensions.Given
 import io.restassured.module.kotlin.extensions.Then
 import io.restassured.module.kotlin.extensions.When
-import org.apache.camel.RoutesBuilder
-import org.apache.camel.test.junit5.CamelTestSupport
+import org.apache.camel.main.MainConfigurationProperties
+import org.apache.camel.test.main.junit5.CamelMainTestSupport
 import org.apache.http.HttpStatus
 import org.hamcrest.Matchers.equalTo
 import org.junit.jupiter.api.Test
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test
 /**
  * A unit test checking that Camel supports Kotlin.
  */
-class KotlinTest: CamelTestSupport() {
+class KotlinTest: CamelMainTestSupport() {
 
     @Test
     fun `should support kotlin`() {
@@ -42,7 +42,7 @@ class KotlinTest: CamelTestSupport() {
         }
     }
 
-    override fun createRouteBuilder(): RoutesBuilder {
-        return MyRouteBuilder()
+    override fun configure(configuration: MainConfigurationProperties) {
+        configuration.addRoutesBuilder(MyRouteBuilder())
     }
 }
diff --git a/examples/main-artemis/pom.xml b/examples/main-artemis/pom.xml
index 9b2f720..c91230e 100644
--- a/examples/main-artemis/pom.xml
+++ b/examples/main-artemis/pom.xml
@@ -103,7 +103,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java
 
b/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java
index fd9bc55..eafe4c1 100644
--- 
a/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java
+++ 
b/examples/main-artemis/src/test/java/org/apache/camel/example/MainArtemisTest.java
@@ -16,32 +16,31 @@
  */
 package org.apache.camel.example;
 
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.component.jms.JmsComponent;
 import org.apache.camel.component.jms.JmsConfiguration;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
-import org.apache.activemq.artemis.core.config.Configuration;
-
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can send and consume messages to/from 
Apache ActiveMQ Artemis.
  */
-class MainArtemisTest extends CamelTestSupport {
+class MainArtemisTest extends CamelMainTestSupport {
 
     private static ActiveMQServer SERVER;
 
@@ -70,9 +69,7 @@ class MainArtemisTest extends CamelTestSupport {
     }
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        // create CamelContext
-        CamelContext camelContext = super.createCamelContext();
+    protected void bindToRegistry(Registry registry) throws Exception {
         // Sets up the Artemis core protocol connection factory
         ActiveMQConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory("tcp://localhost:61616");
 
@@ -80,9 +77,7 @@ class MainArtemisTest extends CamelTestSupport {
         configuration.setConnectionFactory(connectionFactory);
 
         // connect to ActiveMQ Artemis JMS broker
-        camelContext.addComponent("jms", new JmsComponent(configuration));
-
-        return camelContext;
+        registry.bind("jms", new JmsComponent(configuration));
     }
 
     @Test
@@ -99,7 +94,8 @@ class MainArtemisTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addConfiguration(MyConfiguration.class);
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/main-endpointdsl/pom.xml 
b/examples/main-endpointdsl/pom.xml
index f2c0564..2aacf43 100644
--- a/examples/main-endpointdsl/pom.xml
+++ b/examples/main-endpointdsl/pom.xml
@@ -85,7 +85,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-endpointdsl/src/test/java/org/apache/camel/example/MainEndpointDSLTest.java
 
b/examples/main-endpointdsl/src/test/java/org/apache/camel/example/MainEndpointDSLTest.java
index e081d4f..4ce7e6f 100644
--- 
a/examples/main-endpointdsl/src/test/java/org/apache/camel/example/MainEndpointDSLTest.java
+++ 
b/examples/main-endpointdsl/src/test/java/org/apache/camel/example/MainEndpointDSLTest.java
@@ -16,21 +16,21 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Test;
-
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
+import org.junit.jupiter.api.Test;
+
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel supports routes with endpoints built with 
the endpoint DSL.
  */
-class MainEndpointDSLTest extends CamelTestSupport {
+class MainEndpointDSLTest extends CamelMainTestSupport {
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
@@ -47,7 +47,7 @@ class MainEndpointDSLTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/main-health/pom.xml b/examples/main-health/pom.xml
index 9a62caa..fc5665b 100644
--- a/examples/main-health/pom.xml
+++ b/examples/main-health/pom.xml
@@ -93,7 +93,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java
 
b/examples/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java
index d757629..5025331 100644
--- 
a/examples/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java
+++ 
b/examples/main-health/src/test/java/org/apache/camel/example/MainHealthTest.java
@@ -16,41 +16,39 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.AdviceWith;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel supports custom health-checks.
  */
-class MainHealthTest extends CamelTestSupport {
+class MainHealthTest extends CamelMainTestSupport {
 
     @Override
-    public boolean isUseAdviceWith() {
-        return true;
+    protected Properties useOverridePropertiesWithPropertiesComponent() {
+        return asProperties("myPeriod", Integer.toString(500));
     }
 
     @Override
-    protected Properties useOverridePropertiesWithPropertiesComponent() {
-        return asProperties("myPeriod", Integer.toString(500));
+    @BeforeEach
+    public void setUp() throws Exception {
+        // Prevent failure by replacing the failing endpoint
+        replaceRouteFromWith("netty", "direct:foo");
+        super.setUp();
     }
 
     @Test
     void should_support_custom_health_checks() throws Exception {
-        // Prevent failure by replacing the failing endpoint
-        AdviceWith.adviceWith(context, "netty", ad -> 
ad.replaceFromWith("direct:foo"));
-
-        // must start Camel after we are done using advice-with
-        context.start();
-
         NotifyBuilder notify = new NotifyBuilder(context)
             .whenCompleted(2).whenBodiesDone("Chaos monkey was here", "All is 
okay").create();
         assertTrue(
@@ -59,7 +57,7 @@ class MainHealthTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/main-joor/pom.xml b/examples/main-joor/pom.xml
index 8df22cf..f700b25 100644
--- a/examples/main-joor/pom.xml
+++ b/examples/main-joor/pom.xml
@@ -84,7 +84,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-joor/src/test/java/org/apache/camel/example/MainJOORTest.java 
b/examples/main-joor/src/test/java/org/apache/camel/example/MainJOORTest.java
index 83dbff4..7e50324 100644
--- 
a/examples/main-joor/src/test/java/org/apache/camel/example/MainJOORTest.java
+++ 
b/examples/main-joor/src/test/java/org/apache/camel/example/MainJOORTest.java
@@ -16,21 +16,21 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Test;
-
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
+import org.junit.jupiter.api.Test;
+
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel supports jOOR language in the Camel DSL.
  */
-class MainJOORTest extends CamelTestSupport {
+class MainJOORTest extends CamelMainTestSupport {
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
@@ -46,7 +46,7 @@ class MainJOORTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/main-lambda/pom.xml b/examples/main-lambda/pom.xml
index a959450..c296626 100644
--- a/examples/main-lambda/pom.xml
+++ b/examples/main-lambda/pom.xml
@@ -84,7 +84,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-lambda/src/test/java/org/apache/camel/example/MainLambdaTest.java
 
b/examples/main-lambda/src/test/java/org/apache/camel/example/MainLambdaTest.java
index db6fb8b..9a1185e 100644
--- 
a/examples/main-lambda/src/test/java/org/apache/camel/example/MainLambdaTest.java
+++ 
b/examples/main-lambda/src/test/java/org/apache/camel/example/MainLambdaTest.java
@@ -16,51 +16,32 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.LambdaRouteBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that {@code LambdaRouteBuilder} can be used to define 
routes
  * using lambda style.
  */
-class MainLambdaTest extends CamelTestSupport {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
-        return camelContext;
-    }
-
-    @Override
-    protected void postProcessTest() throws Exception {
-        super.postProcessTest();
-        context.getInjector().newInstance(MyConfiguration.class);
-    }
+class MainLambdaTest extends CamelMainTestSupport {
 
     @Test
     void should_support_routes_defined_using_a_lambda() throws Exception {
-        // We need to add the route manually for the test
-        LambdaRouteBuilder builder = 
context.getRegistry().findByType(LambdaRouteBuilder.class).iterator().next();
-        context.addRoutes(new RouteBuilder(context) {
-            @Override
-            public void configure() throws Exception {
-                builder.accept(this);
-            }
-        });
-        context.start();
         NotifyBuilder notify = new NotifyBuilder(context)
             .whenCompleted(1).whenBodiesDone("Bye World").create();
         assertTrue(
             notify.matches(20, TimeUnit.SECONDS), "1 message should be 
completed"
         );
     }
+
+    @Override
+    protected void configure(MainConfigurationProperties configuration) {
+        
configuration.withBasePackageScan(MyApplication.class.getPackageName());
+    }
 }
diff --git a/examples/main-tiny/pom.xml b/examples/main-tiny/pom.xml
index de9dad5..29173be 100644
--- a/examples/main-tiny/pom.xml
+++ b/examples/main-tiny/pom.xml
@@ -80,7 +80,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-tiny/src/test/java/org/apache/camel/example/MainTinyTest.java 
b/examples/main-tiny/src/test/java/org/apache/camel/example/MainTinyTest.java
index 3b211cf..e2c9da5 100644
--- 
a/examples/main-tiny/src/test/java/org/apache/camel/example/MainTinyTest.java
+++ 
b/examples/main-tiny/src/test/java/org/apache/camel/example/MainTinyTest.java
@@ -16,31 +16,21 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Test;
-
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.camel.builder.NotifyBuilder;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
+import org.junit.jupiter.api.Test;
+
 import static org.apache.camel.util.PropertiesHelper.asProperties;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can work in tiny mode.
  */
-class MainTinyTest extends CamelTestSupport {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        MyBean myBean = new MyBean();
-        myBean.setHi("Hello");
-        camelContext.getRegistry().bind("myBean", myBean);
-        return camelContext;
-    }
+class MainTinyTest extends CamelMainTestSupport {
 
     @Override
     protected Properties useOverridePropertiesWithPropertiesComponent() {
@@ -56,7 +46,7 @@ class MainTinyTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/main-xml/pom.xml b/examples/main-xml/pom.xml
index 14f366a..6509ef0 100644
--- a/examples/main-xml/pom.xml
+++ b/examples/main-xml/pom.xml
@@ -95,7 +95,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-xml/src/test/java/org/apache/camel/example/MainXMLTest.java 
b/examples/main-xml/src/test/java/org/apache/camel/example/MainXMLTest.java
index f565b89..e4aca91 100644
--- a/examples/main-xml/src/test/java/org/apache/camel/example/MainXMLTest.java
+++ b/examples/main-xml/src/test/java/org/apache/camel/example/MainXMLTest.java
@@ -16,37 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * A unit test checking that Camel supports XML routes.
  */
-class MainXMLTest extends CamelTestSupport {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
-        return camelContext;
-    }
-
-    @Override
-    protected void postProcessTest() throws Exception {
-        super.postProcessTest();
-        context.getInjector().newInstance(MyConfiguration.class);
-    }
+class MainXMLTest extends CamelMainTestSupport {
 
     @Test
     void should_support_xml_routes() {
@@ -57,14 +39,8 @@ class MainXMLTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        for (Resource resource : 
resolver.findResources("/routes/my-route.xml")) {
-            // Only one file is expected
-            return 
ecc.getRoutesLoader().findRoutesBuilders(resource).toArray(RoutesBuilder[]::new);
-        }
-        fail("Should find the routes");
-        return null;
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addConfiguration(MyConfiguration.class);
+        configuration.withRoutesIncludePattern("routes/*.xml");
     }
 }
diff --git a/examples/main-yaml/pom.xml b/examples/main-yaml/pom.xml
index f59b5aa..a5384d5 100644
--- a/examples/main-yaml/pom.xml
+++ b/examples/main-yaml/pom.xml
@@ -94,7 +94,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/main-yaml/src/test/java/org/apache/camel/example/MainYAMLTest.java 
b/examples/main-yaml/src/test/java/org/apache/camel/example/MainYAMLTest.java
index d9d2d1c..ce7cf55 100644
--- 
a/examples/main-yaml/src/test/java/org/apache/camel/example/MainYAMLTest.java
+++ 
b/examples/main-yaml/src/test/java/org/apache/camel/example/MainYAMLTest.java
@@ -16,37 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * A unit test checking that Camel supports YAML routes.
  */
-class MainYAMLTest extends CamelTestSupport {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
-        return camelContext;
-    }
-
-    @Override
-    protected void postProcessTest() throws Exception {
-        super.postProcessTest();
-        context.getInjector().newInstance(MyConfiguration.class);
-    }
+class MainYAMLTest extends CamelMainTestSupport {
 
     @Test
     void should_support_yaml_routes() {
@@ -57,13 +39,7 @@ class MainYAMLTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        for (Resource resource : 
resolver.findResources("/routes/my-route.yaml")) {
-            return 
ecc.getRoutesLoader().findRoutesBuilders(resource).toArray(RoutesBuilder[]::new);
-        }
-        fail("Should find the routes");
-        return null;
+    protected void configure(MainConfigurationProperties configuration) {
+        
configuration.withBasePackageScan(MyApplication.class.getPackageName());
     }
 }
diff --git a/examples/main/pom.xml b/examples/main/pom.xml
index d99d0c4..511c94a 100644
--- a/examples/main/pom.xml
+++ b/examples/main/pom.xml
@@ -88,7 +88,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/examples/main/src/test/java/org/apache/camel/example/MainTest.java 
b/examples/main/src/test/java/org/apache/camel/example/MainTest.java
index 7316f1f..971c730 100644
--- a/examples/main/src/test/java/org/apache/camel/example/MainTest.java
+++ b/examples/main/src/test/java/org/apache/camel/example/MainTest.java
@@ -16,34 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel supports binding via annotations.
  */
-class MainTest extends CamelTestSupport {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        
camelContext.getPropertiesComponent().setLocation("classpath:application.properties");
-        
camelContext.getPropertiesComponent().addLocation("file:src/main/data/foo.properties");
-        return camelContext;
-    }
-
-    @Override
-    protected void postProcessTest() throws Exception {
-        super.postProcessTest();
-        context.getInjector().newInstance(MyConfiguration.class);
-    }
+class MainTest extends CamelMainTestSupport {
 
     @Test
     void should_support_binding_via_annotations() {
@@ -55,7 +40,7 @@ class MainTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        
configuration.withBasePackageScan(MyApplication.class.getPackageName());
     }
 }
diff --git a/examples/mongodb/pom.xml b/examples/mongodb/pom.xml
index 7ae4d9a..5145425 100644
--- a/examples/mongodb/pom.xml
+++ b/examples/mongodb/pom.xml
@@ -79,7 +79,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <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 a071dae..e83eb8b 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
@@ -16,20 +16,20 @@
  */
 package org.apache.camel.example.mongodb;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import com.mongodb.client.MongoClients;
 import io.restassured.response.Response;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.testcontainers.containers.MongoDBContainer;
 import org.testcontainers.utility.DockerImageName;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import static io.restassured.RestAssured.given;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.matchesPattern;
@@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel can execute CRUD operations against MongoDB.
  */
-class MongoDBTest extends CamelTestSupport {
+class MongoDBTest extends CamelMainTestSupport {
 
     private static final String IMAGE = "mongo:5.0";
     private static MongoDBContainer CONTAINER;
@@ -59,14 +59,11 @@ class MongoDBTest extends CamelTestSupport {
     }
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        // Bind the MongoDB client with the host and port of the container
-        camelContext.getRegistry().bind(
+    protected void bindToRegistry(Registry registry) throws Exception {
+        registry.bind(
             "myDb",
             MongoClients.create(String.format("mongodb://%s:%d", 
CONTAINER.getHost(), CONTAINER.getMappedPort(27017)))
         );
-        return camelContext;
     }
 
     @Test
@@ -103,9 +100,9 @@ class MongoDBTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{
-            new MongoDBFindByIDRouteBuilder(), new 
MongoDBFindAllRouteBuilder(), new MongoDBInsertRouteBuilder()
-        };
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(new MongoDBFindByIDRouteBuilder());
+        configuration.addRoutesBuilder(new MongoDBFindAllRouteBuilder());
+        configuration.addRoutesBuilder(new MongoDBInsertRouteBuilder());
     }
 }
diff --git a/examples/netty-custom-correlation/pom.xml 
b/examples/netty-custom-correlation/pom.xml
index 473d8f0..36f5be0 100644
--- a/examples/netty-custom-correlation/pom.xml
+++ b/examples/netty-custom-correlation/pom.xml
@@ -88,7 +88,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/netty-custom-correlation/src/test/java/org/apache/camel/example/netty/NettyTest.java
 
b/examples/netty-custom-correlation/src/test/java/org/apache/camel/example/netty/NettyTest.java
index 4e30878..e185f5c 100644
--- 
a/examples/netty-custom-correlation/src/test/java/org/apache/camel/example/netty/NettyTest.java
+++ 
b/examples/netty-custom-correlation/src/test/java/org/apache/camel/example/netty/NettyTest.java
@@ -16,32 +16,30 @@
  */
 package org.apache.camel.example.netty;
 
-import org.apache.camel.CamelContext;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.Predicate;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.apache.camel.example.netty.MyClient.createCorrelationManager;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can communicate over TCP with Netty using a 
custom codec.
  */
-class NettyTest extends CamelTestSupport {
+class NettyTest extends CamelMainTestSupport {
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
+    protected void bindToRegistry(Registry registry) throws Exception {
         // Bind the Correlation Manager to use for the test
-        camelContext.getRegistry().bind("myManager", 
createCorrelationManager());
+        registry.bind("myManager", createCorrelationManager());
         // Bind the custom codec
-        camelContext.getRegistry().bind("myEncoder", new 
MyCodecEncoderFactory());
-        camelContext.getRegistry().bind("myDecoder", new 
MyCodecDecoderFactory());
-        return camelContext;
+        registry.bind("myEncoder", new MyCodecEncoderFactory());
+        registry.bind("myDecoder", new MyCodecDecoderFactory());
     }
 
     @Test
@@ -56,7 +54,8 @@ class NettyTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyServer.MyRouteBuilder(), new 
MyClient.MyRouteBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(new MyServer.MyRouteBuilder());
+        configuration.addRoutesBuilder(new MyClient.MyRouteBuilder());
     }
 }
diff --git a/examples/reactive-executor-vertx/pom.xml 
b/examples/reactive-executor-vertx/pom.xml
index d318a1d..c9b7b5c 100644
--- a/examples/reactive-executor-vertx/pom.xml
+++ b/examples/reactive-executor-vertx/pom.xml
@@ -96,7 +96,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/reactive-executor-vertx/src/test/java/org/apache/camel/example/VertxTest.java
 
b/examples/reactive-executor-vertx/src/test/java/org/apache/camel/example/VertxTest.java
index 830e0be..d90747c 100644
--- 
a/examples/reactive-executor-vertx/src/test/java/org/apache/camel/example/VertxTest.java
+++ 
b/examples/reactive-executor-vertx/src/test/java/org/apache/camel/example/VertxTest.java
@@ -16,22 +16,22 @@
  */
 package org.apache.camel.example;
 
+import java.util.concurrent.TimeUnit;
+
 import io.vertx.core.Vertx;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can use VertX as reactive executor.
  */
-class VertxTest extends CamelTestSupport {
+class VertxTest extends CamelMainTestSupport {
 
     @AfterEach
     void destroy() {
@@ -42,10 +42,8 @@ class VertxTest extends CamelTestSupport {
     }
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext camelContext = super.createCamelContext();
-        camelContext.getRegistry().bind("vertx", Vertx.vertx());
-        return camelContext;
+    protected void bindToRegistry(Registry registry) throws Exception {
+        registry.bind("vertx", Vertx.vertx());
     }
 
     @Test
@@ -57,7 +55,7 @@ class VertxTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return new MyRouteBuilder();
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteBuilder.class);
     }
 }
diff --git a/examples/routeloader/pom.xml b/examples/routeloader/pom.xml
index 3851a90..01c233f 100644
--- a/examples/routeloader/pom.xml
+++ b/examples/routeloader/pom.xml
@@ -122,7 +122,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/routeloader/src/test/java/org/apache/camel/example/RouteLoaderTest.java
 
b/examples/routeloader/src/test/java/org/apache/camel/example/RouteLoaderTest.java
index aaaf35d..49d226b 100644
--- 
a/examples/routeloader/src/test/java/org/apache/camel/example/RouteLoaderTest.java
+++ 
b/examples/routeloader/src/test/java/org/apache/camel/example/RouteLoaderTest.java
@@ -16,24 +16,18 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can load routes dynamically.
  */
-class RouteLoaderTest extends CamelTestSupport {
+class RouteLoaderTest extends CamelMainTestSupport {
 
     @Test
     void should_load_routes_dynamically() {
@@ -45,15 +39,4 @@ class RouteLoaderTest extends CamelTestSupport {
             notify.matches(20, TimeUnit.SECONDS), "3 messages should be 
completed"
         );
     }
-
-    @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        final List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        for (Resource resource : resolver.findResources("myroutes/*")) {
-            
routesBuilders.addAll(ecc.getRoutesLoader().findRoutesBuilders(resource));
-        }
-        return routesBuilders.toArray(RoutesBuilder[]::new);
-    }
 }
diff --git a/examples/routes-configuration/pom.xml 
b/examples/routes-configuration/pom.xml
index 0b85434..e514e49 100644
--- a/examples/routes-configuration/pom.xml
+++ b/examples/routes-configuration/pom.xml
@@ -106,7 +106,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/routes-configuration/src/test/java/org/apache/camel/example/RoutesConfigurationTest.java
 
b/examples/routes-configuration/src/test/java/org/apache/camel/example/RoutesConfigurationTest.java
index 5fc78ac..15a5978 100644
--- 
a/examples/routes-configuration/src/test/java/org/apache/camel/example/RoutesConfigurationTest.java
+++ 
b/examples/routes-configuration/src/test/java/org/apache/camel/example/RoutesConfigurationTest.java
@@ -16,24 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel can load routes dynamically.
  */
-class RoutesConfigurationTest extends CamelTestSupport {
+class RoutesConfigurationTest extends CamelMainTestSupport {
 
     @Test
     void should_load_routes_dynamically() {
@@ -47,17 +42,7 @@ class RoutesConfigurationTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        final List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        routesBuilders.add(new MyJavaRouteBuilder());
-        routesBuilders.add(new MyJavaErrorHandler());
-        for (String location : List.of("myroutes/*","myerror/*")) {
-            for (Resource resource : resolver.findResources(location)) {
-                
routesBuilders.addAll(ecc.getRoutesLoader().findRoutesBuilders(resource));
-            }
-        }
-        return routesBuilders.toArray(RoutesBuilder[]::new);
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyJavaRouteBuilder.class, 
MyJavaErrorHandler.class);
     }
 }
diff --git a/examples/routetemplate-xml/pom.xml 
b/examples/routetemplate-xml/pom.xml
index dd77058..2772914 100644
--- a/examples/routetemplate-xml/pom.xml
+++ b/examples/routetemplate-xml/pom.xml
@@ -90,7 +90,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/routetemplate-xml/src/test/java/org/apache/camel/example/RouteTemplateXMLTest.java
 
b/examples/routetemplate-xml/src/test/java/org/apache/camel/example/RouteTemplateXMLTest.java
index 74bb0c2..c689c1b 100644
--- 
a/examples/routetemplate-xml/src/test/java/org/apache/camel/example/RouteTemplateXMLTest.java
+++ 
b/examples/routetemplate-xml/src/test/java/org/apache/camel/example/RouteTemplateXMLTest.java
@@ -16,24 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.spi.PackageScanResourceResolver;
-import org.apache.camel.spi.Resource;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel supports parameterized routes in XML.
  */
-class RouteTemplateXMLTest extends CamelTestSupport {
+class RouteTemplateXMLTest extends CamelMainTestSupport {
 
     @Test
     void should_support_parameterized_routes() {
@@ -44,15 +39,7 @@ class RouteTemplateXMLTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() throws Exception {
-        final ExtendedCamelContext ecc = 
context.adapt(ExtendedCamelContext.class);
-        final PackageScanResourceResolver resolver = 
ecc.getPackageScanResourceResolver();
-        final List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        for (String location : List.of("templates/*","builders/*")) {
-            for (Resource resource : resolver.findResources(location)) {
-                
routesBuilders.addAll(ecc.getRoutesLoader().findRoutesBuilders(resource));
-            }
-        }
-        return routesBuilders.toArray(RoutesBuilder[]::new);
+    protected void configure(MainConfigurationProperties configuration) {
+        
configuration.withRoutesIncludePattern("templates/*.xml,builders/*.xml");
     }
 }
diff --git a/examples/routetemplate/pom.xml b/examples/routetemplate/pom.xml
index f314eea..2e7b0ce 100644
--- a/examples/routetemplate/pom.xml
+++ b/examples/routetemplate/pom.xml
@@ -84,7 +84,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/routetemplate/src/test/java/org/apache/camel/example/RouteTemplateTest.java
 
b/examples/routetemplate/src/test/java/org/apache/camel/example/RouteTemplateTest.java
index ec34896..21e6c40 100644
--- 
a/examples/routetemplate/src/test/java/org/apache/camel/example/RouteTemplateTest.java
+++ 
b/examples/routetemplate/src/test/java/org/apache/camel/example/RouteTemplateTest.java
@@ -16,19 +16,19 @@
  */
 package org.apache.camel.example;
 
-import org.apache.camel.RoutesBuilder;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.builder.NotifyBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A unit test checking that Camel supports parameterized routes.
  */
-class RouteTemplateTest extends CamelTestSupport {
+class RouteTemplateTest extends CamelMainTestSupport {
 
     @Test
     void should_support_parameterized_routes() {
@@ -39,7 +39,7 @@ class RouteTemplateTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new MyRouteTemplates(), new 
MyTemplateBuilder()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(MyRouteTemplates.class);
     }
 }
diff --git a/examples/twitter-websocket/pom.xml 
b/examples/twitter-websocket/pom.xml
index 27e8862..2c3b66a 100644
--- a/examples/twitter-websocket/pom.xml
+++ b/examples/twitter-websocket/pom.xml
@@ -90,7 +90,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git 
a/examples/twitter-websocket/src/main/java/org/apache/camel/example/websocket/CamelTwitterWebSocketMain.java
 
b/examples/twitter-websocket/src/main/java/org/apache/camel/example/websocket/CamelTwitterWebSocketMain.java
index 566ddf9..914b8b4 100644
--- 
a/examples/twitter-websocket/src/main/java/org/apache/camel/example/websocket/CamelTwitterWebSocketMain.java
+++ 
b/examples/twitter-websocket/src/main/java/org/apache/camel/example/websocket/CamelTwitterWebSocketMain.java
@@ -50,10 +50,8 @@ public final class CamelTwitterWebSocketMain {
         // create a new Camel Main so we can easily start Camel
         Main main = new Main();
 
-        TwitterWebSocketRoute route = createTwitterWebSocketRoute("gaga", 
6_000);
-
         // add our routes to Camel
-        main.configure().addRoutesBuilder(route);
+        main.configure().addRoutesBuilder(createTwitterWebSocketRoute("gaga", 
6_000));
 
         // and run, which keeps blocking until we terminate the JVM (or stop 
CamelContext)
         main.run();
diff --git 
a/examples/twitter-websocket/src/test/java/org/apache/camel/example/websocket/CamelTwitterWebSocketTest.java
 
b/examples/twitter-websocket/src/test/java/org/apache/camel/example/websocket/CamelTwitterWebSocketTest.java
index 70e79c1..9f8445f 100644
--- 
a/examples/twitter-websocket/src/test/java/org/apache/camel/example/websocket/CamelTwitterWebSocketTest.java
+++ 
b/examples/twitter-websocket/src/test/java/org/apache/camel/example/websocket/CamelTwitterWebSocketTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.example.websocket;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.asynchttpclient.AsyncHttpClient;
 import org.asynchttpclient.DefaultAsyncHttpClient;
 import org.asynchttpclient.ws.WebSocket;
@@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 /**
  * A unit test checking that Camel can poll a constant feed of Twitter and 
publish results using WebSocket.
  */
-class CamelTwitterWebSocketTest extends CamelTestSupport {
+class CamelTwitterWebSocketTest extends CamelMainTestSupport {
 
     @Test
     void should_support_polling_twitter_publishing_websocket() throws 
Exception {
@@ -74,7 +74,7 @@ class CamelTwitterWebSocketTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder createRouteBuilder() {
-        return createTwitterWebSocketRoute("test", 100);
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(createTwitterWebSocketRoute("test", 
100));
     }
 }
diff --git a/examples/widget-gadget-java/pom.xml 
b/examples/widget-gadget-java/pom.xml
index 0ad35bd..bc6266c 100644
--- a/examples/widget-gadget-java/pom.xml
+++ b/examples/widget-gadget-java/pom.xml
@@ -117,7 +117,7 @@
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
+            <artifactId>camel-test-main-junit5</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git 
a/examples/widget-gadget-java/src/test/java/org/apache/camel/example/widget/WidgetGadgetTest.java
 
b/examples/widget-gadget-java/src/test/java/org/apache/camel/example/widget/WidgetGadgetTest.java
index 88f94cb..7e0b8ce 100644
--- 
a/examples/widget-gadget-java/src/test/java/org/apache/camel/example/widget/WidgetGadgetTest.java
+++ 
b/examples/widget-gadget-java/src/test/java/org/apache/camel/example/widget/WidgetGadgetTest.java
@@ -19,12 +19,13 @@ package org.apache.camel.example.widget;
 import java.util.concurrent.TimeUnit;
 
 import javax.jms.ConnectionFactory;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.component.jms.JmsComponent;
-import org.apache.camel.test.junit5.CamelTestSupport;
+import org.apache.camel.main.MainConfigurationProperties;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.main.junit5.CamelMainTestSupport;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -33,19 +34,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  * A unit test checking that the Widget and Gadget use-case from the 
Enterprise Integration Patterns book works
  * properly using Apache ActiveMQ.
  */
-class WidgetGadgetTest extends CamelTestSupport {
+class WidgetGadgetTest extends CamelMainTestSupport {
 
     @Override
-    protected CamelContext createCamelContext() throws Exception {
-        // create CamelContext
-        CamelContext camelContext = super.createCamelContext();
+    protected void bindToRegistry(Registry registry) throws Exception {
         // connect to embedded ActiveMQ JMS broker
         ConnectionFactory connectionFactory =
                 new 
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
-        camelContext.addComponent("activemq",
-                JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
-
-        return camelContext;
+        registry.bind("activemq", 
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
     }
 
     @Test
@@ -62,7 +58,8 @@ class WidgetGadgetTest extends CamelTestSupport {
     }
 
     @Override
-    protected RoutesBuilder[] createRouteBuilders() {
-        return new RoutesBuilder[]{new CreateOrderRoute(), new 
WidgetGadgetRoute()};
+    protected void configure(MainConfigurationProperties configuration) {
+        configuration.addRoutesBuilder(new WidgetGadgetRoute());
+        configuration.addRoutesBuilder(new CreateOrderRoute());
     }
 }

Reply via email to