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 523e800edc Register SimpleNoFileLanguage for reflection
523e800edc is described below

commit 523e800edc60170e4cef373bddb853fa016ea010
Author: James Netherton <[email protected]>
AuthorDate: Fri Apr 17 07:47:25 2026 +0100

    Register SimpleNoFileLanguage for reflection
    
    Fixes #8544
---
 .../core/deployment/CamelNativeImageProcessor.java        |  7 +++++++
 .../camel/quarkus/component/file/it/FileResource.java     | 14 ++++++++++++--
 .../camel/quarkus/component/file/it/FileRoutes.java       | 10 +++++++++-
 .../apache/camel/quarkus/component/file/it/FileTest.java  | 15 ++++++++++-----
 .../camel/quarkus/component/file/it/FileTestResource.java |  6 ++++--
 5 files changed, 42 insertions(+), 10 deletions(-)

diff --git 
a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
 
b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
index 46d3f23cd3..ccd4802086 100644
--- 
a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
+++ 
b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelNativeImageProcessor.java
@@ -50,6 +50,7 @@ import org.apache.camel.impl.engine.DefaultDataFormatResolver;
 import org.apache.camel.impl.engine.DefaultDevConsoleResolver;
 import org.apache.camel.impl.engine.DefaultLanguageResolver;
 import org.apache.camel.impl.engine.DefaultTransformerResolver;
+import org.apache.camel.language.simple.SimpleNoFileLanguage;
 import org.apache.camel.quarkus.core.CamelConfig;
 import org.apache.camel.quarkus.core.CamelConfig.ReflectionConfig;
 import org.apache.camel.quarkus.core.CamelConfigFlags;
@@ -300,6 +301,12 @@ public class CamelNativeImageProcessor {
         });
     }
 
