You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/07/14 20:47:57 UTC

[camel-quarkus] branch master updated (54bed57 -> 8c76e23)

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

ppalaga pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from 54bed57  Fix #1468 Intermittent failure of CamelDevModeTest
     new 50efe79  Fix #1448 Add an integration test for the command mode
     new 738c4cc  Fixup #1468 Intermittent failure of CamelDevModeTest
     new 198f782  Fixup JPA extension
     new 8c76e23  Fixup JSON Validator

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docs/modules/ROOT/pages/extensions/main.adoc       | 18 ++++++
 extensions-core/main/runtime/pom.xml               |  2 +-
 .../main/resources/META-INF/quarkus-extension.yaml |  2 +-
 extensions/json-validator/runtime/pom.xml          |  2 +-
 .../{main-xml-jaxb => main-command-mode}/pom.xml   | 66 ++++++++++++----------
 .../apache/camel/quarkus/main/cmd/CamelRoute.java} | 18 +++---
 .../src/main/resources/application.properties      |  2 +-
 .../camel/quarkus/main/cmd/it/CommandModeIT.java   | 17 +++---
 .../camel/quarkus/main/cmd/it/CommandModeTest.java | 52 +++++++++++++++++
 integration-tests/pom.xml                          |  1 +
 pom.xml                                            |  1 +
 poms/bom-test/pom.xml                              |  5 ++
 tooling/scripts/test-categories.yaml               |  1 +
 13 files changed, 135 insertions(+), 52 deletions(-)
 copy integration-tests/{main-xml-jaxb => main-command-mode}/pom.xml (68%)
 copy integration-tests/{bean/src/main/java/org/apache/camel/quarkus/component/bean/LazyAppScopedRouteBuilder.java => main-command-mode/src/main/java/org/apache/camel/quarkus/main/cmd/CamelRoute.java} (71%)
 copy integration-tests-support/testcontainers-support/src/main/resources/testcontainers.properties => integration-tests/main-command-mode/src/main/resources/application.properties (96%)
 copy extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/DisabledModelJAXBContextFactory.java => integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeIT.java (59%)
 create mode 100644 integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeTest.java


[camel-quarkus] 02/04: Fixup #1468 Intermittent failure of CamelDevModeTest

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 738c4cc2fc1451dc4588a70fc31c970e0a18c432
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Jul 14 15:35:55 2020 +0200

    Fixup #1468 Intermittent failure of CamelDevModeTest
---
 docs/modules/ROOT/pages/extensions/main.adoc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/docs/modules/ROOT/pages/extensions/main.adoc b/docs/modules/ROOT/pages/extensions/main.adoc
index 2acccb1..5eb14ad 100644
--- a/docs/modules/ROOT/pages/extensions/main.adoc
+++ b/docs/modules/ROOT/pages/extensions/main.adoc
@@ -20,3 +20,21 @@ Bootstrap Camel using Camel Main which brings advanced auto-configuration capabi
 ----
 
 Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+
+== Additional Camel Quarkus configuration
+
+[width="100%",cols="80,5,15",options="header"]
+|===
+| Configuration property | Type | Default
+
+
+|icon:lock[title=Fixed at build time] [[quarkus.camel.main.shutdown.timeout]]`link:#quarkus.camel.main.shutdown.timeout[quarkus.camel.main.shutdown.timeout]`
+
+A timeout (with millisecond precision) to wait for `CamelMain++#++stop()` to finish
+| `java.time.Duration`
+| `PT3S`
+|===
+
+[.configuration-legend]
+icon:lock[title=Fixed at build time] Configuration property fixed at build time. All other configuration properties are overridable at runtime.
+


[camel-quarkus] 03/04: Fixup JPA extension

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 198f7821a6dfc4f2bd61905e7718e8f78268920b
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Jul 14 15:36:52 2020 +0200

    Fixup JPA extension
---
 .../jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extensions/jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 9e0ba69..2cdea10 100644
--- a/extensions/jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ b/extensions/jpa/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,6 +24,6 @@
 name: "Camel JPA"
 description: "Store and retrieve Java objects from databases using Java Persistence API (JPA)"
 metadata:
-  guide: "https://camel.apache.org/components/latest/jpa-component.html"
+  guide: "https://camel.apache.org/camel-quarkus/latest/extensions/jpa.html"
   categories:
   - "integration"


[camel-quarkus] 04/04: Fixup JSON Validator

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8c76e2332a14c63bfe39d3b30cb7cbf82054f770
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Jul 14 17:17:57 2020 +0200

    Fixup JSON Validator
