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

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


The following commit(s) were added to refs/heads/main by this push:
     new fd57971cd8 feat(camel-k): add options to override some aspects of a 
route
fd57971cd8 is described below

commit fd57971cd8d97d3c0cb3402f5d2f897248b2ce69
Author: Luca Burgazzoli <lburgazz...@gmail.com>
AuthorDate: Wed Feb 21 19:49:30 2024 +0100

    feat(camel-k): add options to override some aspects of a route
---
 .../quarkus/k/deployment/RuntimeProcessor.java     |   4 +-
 .../k/runtime/ApplicationModelReifierFactory.java  |  13 +
 .../camel/quarkus/k/runtime/ApplicationRoutes.java |  75 ++++++
 .../quarkus/k/runtime/ApplicationRoutesConfig.java |  54 ++++
 .../quarkus/k/support/RuntimeSupportTest.java      |   2 +-
 .../camel-k-runtime-model-reifier/pom.xml          | 297 +++++++++++++++++++++
 .../org/apache/camel/quarkus/k/it/Application.java |  50 ++++
 .../src/main/resources/application.properties      |  11 +-
 .../src/main/resources/routes.yaml                 |  47 ++++
 .../camel/quarkus/k/it/WithRoutesOverridesIT.java  |   7 +-
 .../quarkus/k/it/WithRoutesOverridesTest.java      |  87 ++++++
 .../src/main/resources/application.properties      |   3 +
 integration-tests/pom.xml                          |   1 +
 tooling/scripts/test-categories.yaml               |   1 +
 14 files changed, 646 insertions(+), 6 deletions(-)

diff --git 
a/extensions/camel-k/deployment/src/main/java/org/apache/camel/quarkus/k/deployment/RuntimeProcessor.java
 
b/extensions/camel-k/deployment/src/main/java/org/apache/camel/quarkus/k/deployment/RuntimeProcessor.java
index 61bdfde43c..8563c7ab25 100644
--- 
a/extensions/camel-k/deployment/src/main/java/org/apache/camel/quarkus/k/deployment/RuntimeProcessor.java
+++ 
b/extensions/camel-k/deployment/src/main/java/org/apache/camel/quarkus/k/deployment/RuntimeProcessor.java
@@ -44,6 +44,7 @@ import org.apache.camel.quarkus.k.core.Runtime;
 import org.apache.camel.quarkus.k.core.SourceDefinition;
 import org.apache.camel.quarkus.k.runtime.ApplicationProducers;
 import org.apache.camel.quarkus.k.runtime.ApplicationRecorder;
+import org.apache.camel.quarkus.k.runtime.ApplicationRoutes;
 import org.apache.camel.quarkus.k.support.Constants;
 import org.apache.camel.quarkus.k.support.RuntimeSupport;
 import org.apache.camel.spi.CamelContextCustomizer;
@@ -88,7 +89,8 @@ public class RuntimeProcessor {
     @BuildStep
     List<AdditionalBeanBuildItem> unremovableBeans() {
         return List.of(
-                
AdditionalBeanBuildItem.unremovableOf(ApplicationProducers.class));
+                
AdditionalBeanBuildItem.unremovableOf(ApplicationProducers.class),
+                
AdditionalBeanBuildItem.unremovableOf(ApplicationRoutes.class));
     }
 
     @BuildStep
diff --git 
a/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
 
b/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
index 0c5682ce1f..5574073070 100644
--- 
a/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
+++ 
b/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
@@ -16,7 +16,20 @@
  */
 package org.apache.camel.quarkus.k.runtime;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
 import org.apache.camel.impl.DefaultModelReifierFactory;
+import org.apache.camel.model.RouteDefinition;
 
 public class ApplicationModelReifierFactory extends DefaultModelReifierFactory 
{
+    @Override
+    public Route createRoute(CamelContext camelContext, Object 
routeDefinition) {
+        ApplicationRoutes routes = 
camelContext.getRegistry().findSingleByType(ApplicationRoutes.class);
+
+        if (routeDefinition instanceof RouteDefinition) {
+            routes.override((RouteDefinition) routeDefinition);
+        }
+
+        return super.createRoute(camelContext, routeDefinition);
+    }
 }
diff --git 
a/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationRoutes.java
 
b/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationRoutes.java
new file mode 100644
index 0000000000..c7ad29ac1a
--- /dev/null
+++ 
b/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationRoutes.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.k.runtime;
+
+import java.util.Objects;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.model.FromDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A bean to hold routes related logic.
+ */
+@ApplicationScoped
+public class ApplicationRoutes {
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(ApplicationRoutes.class);
+
+    @Inject
+    ApplicationRoutesConfig config;
+
+    @Inject
+    CamelContext context;
+
+    public ApplicationRoutesConfig config() {
+        return this.config;
+    }
+
+    public void override(RouteDefinition definition) {
+        if (config.overrides().isEmpty()) {
+            return;
+        }
+
+        final String id = definition.getRouteId();
+        final FromDefinition from = definition.getInput();
+
+        for (ApplicationRoutesConfig.RouteOverride override : 
config.overrides().get()) {
+            if (override.id().isEmpty() && override.input().from().isEmpty()) {
+                continue;
+            }
+            if (override.id().isPresent() && 
!Objects.equals(override.id().get(), id)) {
+                continue;
+            }
+            if (override.input().from().isPresent() && 
!Objects.equals(from.getEndpointUri(), override.input().from().get())) {
+                continue;
+            }
+
+            LOGGER.debug("Replace '{}' --> '{}' for route {}",
+                    from.getEndpointUri(),
+                    override.input().with(),
+                    definition.getRouteId());
+
+            from.setUri(override.input().with());
+
+            break;
+        }
+    }
+}
diff --git 
a/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationRoutesConfig.java
 
b/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationRoutesConfig.java
new file mode 100644
index 0000000000..0169fc12f9
--- /dev/null
+++ 
b/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationRoutesConfig.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.k.runtime;
+
+import java.util.List;
+import java.util.Optional;
+
+import io.smallrye.config.ConfigMapping;
+
+@ConfigMapping(prefix = "camel.k.routes")
+public interface ApplicationRoutesConfig {
+    /**
+     * A list of {@link RouteOverride} items to override some aspect of a 
{@link org.apache.camel.model.RouteDefinition}.
+     */
+    Optional<List<RouteOverride>> overrides();
+
+    interface RouteOverride {
+        /**
+         * Identifies the route to be amended.
+         */
+        Optional<String> id();
+
+        /**
+         * Override for the {@link org.apache.camel.model.FromDefinition} of a 
{@link org.apache.camel.model.RouteDefinition}.
+         */
+        RouteInputOverride input();
+    }
+
+    interface RouteInputOverride {
+        /**
+         * The optional endpoint that should be replaced.
+         */
+        Optional<String> from();
+
+        /**
+         * The value that should replace the endpoint.
+         */
+        String with();
+    }
+}
diff --git 
a/extensions/camel-k/runtime/src/test/java/org/apache/camel/quarkus/k/support/RuntimeSupportTest.java
 
