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.git


The following commit(s) were added to refs/heads/main by this push:
     new 2cd9f8d6116 CAMEL-20367: Adds running routes from source directory 
test (#15336)
2cd9f8d6116 is described below

commit 2cd9f8d61169bb391637c13429800f1df7714dac
Author: Jakub Vrubel <[email protected]>
AuthorDate: Tue Aug 27 13:38:01 2024 +0200

    CAMEL-20367: Adds running routes from source directory test (#15336)
---
 .../camel/dsl/jbang/it/RouteFromDirITCase.java     | 33 ++++++++++++++++++++++
 .../dsl/jbang/it/support/JBangTestSupport.java     |  3 +-
 .../it/from-source-dir/FromDirectoryRoute.java     | 28 ++++++++++++++++++
 3 files changed, 63 insertions(+), 1 deletion(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RouteFromDirITCase.java
 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RouteFromDirITCase.java
new file mode 100644
index 00000000000..f88fb3bcdfd
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RouteFromDirITCase.java
@@ -0,0 +1,33 @@
+/*
+ * 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.dsl.jbang.it;
+
+import java.io.IOException;
+
+import org.apache.camel.dsl.jbang.it.support.JBangTestSupport;
+import org.junit.jupiter.api.Test;
+
+public class RouteFromDirITCase extends JBangTestSupport {
+
+    @Test
+    public void runFromDirTest() throws IOException {
+        copyResourceInDataFolder(TestResources.DIR_ROUTE);
+        executeBackground(String.format("run --source-dir=%s", mountPoint()));
+        checkLogContains("Hello world!");
+    }
+
+}
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 7ba70ca7393..674dd47d7be 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
@@ -97,7 +97,8 @@ public abstract class JBangTestSupport {
         HELLO_NAME("helloName.xml", "/jbang/it/helloName.xml"),
         JOKE("joke.yaml", "/jbang/it/joke.yaml"),
         MQQT_CONSUMER("mqttConsumer.yaml", "/jbang/it/mqttConsumer.yaml"),
-        BUILD_GRADLE("build.gradle", "/jbang/it/maven-gradle/build.gradle");
+        BUILD_GRADLE("build.gradle", "/jbang/it/maven-gradle/build.gradle"),
+        DIR_ROUTE("FromDirectoryRoute.java", 
"/jbang/it/from-source-dir/FromDirectoryRoute.java");
 
         private String name;
         private String resPath;
diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/from-source-dir/FromDirectoryRoute.java
 
b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/from-source-dir/FromDirectoryRoute.java
new file mode 100644
index 00000000000..90bdb7bb5b6
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/from-source-dir/FromDirectoryRoute.java
@@ -0,0 +1,28 @@
+/*
+ * 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.builder.RouteBuilder;
+
+public class FromDirectoryRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:java?period={{time:1000}}")
+                .setBody()
+                .simple("Hello world!")
+                .log("${body}");
+    }
+}

Reply via email to