---
 extensions/json-validator/runtime/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extensions/json-validator/runtime/pom.xml b/extensions/json-validator/runtime/pom.xml
index 66624c1..a7b3153 100644
--- a/extensions/json-validator/runtime/pom.xml
+++ b/extensions/json-validator/runtime/pom.xml
@@ -66,7 +66,7 @@
                     <execution>
                         <id>update-extension-doc-page</id>
                         <goals><goal>update-extension-doc-page</goal></goals>
-                        <phase>process-resources</phase>
+                        <phase>process-classes</phase>
                     </execution>
                 </executions>
             </plugin>


[camel-quarkus] 01/04: Fix #1448 Add an integration test for the command mode

Posted by pp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 50efe791c97f3a6cbbe9f901cda6f694f9d44313
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Jul 14 15:24:18 2020 +0200

    Fix #1448 Add an integration test for the command mode
---
 extensions-core/main/runtime/pom.xml               |   2 +-
 integration-tests/main-command-mode/pom.xml        | 147 +++++++++++++++++++++
 .../apache/camel/quarkus/main/cmd/CamelRoute.java  |  36 +++++
 .../src/main/resources/application.properties      |  18 +++
 .../camel/quarkus/main/cmd/it/CommandModeIT.java   |  32 +++++
 .../camel/quarkus/main/cmd/it/CommandModeTest.java |  52 ++++++++
 integration-tests/pom.xml                          |   1 +
 pom.xml                                            |   1 +
 poms/bom-test/pom.xml                              |   5 +
 tooling/scripts/test-categories.yaml               |   1 +
 10 files changed, 294 insertions(+), 1 deletion(-)

diff --git a/extensions-core/main/runtime/pom.xml b/extensions-core/main/runtime/pom.xml
index 8c5a9c1..140accf 100644
--- a/extensions-core/main/runtime/pom.xml
+++ b/extensions-core/main/runtime/pom.xml
@@ -75,7 +75,7 @@
                     <execution>
                         <id>update-extension-doc-page</id>
                         <goals><goal>update-extension-doc-page</goal></goals>
-                        <phase>process-resources</phase>
+                        <phase>process-classes</phase>
                     </execution>
                 </executions>
             </plugin>