b/extensions/camel-k/runtime/src/test/java/org/apache/camel/quarkus/k/support/RuntimeSupportTest.java
index 393ba49370..2843557f07 100644
--- 
a/extensions/camel-k/runtime/src/test/java/org/apache/camel/quarkus/k/support/RuntimeSupportTest.java
+++ 
b/extensions/camel-k/runtime/src/test/java/org/apache/camel/quarkus/k/support/RuntimeSupportTest.java
@@ -135,7 +135,7 @@ public class RuntimeSupportTest {
     @Test
     public void testLoadCustomizerOrder() {
         DefaultCamelContext context = new DefaultCamelContext();
-        context.setName("camel");
+        context.getCamelContextExtension().setName("camel");
         context.getRegistry().bind("c1", new CamelContextCustomizer() {
             @Override
             public int getOrder() {
diff --git a/integration-tests/camel-k-runtime-model-reifier/pom.xml 
b/integration-tests/camel-k-runtime-model-reifier/pom.xml
new file mode 100644
index 0000000000..c0504ec279
--- /dev/null
+++ b/integration-tests/camel-k-runtime-model-reifier/pom.xml
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-build-parent-it</artifactId>
+        <version>3.9.0-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    
<artifactId>camel-quarkus-integration-test-camel-k-runtime-model-reifier</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Camel K Runtime Model 
Reifier</name>
+    <description>Integration tests for Camel Quarkus K Runtime Model Reifier 
extension</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-camel-k</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-yaml-dsl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-xml-io-dsl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-timer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-platform-http</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-knative</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-jsonb</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jsonb</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                     <environmentVariables>
+                        
<CAMEL_K_CONF>${project.build.testOutputDirectory}/camel-k-runtime-model-reifier/conf.properties</CAMEL_K_CONF>
+                        
<CAMEL_K_CONF_D>${project.build.testOutputDirectory}/camel-k-runtime-model-reifier/conf.d</CAMEL_K_CONF_D>
+                    </environmentVariables>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>ci</id>
+            <properties>
+                
<quarkus.native.native-image-xmx>6g</quarkus.native.native-image-xmx>
+            </properties>
+        </profile>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.package.type>native</quarkus.package.type>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                   <environmentVariables>
+                                        
<CAMEL_K_CONF>${project.build.testOutputDirectory}/camel-k-runtime-model-reifier/conf.properties</CAMEL_K_CONF>
+                                        
<CAMEL_K_CONF_D>${project.build.testOutputDirectory}/camel-k-runtime-model-reifier/conf.d</CAMEL_K_CONF_D>
+                                    </environmentVariables>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>virtualDependencies</id>
+            <activation>
+                <property>
+                    <name>!noVirtualDependencies</name>
+                </property>
+            </activation>
+            <dependencies>
+                <!-- The following dependencies guarantee that this module is 
built after them. You can update them by running `mvn process-resources 
-Pformat -N` from the source tree root directory -->
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-camel-k-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-direct-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-knative-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-log-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    
<artifactId>camel-quarkus-platform-http-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-rest-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-timer-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    
<artifactId>camel-quarkus-xml-io-dsl-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-yaml-dsl-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>skip-testcontainers-tests</id>
+            <activation>
+                <property>
+                    <name>skip-testcontainers-tests</name>
+                </property>
+            </activation>
+            <properties>
+                <skipTests>true</skipTests>
+            </properties>
+        </profile>
+    </profiles>
+</project>
diff --git 
a/integration-tests/camel-k-runtime-model-reifier/src/main/java/org/apache/camel/quarkus/k/it/Application.java
 
b/integration-tests/camel-k-runtime-model-reifier/src/main/java/org/apache/camel/quarkus/k/it/Application.java
new file mode 100644
index 0000000000..dfa920c4b2
--- /dev/null
+++ 
b/integration-tests/camel-k-runtime-model-reifier/src/main/java/org/apache/camel/quarkus/k/it/Application.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.k.it;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.json.Json;
+import jakarta.json.JsonObject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
+
+@Path("/camel-k")
+@ApplicationScoped
+public class Application {
+
+    @Inject
+    CamelContext camelContext;
+
+    @GET
+    @Path("/inspect/route/{id}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject inspectRoute(@PathParam("id") String id) {
+        Route route = camelContext.getRoute(id);
+        route.getEndpoint().getEndpointUri();
+
+        return Json.createObjectBuilder()
+                .add("id", route.getRouteId())
+                .add("input", route.getEndpoint().getEndpointUri())
+                .build();
+    }
+}
diff --git 
a/integration-tests/camel-k-runtime/src/main/resources/application.properties 
b/integration-tests/camel-k-runtime-model-reifier/src/main/resources/application.properties
similarity index 70%
copy from 
integration-tests/camel-k-runtime/src/main/resources/application.properties
copy to 
integration-tests/camel-k-runtime-model-reifier/src/main/resources/application.properties
index 73989eb473..4408fe3062 100644
--- 
a/integration-tests/camel-k-runtime/src/main/resources/application.properties
+++ 
b/integration-tests/camel-k-runtime-model-reifier/src/main/resources/application.properties
@@ -18,4 +18,13 @@
 #
 # Quarkus
 #
-quarkus.banner.enabled     = false
+quarkus.banner.enabled = false
+
+# disable kubernetes dev services as none of the test requires it.
+quarkus.kubernetes-client.devservices.enabled = false
+
+# enable logging for ApplicationRoutes so the routes endpoint override will be
+# visible in the logs for troubleshooting
+quarkus.log.category."org.apache.camel.quarkus.k.runtime.ApplicationRoutes".level
 = DEBUG
+
+quarkus.native.resources.includes = routes.yaml
\ No newline at end of file
diff --git 
a/integration-tests/camel-k-runtime-model-reifier/src/main/resources/routes.yaml
 
b/integration-tests/camel-k-runtime-model-reifier/src/main/resources/routes.yaml
new file mode 100644
index 0000000000..ee61f2fc7f
--- /dev/null
+++ 
b/integration-tests/camel-k-runtime-model-reifier/src/main/resources/routes.yaml
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+- route:
+    id: "r1"
+    from:
+      uri: "direct:r1"
+      steps:
+        - to: "log:info1"
+- route:
+    id: "r2"
+    from:
+      uri: "direct:r2"
+      steps:
+        - to: "log:info2"
+- route:
+    id: "r3"
+    from:
+      uri: "direct:r3"
+      steps:
+        - to: "log:info3"
+- route:
+    id: "r4"
+    from:
+      uri: "direct:r4"
+      steps:
+        - to: "log:info4"
+- route:
+    id: "r5"
+    from:
+      uri: "direct:r5"
+      steps:
+        - to: "log:info5"
diff --git 
a/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
 
b/integration-tests/camel-k-runtime-model-reifier/src/test/java/org/apache/camel/quarkus/k/it/WithRoutesOverridesIT.java
similarity index 81%
copy from 
extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
copy to 
integration-tests/camel-k-runtime-model-reifier/src/test/java/org/apache/camel/quarkus/k/it/WithRoutesOverridesIT.java
index 0c5682ce1f..616112afb3 100644
--- 
a/extensions/camel-k/runtime/src/main/java/org/apache/camel/quarkus/k/runtime/ApplicationModelReifierFactory.java
+++ 
b/integration-tests/camel-k-runtime-model-reifier/src/test/java/org/apache/camel/quarkus/k/it/WithRoutesOverridesIT.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.k.runtime;
+package org.apache.camel.quarkus.k.it;
 
-import org.apache.camel.impl.DefaultModelReifierFactory;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
 
-public class ApplicationModelReifierFactory extends DefaultModelReifierFactory 
{
+@QuarkusIntegrationTest
+public class WithRoutesOverridesIT extends WithRoutesOverridesTest {
 }
diff --git 
a/integration-tests/camel-k-runtime-model-reifier/src/test/java/org/apache/camel/quarkus/k/it/WithRoutesOverridesTest.java
 
b/integration-tests/camel-k-runtime-model-reifier/src/test/java/org/apache/camel/quarkus/k/it/WithRoutesOverridesTest.java
new file mode 100644
index 0000000000..346f0ac547
--- /dev/null
+++ 
b/integration-tests/camel-k-runtime-model-reifier/src/test/java/org/apache/camel/quarkus/k/it/WithRoutesOverridesTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.k.it;
+
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.path.json.JsonPath;
+import jakarta.ws.rs.core.MediaType;
+import org.apache.camel.util.CollectionHelper;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import static io.restassured.RestAssured.given;
+import static org.assertj.core.api.Assertions.assertThat;
+
+@QuarkusTest
+@QuarkusTestResource(WithRoutesOverridesTest.Resources.class)
+public class WithRoutesOverridesTest {
+
+    @ParameterizedTest
+    @CsvSource({
+            "r1,direct://r1override",
+            "r2,direct://r2",
+            "r3,direct://r3",
+            "r4,direct://r4override",
+            "r5,direct://r5override",
+    })
+    public void overrides(String id, String expected) {
+        JsonPath p = given()
+                .accept(MediaType.APPLICATION_JSON)
+                .get("/camel-k/inspect/route/" + id)
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .jsonPath();
+
+        assertThat(p.getString("id"))
+                .isEqualTo(id);
+        assertThat(p.getString("input"))
+                .isEqualTo(expected);
+    }
+
+    public static class Resources implements 
QuarkusTestResourceLifecycleManager {
+        @Override
+        public Map<String, String> start() {
+            return CollectionHelper.mapOf(
+                    "camel.k.routes.overrides[0].input.from", "direct:r1",
+                    "camel.k.routes.overrides[0].input.with", 
"direct:r1override",
+                    "camel.k.routes.overrides[1].id", "r2invalid",
+                    "camel.k.routes.overrides[1].input.from", "direct:r2",
+                    "camel.k.routes.overrides[1].input.with", 
"direct:r2override",
+                    "camel.k.routes.overrides[2].id", "r3",
+                    "camel.k.routes.overrides[2].input.from", 
"direct:r3invalid",
+                    "camel.k.routes.overrides[2].input.with", 
"direct:r3override",
+                    "camel.k.routes.overrides[3].id", "r4",
+                    "camel.k.routes.overrides[3].input.from", "direct:r4",
+                    "camel.k.routes.overrides[3].input.with", 
"direct:r4override",
+                    "camel.k.routes.overrides[4].input.with", 
"direct:r5invalid",
+                    "camel.k.routes.overrides[5].id", "r5",
+                    "camel.k.routes.overrides[5].input.with", 
"direct:r5override",
+                    "camel.k.sources[0].location", "classpath:routes.yaml",
+                    "camel.k.sources[0].type", "source");
+        }
+
+        @Override
+        public void stop() {
+        }
+    }
+}
diff --git 
a/integration-tests/camel-k-runtime/src/main/resources/application.properties 
b/integration-tests/camel-k-runtime/src/main/resources/application.properties
index 73989eb473..97e58669af 100644
--- 
a/integration-tests/camel-k-runtime/src/main/resources/application.properties
+++ 
b/integration-tests/camel-k-runtime/src/main/resources/application.properties
@@ -19,3 +19,6 @@
 # Quarkus
 #
 quarkus.banner.enabled     = false
+
+# disable kubernetes dev services as none of the test requires it.
+quarkus.kubernetes-client.devservices.enabled = false
\ No newline at end of file
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index cdbb5203a1..f1b7407186 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -70,6 +70,7 @@
         <module>braintree</module>
         <module>caffeine</module>
         <module>camel-k-runtime</module>
+        <module>camel-k-runtime-model-reifier</module>
         <module>cassandraql</module>
         <module>cbor</module>
         <module>compression-grouped</module>
diff --git a/tooling/scripts/test-categories.yaml 
b/tooling/scripts/test-categories.yaml
index 67b63d7a23..d1400f4f66 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -209,6 +209,7 @@ group-12:
 group-13:
   - box
   - camel-k-runtime
+  - camel-k-runtime-model-reifier
   - fhir
   - github
   - google


Reply via email to