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 d67630d20d1 CAMEL-20367: Adds Maven and Gradle run test (#15333)
d67630d20d1 is described below

commit d67630d20d1671651587500f0738af8b2ae7d0ad
Author: Jakub Vrubel <[email protected]>
AuthorDate: Tue Aug 27 10:42:52 2024 +0200

    CAMEL-20367: Adds Maven and Gradle run test (#15333)
---
 .../camel/dsl/jbang/it/MavenGradleITCase.java      | 54 ++++++++++++++++++++
 .../dsl/jbang/it/support/JBangTestSupport.java     |  3 +-
 .../resources/jbang/it/maven-gradle/build.gradle   | 57 ++++++++++++++++++++++
 3 files changed, 113 insertions(+), 1 deletion(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/MavenGradleITCase.java
 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/MavenGradleITCase.java
new file mode 100644
index 00000000000..dc3f2d72dcd
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/MavenGradleITCase.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.dsl.jbang.it;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.camel.dsl.jbang.it.support.JBangTestSupport;
+import org.junit.jupiter.api.Test;
+
+public class MavenGradleITCase extends JBangTestSupport {
+
+    final public void generateArchetype() {
+        execInHost("mvn archetype:generate" +
+                   "  -DarchetypeGroupId=org.apache.camel.archetypes" +
+                   "  -DarchetypeArtifactId=camel-archetype-java" +
+                   "  -DinteractiveMode=false" +
+                   "  -DgroupId=org.jbang -DartifactId=jbang-app 
-Dversion=1.0-SNAPSHOT " +
+                   "  -DoutputDirectory=" + getDataFolder() +
+                   "  -DarchetypeVersion=" + version());
+    }
+
+    @Test
+    public void runFromMavenModuleTest() {
+        generateArchetype();
+        executeBackground(String.format("run %s/jbang-app/pom.xml", 
mountPoint()));
+        checkLogContains("Apache Camel " + version() + " (CamelJBang) 
started");
+    }
+
+    @Test
+    public void runFromGradleTest() throws IOException {
+        generateArchetype();
+        copyResourceInDataFolder(TestResources.BUILD_GRADLE);
+        Files.move(Path.of(String.format("%s/build.gradle", getDataFolder())),
+                Path.of(String.format("%s/jbang-app/build.gradle", 
getDataFolder())));
+        executeBackground(String.format("run %s/jbang-app/build.gradle", 
mountPoint()));
+        checkLogContains("Apache Camel " + version() + " (CamelJBang) 
started");
+    }
+}
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 6e6f0164426..7ba70ca7393 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
@@ -96,7 +96,8 @@ public abstract class JBangTestSupport {
         TEST_PROFILE_PROP("application-test.properties", 
"/jbang/it/application-test.properties"),
         HELLO_NAME("helloName.xml", "/jbang/it/helloName.xml"),
         JOKE("joke.yaml", "/jbang/it/joke.yaml"),
-        MQQT_CONSUMER("mqttConsumer.yaml", "/jbang/it/mqttConsumer.yaml");
+        MQQT_CONSUMER("mqttConsumer.yaml", "/jbang/it/mqttConsumer.yaml"),
+        BUILD_GRADLE("build.gradle", "/jbang/it/maven-gradle/build.gradle");
 
         private String name;
         private String resPath;
diff --git 
a/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/maven-gradle/build.gradle
 
b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/maven-gradle/build.gradle
new file mode 100644
index 00000000000..c3e003fd08c
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/maven-gradle/build.gradle
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+/*
+ * This file was generated by the Gradle 'init' task.
+ */
+
+plugins {
+    id 'java-library'
+    id 'maven-publish'
+}
+
+repositories {
+    mavenLocal()
+}
+
+dependencies {
+    api libs.org.apache.camel.camel.core
+    api libs.org.apache.camel.camel.main
+    runtimeOnly libs.org.apache.logging.log4j.log4j.slf4j2.impl
+    runtimeOnly libs.org.apache.logging.log4j.log4j.core
+    testImplementation libs.org.apache.camel.camel.test.main.junit5
+}
+
+group = 'org.jbang'
+version = '1.0-SNAPSHOT'
+description = 'A Camel Route'
+java.sourceCompatibility = JavaVersion.VERSION_17
+
+publishing {
+    publications {
+        maven(MavenPublication) {
+            from(components.java)
+        }
+    }
+}
+
+tasks.withType(JavaCompile) {
+    options.encoding = 'UTF-8'
+}
+
+tasks.withType(Javadoc) {
+    options.encoding = 'UTF-8'
+}

Reply via email to