diff --git a/integration-tests/main-command-mode/pom.xml b/integration-tests/main-command-mode/pom.xml
new file mode 100644
index 0000000..be9dc9a
--- /dev/null
+++ b/integration-tests/main-command-mode/pom.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-integration-tests</artifactId>
+        <version>1.1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-integration-test-main-command-mode</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Main Command Mode</name>
+
+    <properties>
+        <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
+        <!-- The following rule tells mvnd to build the listed deployment modules before this module. -->
+        <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not -->
+        <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
+        <!-- Please update rule whenever you change the dependencies of this module by running -->
+        <!--     mvn process-resources -Pformat    from the root directory -->
+        <mvnd.builder.rule>camel-quarkus-log-deployment,camel-quarkus-main-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-timer-deployment</mvnd.builder.rule>
+
+        <quarkus.runner.jar>${basedir}/target/${project.artifactId}-${project.version}-runner.jar</quarkus.runner.jar>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-main</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-timer</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.zeroturnaround</groupId>
+            <artifactId>zt-exec</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!-- Move surefire:test to integration-test phase to be able to run
+                     java -jar target/*runner.jar from a test -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>default-test</id>
+                        <goals>
+                            <goal>test</goal>
+                        </goals>
+                        <phase>integration-test</phase>
+                        <configuration>
+                            <systemProperties>
+                                <quarkus.runner.jar>${quarkus.runner.jar}</quarkus.runner.jar>
+                            </systemProperties>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.package.type>native</quarkus.package.type>
+                <quarkus.runner.jar>${basedir}/target/${project.artifactId}-${project.version}-native-image-source-jar/${project.artifactId}-${project.version}-runner.jar</quarkus.runner.jar>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                                <configuration>
+                                    <systemProperties>
+                                        <quarkus.runner>${basedir}/target/${project.artifactId}-${project.version}-runner</quarkus.runner>
+                                    </systemProperties>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/integration-tests/main-command-mode/src/main/java/org/apache/camel/quarkus/main/cmd/CamelRoute.java b/integration-tests/main-command-mode/src/main/java/org/apache/camel/quarkus/main/cmd/CamelRoute.java
new file mode 100644
index 0000000..b0d6df4
--- /dev/null
+++ b/integration-tests/main-command-mode/src/main/java/org/apache/camel/quarkus/main/cmd/CamelRoute.java
@@ -0,0 +1,36 @@
+/*
+ * 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.cmd;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+
+@ApplicationScoped
+public class CamelRoute extends RouteBuilder {
+
+    @ConfigProperty(name = "greeted.subject", defaultValue = "World")
+    String greetedSubject;
+
+    @Override
+    public void configure() {
+        from("timer:hello")
+                .setBody().constant("Hello " + greetedSubject + "!")
+                .to("log:hello");
+    }
+}
diff --git a/integration-tests/main-command-mode/src/main/resources/application.properties b/integration-tests/main-command-mode/src/main/resources/application.properties
new file mode 100644
index 0000000..ade6fba
--- /dev/null
+++ b/integration-tests/main-command-mode/src/main/resources/application.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+camel.main.duration-max-messages = 1
diff --git a/integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeIT.java b/integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeIT.java
new file mode 100644
index 0000000..16cec19
--- /dev/null
+++ b/integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeIT.java
@@ -0,0 +1,32 @@
+/*
+ * 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.cmd.it;
+
+import java.nio.file.Paths;
+
+import org.assertj.core.api.Assertions;
+
+public class CommandModeIT extends CommandModeTest {
+
+    protected String[] command(String greetingSubject) {
+        final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
+        final String runner = System.getProperty("quarkus.runner") + (isWindows ? ".exe" : "");
+        Assertions.assertThat(Paths.get(runner)).exists();
+        return new String[] { runner, "-Dgreeted.subject=" + greetingSubject };
+    }
+
+}
diff --git a/integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeTest.java b/integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeTest.java
new file mode 100644
index 0000000..2de094b
--- /dev/null
+++ b/integration-tests/main-command-mode/src/test/java/org/apache/camel/quarkus/main/cmd/it/CommandModeTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cmd.it;
+
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.concurrent.TimeoutException;
+
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.zeroturnaround.exec.InvalidExitValueException;
+import org.zeroturnaround.exec.ProcessExecutor;
+import org.zeroturnaround.exec.ProcessResult;
+
+public class CommandModeTest {
+
+    @Test
+    void hello() throws InvalidExitValueException, IOException, InterruptedException, TimeoutException {
+
+        final ProcessResult result = new ProcessExecutor()
+                .command(command("Joe"))
+                .readOutput(true)
+                .execute();
+
+        Assertions.assertThat(result.getExitValue()).isEqualTo(0);
+        Assertions.assertThat(result.outputUTF8()).contains("Hello Joe!");
+
+    }
+
+    protected String[] command(String greetingSubject) {
+        final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
+        final String javaExecutable = System.getProperty("java.home") + (isWindows ? "/bin/java.exe" : "/bin/java");
+        final String runnerJar = System.getProperty("quarkus.runner.jar");
+        Assertions.assertThat(Paths.get(runnerJar)).exists();
+        return new String[] { javaExecutable, "-Dgreeted.subject=" + greetingSubject, "-jar", runnerJar };
+    }
+
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 95519d2..b9a3835 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -61,6 +61,7 @@
         <module>main-xml-io</module>
         <module>main-collector</module>
         <module>main-caffeine-lrucache</module>
+        <module>main-command-mode</module>
 
         <!-- extensions a..z; do not remove this comment, it is important when sorting via  mvn process-resources -Pformat -->
         <module>activemq</module>
diff --git a/pom.xml b/pom.xml
index 1156791..5069db3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,6 +88,7 @@
         <sshd.version>2.3.0</sshd.version>
         <stax2.version>4.2</stax2.version>
         <testcontainers.version>1.14.3</testcontainers.version>
+        <zt-exec.version>1.11</zt-exec.version>
 
         <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
         <maven.compiler.target>1.8</maven.compiler.target>
diff --git a/poms/bom-test/pom.xml b/poms/bom-test/pom.xml
index 58a15df..672b042 100644
--- a/poms/bom-test/pom.xml
+++ b/poms/bom-test/pom.xml
@@ -130,6 +130,11 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.zeroturnaround</groupId>
+                <artifactId>zt-exec</artifactId>
+                <version>${zt-exec.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 3dc42a0..375ea1f 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -29,6 +29,7 @@ main:
   - main-caffeine-lrucache
   - main-collector
   - main-devmode
+  - main-command-mode
   - main-xml-io
   - main-xml-jaxb
 database: