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

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


The following commit(s) were added to refs/heads/camel-4.18.x by this push:
     new eba08b76aa5c CAMEL-23754: Backport CustomJarsITCase fix to 
camel-4.18.x (#24099)
eba08b76aa5c is described below

commit eba08b76aa5c61d71525f8451a4bb28a4b715830
Author: gbhavya07 <[email protected]>
AuthorDate: Thu Jun 18 11:14:40 2026 +0530

    CAMEL-23754: Backport CustomJarsITCase fix to camel-4.18.x (#24099)
    
    CAMEL-23754: backport CustomJarsITCase fix to 4.18.x
---
 .../camel/dsl/jbang/it/CustomJarsITCase.java       | 17 ++++-----
 .../dsl/jbang/it/support/JBangTestSupport.java     |  1 +
 .../src/test/resources/jbang/it/CustomJar.java     | 41 ++++++++++++++++++++++
 3 files changed, 51 insertions(+), 8 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CustomJarsITCase.java
 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CustomJarsITCase.java
index b78ccb0c4d47..a08f08e48d25 100644
--- 
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CustomJarsITCase.java
+++ 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CustomJarsITCase.java
@@ -26,15 +26,16 @@ public class CustomJarsITCase extends JBangTestSupport {
 
     @Test
     public void testCustomJars() throws IOException {
-        copyResourceInDataFolder(TestResources.CIRCUIT_BREAKER);
+        copyResourceInDataFolder(TestResources.CUSTOM_JAR);
         Assertions
-                .assertThatCode(() -> execute(String.format("run 
%s/CircuitBreakerRoute.java --dep=camel-timer", mountPoint())))
+                .assertThatCode(() -> execute(
+                        String.format("run %s/CustomJar.java 
--max-seconds=30", mountPoint())))
                 .as("the application without dependency will cause error")
-                .hasStackTraceContaining("Failed to create route: 
circuitBreaker")
-                .hasStackTraceContaining(
-                        "Cannot find camel-resilience4j or 
camel-microprofile-fault-tolerance on the classpath.");
-        executeBackground(String.format("run %s/CircuitBreakerRoute.java 
--dep=camel-timer,camel-resilience4j", mountPoint()));
-        checkLogContains("timer called");
-        checkLogContains("Fallback message", 10);
+                .hasStackTraceContaining("Compilation error");
+
+        executeBackground(
+                String.format("run %s/CustomJar.java 
--dep=org.apache.commons:commons-text:1.15.0", mountPoint()));
+
+        checkLogContains("Random password");
     }
 }
diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
index df1060a7562a..f8164bd83c0a 100644
--- 
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
+++ 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
@@ -104,6 +104,7 @@ public abstract class JBangTestSupport {
         DIR_ROUTE("FromDirectoryRoute.java", 
"/jbang/it/from-source-dir/FromDirectoryRoute.java"),
         SERVER_ROUTE("server.yaml", "/jbang/it/server.yaml"),
         CIRCUIT_BREAKER("CircuitBreakerRoute.java", 
"/jbang/it/CircuitBreakerRoute.java"),
+        CUSTOM_JAR("CustomJar.java", "/jbang/it/CustomJar.java"),
         SRC_MAPPING_DATA("data.json", "/jbang/it/data-mapping/src/data.json"),
         SRC_MAPPING_TEMPLATE("transform.yaml", 
"/jbang/it/data-mapping/src/transform.yaml"),
         COMP_MAPPING_DATA("data.xml", 
"/jbang/it/data-mapping/components/data.xml"),
diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/CustomJar.java 
b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/CustomJar.java
new file mode 100644
index 000000000000..998c83979d81
--- /dev/null
+++ b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/CustomJar.java
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+import org.apache.commons.text.RandomStringGenerator;
+
+public class CustomJar extends RouteBuilder {
+    @Override
+    public void configure() {
+        from("timer:x?repeatCount=1")
+                .log("timer called")
+                .process(new Processor() {
+                    @Override
+                    public void process(Exchange exchange) throws Exception {
+                        RandomStringGenerator alphanumeric = 
RandomStringGenerator.builder()
+                                .withinRange('0', '9')
+                                .withinRange('A', 'Z')
+                                .withinRange('a', 'z')
+                                .build();
+                        
exchange.getMessage().setBody(alphanumeric.generate(8));
+                    }
+                })
+                .log("Random password: ${body}");
+    }
+}

Reply via email to