+    @BuildStep
+    ReflectiveClassBuildItem registerSimpleNoFileLanguageForReflection() {
+        // Required as SimpleNoFileLanguage loading & discovery is not done 
via the FactoryFinder
+        return 
ReflectiveClassBuildItem.builder(SimpleNoFileLanguage.class).build();
+    }
+
     /**
      * Scans RouteBuilder bytecode to auto-detect exception classes used in 
onException() and doCatch() calls, and
      * registers them for reflection. This is needed because Camel stores 
exception class names as strings in the route
diff --git 
a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java
 
b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java
index 550caca4ce..3eabf9a9d7 100644
--- 
a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java
+++ 
b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java
@@ -38,6 +38,9 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.component.mock.MockEndpoint;
 
+import static 
org.apache.camel.quarkus.component.file.it.FileRoutes.POLL_ENRICH_SIMPLE_FILE_NAME;
+import static 
org.apache.camel.quarkus.component.file.it.FileRoutes.POLL_ENRICH_SIMPLE_PATH;
+
 @Path("/file")
 @ApplicationScoped
 public class FileResource {
@@ -149,8 +152,15 @@ public class FileResource {
     @Path("/route/{route}")
     @POST
     @Consumes(MediaType.TEXT_PLAIN)
-    public String pollEnrich(String body, @PathParam("route") String route) 
throws Exception {
-        return producerTemplate.requestBody("direct:" + route, body, 
String.class);
+    public String pollEnrich(String body, @PathParam("route") String route) {
+        Map<String, Object> headers = new HashMap<>();
+
+        if (route.equals("pollEnrichSimpleExpression")) {
+            headers.put("path", POLL_ENRICH_SIMPLE_PATH);
+            headers.put("fileName", POLL_ENRICH_SIMPLE_FILE_NAME);
+        }
+
+        return producerTemplate.requestBodyAndHeaders("direct:" + route, body, 
headers, String.class);
     }
 
 }
diff --git 
a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
 
b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
index 1caf3c4dfa..4ae7ca014a 100644
--- 
a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
+++ 
b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
@@ -33,6 +33,12 @@ public class FileRoutes extends RouteBuilder {
 
     public static final String READ_LOCK_IN = "read-lock-in";
     public static final String READ_LOCK_OUT = "read-lock-out";
+    public static final String POLL_ENRICH_FILE_NAME = "poll-enrich-file";
+    public static final String POLL_ENRICH_SIMPLE_FILE_NAME = 
POLL_ENRICH_FILE_NAME + "-simple";
+    public static final String POLL_ENRICH_FILE_CONTENT = 
POLL_ENRICH_FILE_NAME + "-CONTENT";
+    public static final String POLL_ENRICH_SIMPLE_FILE_CONTENT = 
POLL_ENRICH_SIMPLE_FILE_NAME + "-CONTENT";
+    public static final String POLL_ENRICH_PATH = 
"target/test-files/poll-enrich";
+    public static final String POLL_ENRICH_SIMPLE_PATH = POLL_ENRICH_PATH + 
"-simple";
 
     private static final Set<String> IDEMPOTENT_FILES_CONSUMED = 
ConcurrentHashMap.newKeySet();
 
@@ -82,8 +88,10 @@ public class FileRoutes extends RouteBuilder {
                 .convertBodyTo(String.class).to("mock:" + SORT_BY);
 
         from("direct:pollEnrich")
-                
.pollEnrich("file://target/test-files/poll-enrich?fileName=poll-enrich-file");
+                .pollEnrich("file:" + POLL_ENRICH_PATH + "?fileName=" + 
POLL_ENRICH_FILE_NAME);
 
+        from("direct:pollEnrichSimpleExpression")
+                
.pollEnrich().simple("file:${header.path}?fileName=${header.fileName}");
     }
 
     public class MyFileFilter<T> implements GenericFileFilter<T> {
diff --git 
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
 
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
index 27d53ca66e..6c19e56758 100644
--- 
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
+++ 
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
@@ -30,9 +30,13 @@ import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 import static 
org.apache.camel.quarkus.component.file.it.FileResource.SEPARATOR;
 import static org.apache.camel.quarkus.component.file.it.FileResource.SORT_BY;
+import static 
org.apache.camel.quarkus.component.file.it.FileRoutes.POLL_ENRICH_FILE_CONTENT;
+import static 
org.apache.camel.quarkus.component.file.it.FileRoutes.POLL_ENRICH_SIMPLE_FILE_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.BATCH_FILE_NAME_1_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.BATCH_FILE_NAME_2_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.CHARSET_READ_FILE_CONTENT;
@@ -45,7 +49,6 @@ import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.FILE_C
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.FILTER_NON_SKIPPED_FILE_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.IDEMPOTENT_FILE_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.IDEMPOTENT_FILE_NAME;
-import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.POLL_ENRICH_FILE_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.QUARTZ_SCHEDULED_FILE_CONTENT;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.READ_LOCK_FILE_NAME;
 import static 
org.apache.camel.quarkus.component.file.it.FileTestResource.READ_LOCK_FOLDER_IN;
@@ -108,14 +111,16 @@ class FileTest {
                 equalTo(FILTER_NON_SKIPPED_FILE_CONTENT));
     }
 
-    @Test
-    public void pollEnrichShouldSetExchangeBodyWithFileContent() {
+    @ParameterizedTest
+    @ValueSource(strings = { "pollEnrich", "pollEnrichSimpleExpression" })
+    public void pollEnrichShouldSetExchangeBodyWithFileContent(String route) {
+        String expectedBody = route.equals("pollEnrich") ? 
POLL_ENRICH_FILE_CONTENT : POLL_ENRICH_SIMPLE_FILE_CONTENT;
         RestAssured.given()
                 .contentType(ContentType.TEXT)
-                .post("/file/route/pollEnrich")
+                .post("/file/route/" + route)
                 .then()
                 .statusCode(200)
-                .body(Matchers.is(POLL_ENRICH_FILE_CONTENT));
+                .body(Matchers.is(expectedBody));
     }
 
     @Test
diff --git 
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTestResource.java
 
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTestResource.java
index 08f74c35be..c99f2e86f1 100644
--- 
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTestResource.java
+++ 
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTestResource.java
@@ -29,6 +29,9 @@ import java.util.Map.Entry;
 import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
 import org.apache.commons.io.FileUtils;
 
+import static 
org.apache.camel.quarkus.component.file.it.FileRoutes.POLL_ENRICH_FILE_NAME;
+import static 
org.apache.camel.quarkus.component.file.it.FileRoutes.POLL_ENRICH_SIMPLE_FILE_NAME;
+
 /**
  * Ensures that all test files are created with expected content before camel 
routes starts to consume them.
  */
@@ -40,8 +43,6 @@ public class FileTestResource implements 
QuarkusTestResourceLifecycleManager {
     static final String FILTER_NON_SKIPPED_FILE_CONTENT = 
FILTER_NON_SKIPPED_FILE_NAME + "-CONTENT";
     static final String IDEMPOTENT_FILE_NAME = "moved-back-read-once";
     static final String IDEMPOTENT_FILE_CONTENT = IDEMPOTENT_FILE_NAME + 
"-CONTENT";
-    static final String POLL_ENRICH_FILE_NAME = "poll-enrich-file";
-    static final String POLL_ENRICH_FILE_CONTENT = POLL_ENRICH_FILE_NAME + 
"-CONTENT";
     static final String QUARTZ_SCHEDULED_FILE_NAME = "quartz-schedule-file";
     static final String QUARTZ_SCHEDULED_FILE_CONTENT = 
QUARTZ_SCHEDULED_FILE_NAME + "-CONTENT";
     static final String CHARSET_READ_FILE_NAME = "charset-read-file";
@@ -81,6 +82,7 @@ public class FileTestResource implements 
QuarkusTestResourceLifecycleManager {
             createTestFile("idempotent", IDEMPOTENT_FILE_NAME);
 
             createTestFile("poll-enrich", POLL_ENRICH_FILE_NAME);
+            createTestFile("poll-enrich-simple", POLL_ENRICH_SIMPLE_FILE_NAME);
 
             createTestFile("quartz-scheduled", QUARTZ_SCHEDULED_FILE_NAME);
 

Reply via email to