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 2a8a7b4a47 Add camel. extension prefix for route resources supported
for hot reload
2a8a7b4a47 is described below
commit 2a8a7b4a479251ff968cf98f5a3e6565342b3592
Author: James Netherton <[email protected]>
AuthorDate: Mon Nov 17 08:16:38 2025 +0000
Add camel. extension prefix for route resources supported for hot reload
Fixes #7971
---
.../quarkus/core/deployment/util/CamelSupport.java | 3 +-
integration-tests-jvm/main-devmode/pom.xml | 17 +++
...ternWithSupportedFileExtensionsDevModeTest.java | 122 +++++++++++++++++++++
3 files changed, 141 insertions(+), 1 deletion(-)
diff --git
a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
index 3429a0b215..b103c8751f 100644
---
a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
+++
b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/CamelSupport.java
@@ -162,11 +162,12 @@ public final class CamelSupport {
Set<String> extensions = new HashSet<>();
if (capabilities.isPresent(CamelCapabilities.XML_JAXB) ||
capabilities.isPresent(CamelCapabilities.XML_IO_DSL)) {
extensions.add("xml");
+ extensions.add("camel.xml");
}
if (capabilities.isPresent(CamelCapabilities.YAML_DSL)) {
extensions.add("yaml");
- extensions.add("yml");
+ extensions.add("camel.yaml");
}
if (capabilities.isPresent(CamelCapabilities.JAVA_JOOR_DSL)) {
diff --git a/integration-tests-jvm/main-devmode/pom.xml
b/integration-tests-jvm/main-devmode/pom.xml
index 70cc6312c2..c0e5d1492a 100644
--- a/integration-tests-jvm/main-devmode/pom.xml
+++ b/integration-tests-jvm/main-devmode/pom.xml
@@ -35,6 +35,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-xml-io-dsl</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-direct</artifactId>
@@ -171,6 +175,19 @@
</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>
</profiles>
diff --git
a/integration-tests-jvm/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithSupportedFileExtensionsDevModeTest.java
b/integration-tests-jvm/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithSupportedFileExtensionsDevModeTest.java
new file mode 100644
index 0000000000..6853b4f1ea
--- /dev/null
+++
b/integration-tests-jvm/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithSupportedFileExtensionsDevModeTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.main;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.QuarkusDevModeTest;
+import io.restassured.RestAssured;
+import io.restassured.response.Response;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.await;
+
+class CamelMainRoutesIncludePatternWithSupportedFileExtensionsDevModeTest {
+ static final String ROUTE_ID_BASE = "route";
+ static final String XML_ROUTE_ID = "xml-" + ROUTE_ID_BASE;
+ static final String CAMEL_XML_ROUTE_ID = "camel-" + XML_ROUTE_ID;
+ static final String YAML_ROUTE_ID = "yaml-" + ROUTE_ID_BASE;
+ static final String CAMEL_YAML_ROUTE_ID = "camel-" + YAML_ROUTE_ID;
+
+ @RegisterExtension
+ static final QuarkusDevModeTest TEST = new QuarkusDevModeTest()
+ .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
+ .addClass(CamelSupportResource.class)
+ .addAsResource(routeXml(XML_ROUTE_ID), "camel/routes.xml")
+ .addAsResource(routeXml(CAMEL_XML_ROUTE_ID),
"camel/routes.camel.xml")
+ .addAsResource(routeYaml(YAML_ROUTE_ID),
"camel/routes.yaml")
+ .addAsResource(routeYaml(CAMEL_YAML_ROUTE_ID),
"camel/routes.camel.yaml")
+ .addAsResource(applicationProperties(),
"application.properties"));
+
+ public static Asset routeXml(String routeId) {
+ String xml = """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <routes>
+ <route id="%s">
+ <from uri="direct:%s"/>
+ <setBody><constant>Hello World</constant></setBody>
+ </route>
+ </routes>""".formatted(routeId, routeId);
+ return new StringAsset(xml);
+ }
+
+ public static Asset routeYaml(String routeId) {
+ String yaml = """
+ - route:
+ id: "%s"
+ from:
+ uri: "direct:%s"
+ steps:
+ - setBody:
+ constant: "Hello World"
+ """.formatted(routeId, routeId);
+ return new StringAsset(yaml);
+ }
+
+ public static Asset applicationProperties() {
+ Writer writer = new StringWriter();
+
+ Properties props = new Properties();
+ props.setProperty("quarkus.banner.enabled", "false");
+
+ try {
+ props.store(writer, "");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ return new StringAsset(writer.toString());
+ }
+
+ @Test
+ void routesDiscoveryWithSupportedFileExtensions() {
+ await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> {
+ Response res =
RestAssured.when().get("/test/describe").thenReturn();
+
+ assertThat(res.statusCode()).isEqualTo(200);
+ assertThat(res.body().jsonPath().getList("routes",
String.class)).containsOnly(XML_ROUTE_ID, CAMEL_XML_ROUTE_ID,
+ YAML_ROUTE_ID, CAMEL_YAML_ROUTE_ID);
+ });
+
+ Map<String, String> fileToRouteIdMappings = Map.of("camel/routes.xml",
XML_ROUTE_ID,
+ "camel/routes.camel.xml", CAMEL_XML_ROUTE_ID,
+ "camel/routes.yaml", YAML_ROUTE_ID,
+ "camel/routes.camel.yaml", CAMEL_YAML_ROUTE_ID);
+
+ fileToRouteIdMappings.forEach((path, routeId) -> {
+ TEST.modifyResourceFile(path, route -> route.replaceAll(routeId,
routeId + "-updated"));
+
+ await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> {
+ Response res =
RestAssured.when().get("/test/describe").thenReturn();
+
+ assertThat(res.statusCode()).isEqualTo(200);
+ assertThat(res.body().jsonPath().getList("routes",
String.class)).contains(routeId + "-updated");
+ });
+ });
+ }
+}