You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/11/15 17:30:15 UTC

[camel-quarkus] branch master updated (035ba50 -> a2d7095)

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

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


    from 035ba50  Fixed an issue where camel-quarkus-pdf was ignoring the camel-pdf configuration in native mode
     new 1060ba9  Fixes #411 bean-validator extension
     new 8ec7447  #411 use hibernate-validator extension. Thanks Luca
     new 5c4487e  Polished, remove duplicate, thanks Peter, and order a..z
     new a2d7095  Make the BeanValidatorComponent leverage the ValidatorFactory computed by Quarkus

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:
 build/eclipse-formatter-config.xml                 |  2 +-
 .../pages/list-of-camel-quarkus-extensions.adoc    |  5 +-
 .../deployment/pom.xml                             | 20 +++---
 .../deployment/BeanValidatorProcessor.java}        | 37 ++++++----
 .../bean-validator/pom.xml                         |  6 +-
 .../{jackson => bean-validator}/runtime/pom.xml    | 49 +++++++------
 .../bean/validator/BeanValidatorRecorder.java      | 81 ++++++++++++++++++++++
 ...tituteHibernateValidationProviderResolver.java} | 13 ++--
 .../graal/SubstituteValidatorFactories.java}       | 40 +++++------
 .../main/resources/META-INF/quarkus-extension.yaml |  5 +-
 extensions/pom.xml                                 |  1 +
 extensions/readme.adoc                             |  5 +-
 .../bean-validator/pom.xml                         | 14 ++--
 .../bean/validator/it/BeanValidatorResource.java}  | 42 +++++------
 .../bean/validator/it/BeanValidatorRoute.java}     |  8 ++-
 .../component/bean/validator/it/model/Car.java     | 43 +++++++-----
 .../src/main/resources/application.properties      |  6 +-
 .../bean/validator/it/BeanValidatorIT.java}        |  4 +-
 .../bean/validator/it/BeanValidatorTest.java}      | 10 +--
 integration-tests/pom.xml                          |  1 +
 pom.xml                                            |  1 +
 poms/bom-deployment/pom.xml                        |  5 ++
 poms/bom/pom.xml                                   | 31 ++++++---
 23 files changed, 271 insertions(+), 158 deletions(-)
 copy extensions/{reactive-executor => bean-validator}/deployment/pom.xml (81%)
 copy extensions/{reactive-executor/deployment/src/main/java/org/apache/camel/quarkus/reactive/executor/deployment/BuildProcessor.java => bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java} (53%)
 copy build/create-extension-templates/parent-pom.xml => extensions/bean-validator/pom.xml (90%)
 copy extensions/{jackson => bean-validator}/runtime/pom.xml (70%)
 create mode 100644 extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/BeanValidatorRecorder.java
 copy extensions/{netty/runtime/src/main/java/org/apache/camel/quarkus/component/netty/runtime/SubstituteNettyServerBootstrapConfiguration.java => bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteHibernateValidationProviderResolver.java} (73%)
 copy extensions/{netty/runtime/src/main/java/org/apache/camel/quarkus/component/netty/runtime/SubstituteNettyServerBossPoolBuilder.java => bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteValidatorFactories.java} (52%)
 copy extensions/{bean => bean-validator}/runtime/src/main/resources/META-INF/quarkus-extension.yaml (88%)
 copy build/create-extension-templates/integration-test-pom.xml => integration-tests/bean-validator/pom.xml (90%)
 copy integration-tests/{paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java => bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorResource.java} (58%)
 copy integration-tests/{xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java => bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorRoute.java} (82%)
 copy extensions/microprofile-metrics/runtime/src/main/java/org/apache/camel/quarkus/component/microprofile/metrics/runtime/patch/CamelQuarkusAtomicIntegerGauge.java => integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/model/Car.java (51%)
 copy integration-tests/{xslt => bean-validator}/src/main/resources/application.properties (92%)
 copy integration-tests/{csv/src/test/java/org/apache/camel/quarkus/component/csv/it/CsvIT.java => bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorIT.java} (88%)
 copy integration-tests/{xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java => bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorTest.java} (79%)


[camel-quarkus] 03/04: Polished, remove duplicate, thanks Peter, and order a..z

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

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

commit 5c4487e7632980d53a901908c56afd1a909faa13
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Nov 13 12:11:53 2019 +0100

    Polished, remove duplicate, thanks Peter, and order a..z
---
 poms/bom-deployment/pom.xml |  5 -----
 poms/bom/pom.xml            | 10 +++++-----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 8cdce86..70cc754 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -313,11 +313,6 @@
                 <artifactId>camel-quarkus-xslt-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
-            <dependency>
-                <groupId>org.apache.camel.quarkus</groupId>
-                <artifactId>camel-quarkus-bean-validator-deployment</artifactId>
-                <version>${camel-quarkus.version}</version>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 1369d1a..b8134a4 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -410,6 +410,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bean-validator</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-controlbus</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
@@ -615,11 +620,6 @@
                 <artifactId>camel-quarkus-xslt</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
-            <dependency>
-                <groupId>org.apache.camel.quarkus</groupId>
-                <artifactId>camel-quarkus-bean-validator</artifactId>
-                <version>${camel-quarkus.version}</version>
-            </dependency>
 
         </dependencies>
     </dependencyManagement>


[camel-quarkus] 01/04: Fixes #411 bean-validator extension

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

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

commit 1060ba90ef91e6ff56d4ff8b98583752fc4596b9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Nov 13 11:38:29 2019 +0100

    Fixes #411 bean-validator extension
---
 .../pages/list-of-camel-quarkus-extensions.adoc    |   3 +
 extensions/bean-validator/deployment/pom.xml       |  75 ++++++++++++
 .../deployment/BeanValidatorProcessor.java         |  31 +++++
 extensions/bean-validator/pom.xml                  |  39 ++++++
 extensions/bean-validator/runtime/pom.xml          |  82 +++++++++++++
 .../main/resources/META-INF/quarkus-extension.yaml |  27 +++++
 extensions/pom.xml                                 |   1 +
 extensions/readme.adoc                             |   3 +
 integration-tests/bean-validator/pom.xml           | 132 +++++++++++++++++++++
 .../bean/validator/it/BeanValidatorResource.java   |  56 +++++++++
 .../bean/validator/it/BeanValidatorRoute.java      |  30 +++++
 .../component/bean/validator/it/model/Car.java     |  52 ++++++++
 .../bean/validator/it/BeanValidatorIT.java         |  24 ++++
 .../bean/validator/it/BeanValidatorTest.java       |  33 ++++++
 integration-tests/pom.xml                          |   1 +
 poms/bom-deployment/pom.xml                        |  10 ++
 poms/bom/pom.xml                                   |  10 ++
 17 files changed, 609 insertions(+)

diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 52b065c..439be68 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -27,6 +27,9 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 | link:https://camel.apache.org/components/latest/bean-component.html[Bean] (camel-quarkus-bean) +
 `bean:beanName` | 0.2 | The bean component is for invoking Java beans from Camel.
 
+| link:https://camel.apache.org/components/latest/bean-validator-component.html[Bean Validator] (camel-quarkus-bean-validator) +
+`bean-validator:label` | 0.4 | The Validator component performs bean validation of the message body using the Java Bean Validation API.
+
 | link:https://camel.apache.org/components/latest/class-component.html[Class] (camel-quarkus-bean) +
 `class:beanName` | 0.2 | The class component is for invoking Java classes (Java beans) from Camel.
 
diff --git a/extensions/bean-validator/deployment/pom.xml b/extensions/bean-validator/deployment/pom.xml
new file mode 100644
index 0000000..b5f9abe
--- /dev/null
+++ b/extensions/bean-validator/deployment/pom.xml
@@ -0,0 +1,75 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-bean-validator-parent</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-bean-validator-deployment</artifactId>
+    <name>Camel Quarkus :: Bean Validator :: Deployment</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom-deployment</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core-deployment</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-bean-validator</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            <artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java b/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
new file mode 100644
index 0000000..1b9be1b
--- /dev/null
+++ b/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
@@ -0,0 +1,31 @@
+/*
+ * 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.component.bean.validator.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class BeanValidatorProcessor {
+
+    private static final String FEATURE = "camel-bean-validator";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+}
diff --git a/extensions/bean-validator/pom.xml b/extensions/bean-validator/pom.xml
new file mode 100644
index 0000000..bef510b
--- /dev/null
+++ b/extensions/bean-validator/pom.xml
@@ -0,0 +1,39 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-build-parent</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-bean-validator-parent</artifactId>
+    <name>Camel Quarkus :: Bean Validator</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>deployment</module>
+        <module>runtime</module>
+    </modules>
+</project>
diff --git a/extensions/bean-validator/runtime/pom.xml b/extensions/bean-validator/runtime/pom.xml
new file mode 100644
index 0000000..2cc3b91
--- /dev/null
+++ b/extensions/bean-validator/runtime/pom.xml
@@ -0,0 +1,82 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-bean-validator-parent</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-bean-validator</artifactId>
+    <name>Camel Quarkus :: Bean Validator :: Runtime</name>
+
+    <properties>
+        <firstVersion>0.4.0</firstVersion>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-bean-validator</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            <artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/extensions/bean-validator/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/bean-validator/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..4650bd8
--- /dev/null
+++ b/extensions/bean-validator/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+---
+name: "Camel Quarkus Bean Validator"
+description: "Camel Java Beans Validation support"
+metadata:
+  keywords:
+  - "camel"
+  - "bean"
+  guide: "https://quarkus.io/guides/camel"
+  categories:
+  - "integration"
\ No newline at end of file
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 40f62f5..e1c1730 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -82,6 +82,7 @@
         <module>vm</module>
         <module>zipfile</module>
         <module>xslt</module>
+        <module>bean-validator</module>
 
     </modules>
 
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 4b87922..c233963 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -26,6 +26,9 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 | link:https://camel.apache.org/components/latest/bean-component.html[Bean] (camel-quarkus-bean) +
 `bean:beanName` | 0.2 | The bean component is for invoking Java beans from Camel.
 
+| link:https://camel.apache.org/components/latest/bean-validator-component.html[Bean Validator] (camel-quarkus-bean-validator) +
+`bean-validator:label` | 0.4 | The Validator component performs bean validation of the message body using the Java Bean Validation API.
+
 | link:https://camel.apache.org/components/latest/class-component.html[Class] (camel-quarkus-bean) +
 `class:beanName` | 0.2 | The class component is for invoking Java classes (Java beans) from Camel.
 
diff --git a/integration-tests/bean-validator/pom.xml b/integration-tests/bean-validator/pom.xml
new file mode 100644
index 0000000..55c0662
--- /dev/null
+++ b/integration-tests/bean-validator/pom.xml
@@ -0,0 +1,132 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-integration-tests</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-bean-validator</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: Bean Validator</name>
+    <description>Integration tests for Camel Quarkus Bean Validator extension</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-bean-validator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</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>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <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>
+                                        <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+                                    </systemProperties>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>io.quarkus</groupId>
+                        <artifactId>quarkus-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>native-image</id>
+                                <goals>
+                                    <goal>native-image</goal>
+                                </goals>
+                                <configuration>
+                                    <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+                                    <cleanupServer>true</cleanupServer>
+                                    <enableHttpsUrlHandler>true</enableHttpsUrlHandler>
+                                    <enableServer>false</enableServer>
+                                    <dumpProxies>false</dumpProxies>
+                                    <graalvmHome>${graalvmHome}</graalvmHome>
+                                    <enableJni>true</enableJni>
+                                    <enableAllSecurityServices>true</enableAllSecurityServices>
+                                    <disableReports>true</disableReports>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorResource.java b/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorResource.java
new file mode 100644
index 0000000..5bf17e0
--- /dev/null
+++ b/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorResource.java
@@ -0,0 +1,56 @@
+/*
+ * 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.component.bean.validator.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.quarkus.component.bean.validator.it.model.Car;
+import org.jboss.logging.Logger;
+
+@Path("/bean-validator")
+@ApplicationScoped
+public class BeanValidatorResource {
+
+    private static final Logger LOG = Logger.getLogger(BeanValidatorResource.class);
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/get/{manufactor}/{plate}")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response get(@PathParam("manufactor") String manufactor, @PathParam("plate") String plate) throws Exception {
+        LOG.info("bean-validator: " + manufactor + "/" + plate);
+        Car car = new Car(manufactor, plate);
+        Exchange out = producerTemplate.request("direct:start", e -> e.getMessage().setBody(car));
+        if (out.isFailed()) {
+            return Response.status(400, "Invalid car").build();
+        } else {
+            return Response.status(200, "OK").build();
+        }
+    }
+
+}
diff --git a/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorRoute.java b/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorRoute.java
new file mode 100644
index 0000000..76a7c7d
--- /dev/null
+++ b/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorRoute.java
@@ -0,0 +1,30 @@
+/*
+ * 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.component.bean.validator.it;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class BeanValidatorRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        errorHandler(noErrorHandler());
+
+        from("direct:start")
+                .to("bean-validator:car");
+    }
+}
diff --git a/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/model/Car.java b/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/model/Car.java
new file mode 100644
index 0000000..19db6f8
--- /dev/null
+++ b/integration-tests/bean-validator/src/main/java/org/apache/camel/quarkus/component/bean/validator/it/model/Car.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.component.bean.validator.it.model;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+public class Car {
+
+    @NotNull
+    private String manufacturer;
+
+    @NotNull
+    @Size(min = 5, max = 14)
+    private String licensePlate;
+
+    public Car(String manufacturer, String licencePlate) {
+        this.manufacturer = manufacturer;
+        this.licensePlate = licencePlate;
+    }
+
+    public String getManufacturer() {
+        return manufacturer;
+    }
+
+    public void setManufacturer(String manufacturer) {
+        this.manufacturer = manufacturer;
+    }
+
+    public String getLicensePlate() {
+        return licensePlate;
+    }
+
+    public void setLicensePlate(String licensePlate) {
+        this.licensePlate = licensePlate;
+    }
+
+}
diff --git a/integration-tests/bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorIT.java b/integration-tests/bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorIT.java
new file mode 100644
index 0000000..314f46c
--- /dev/null
+++ b/integration-tests/bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.component.bean.validator.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class BeanValidatorIT extends BeanValidatorTest {
+
+}
diff --git a/integration-tests/bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorTest.java b/integration-tests/bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorTest.java
new file mode 100644
index 0000000..8e91c67
--- /dev/null
+++ b/integration-tests/bean-validator/src/test/java/org/apache/camel/quarkus/component/bean/validator/it/BeanValidatorTest.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.quarkus.component.bean.validator.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+class BeanValidatorTest {
+
+    @Test
+    public void test() {
+        RestAssured.get("/bean-validator/get/honda/123").then().statusCode(400);
+
+        RestAssured.get("/bean-validator/get/honda/DD-AB-123").then().statusCode(200);
+    }
+
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 4a84df9..1338bdf 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -111,6 +111,7 @@
         <module>validator</module>
         <module>zipfile</module>
         <module>xslt</module>
+        <module>bean-validator</module>
 
     </modules>
 
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 07ecc41..8cdce86 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -110,6 +110,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bean-validator-deployment</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-core-cloud-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
@@ -308,6 +313,11 @@
                 <artifactId>camel-quarkus-xslt-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bean-validator-deployment</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index a75a539..1369d1a 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -91,6 +91,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel</groupId>
+                <artifactId>camel-bean-validator</artifactId>
+                <version>${camel.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
                 <artifactId>camel-caffeine-lrucache</artifactId>
                 <version>${camel.version}</version>
             </dependency>
@@ -610,6 +615,11 @@
                 <artifactId>camel-quarkus-xslt</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bean-validator</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
 
         </dependencies>
     </dependencyManagement>


[camel-quarkus] 04/04: Make the BeanValidatorComponent leverage the ValidatorFactory computed by Quarkus

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

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

commit a2d7095282e659517f4606c21f7835e0b40b0b65
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Nov 15 09:41:55 2019 +0100

    Make the BeanValidatorComponent leverage the ValidatorFactory computed by Quarkus
---
 build/eclipse-formatter-config.xml                 |  2 +-
 .../pages/list-of-camel-quarkus-extensions.adoc    |  2 +-
 extensions/bean-validator/deployment/pom.xml       |  2 +-
 .../deployment/BeanValidatorProcessor.java         | 24 +++++++
 extensions/bean-validator/pom.xml                  |  2 +-
 extensions/bean-validator/runtime/pom.xml          | 22 +++++-
 .../bean/validator/BeanValidatorRecorder.java      | 81 ++++++++++++++++++++++
 ...tituteHibernateValidationProviderResolver.java} | 19 ++---
 .../graal/SubstituteValidatorFactories.java        | 40 +++++++++++
 extensions/readme.adoc                             |  2 +-
 integration-tests/bean-validator/pom.xml           |  2 +-
 .../src/main/resources/application.properties      | 22 ++++++
 pom.xml                                            |  1 +
 poms/bom/pom.xml                                   | 21 +++---
 14 files changed, 210 insertions(+), 32 deletions(-)

diff --git a/build/eclipse-formatter-config.xml b/build/eclipse-formatter-config.xml
index d0cd7cc..35b6889 100644
--- a/build/eclipse-formatter-config.xml
+++ b/build/eclipse-formatter-config.xml
@@ -265,7 +265,7 @@
         <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
         <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="CHECKSTYLE:OFF"/>
         <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="CHECKSTYLE:ON"/>
-        <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+        <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
         <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
     </profile>
 </profiles>
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 439be68..dc9584e 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -6,7 +6,7 @@ As of Camel Quarkus {camel-quarkus-last-release} the following Camel artifacts a
 == Camel Components
 
 // components: START
-Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
+Number of Camel components: 35 in 31 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
diff --git a/extensions/bean-validator/deployment/pom.xml b/extensions/bean-validator/deployment/pom.xml
index ef828d1..40bfc44 100644
--- a/extensions/bean-validator/deployment/pom.xml
+++ b/extensions/bean-validator/deployment/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-bean-validator-parent</artifactId>
-        <version>0.3.2-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java b/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
index 1b9be1b..47e1ecd 100644
--- a/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
+++ b/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
@@ -17,7 +17,14 @@
 package org.apache.camel.quarkus.component.bean.validator.deployment;
 
 import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import org.apache.camel.component.bean.validator.BeanValidatorComponent;
+import org.apache.camel.quarkus.component.bean.validator.BeanValidatorRecorder;
+import org.apache.camel.quarkus.core.CamelServiceFilter;
+import org.apache.camel.quarkus.core.deployment.CamelRuntimeBeanBuildItem;
+import org.apache.camel.quarkus.core.deployment.CamelServiceFilterBuildItem;
 
 class BeanValidatorProcessor {
 
@@ -28,4 +35,21 @@ class BeanValidatorProcessor {
         return new FeatureBuildItem(FEATURE);
     }
 
+    /*
+     * The bean-validator component is programmatically configured by the extension thus
+     * we can safely prevent camel to instantiate a default instance.
+     */
+    @BuildStep
+    CamelServiceFilterBuildItem serviceFilter() {
+        return new CamelServiceFilterBuildItem(CamelServiceFilter.forComponent("bean-validator"));
+    }
+
+    @Record(ExecutionTime.STATIC_INIT)
+    @BuildStep
+    CamelRuntimeBeanBuildItem beanValidatorComponent(BeanValidatorRecorder recorder) {
+        return new CamelRuntimeBeanBuildItem(
+                "bean-validator",
+                BeanValidatorComponent.class.getName(),
+                recorder.createBeanValidatorComponent());
+    }
 }
diff --git a/extensions/bean-validator/pom.xml b/extensions/bean-validator/pom.xml
index bef510b..cc29598 100644
--- a/extensions/bean-validator/pom.xml
+++ b/extensions/bean-validator/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-build-parent</artifactId>
-        <version>0.3.2-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../../poms/build-parent/pom.xml</relativePath>
     </parent>
 
diff --git a/extensions/bean-validator/runtime/pom.xml b/extensions/bean-validator/runtime/pom.xml
index cc5efa8..33c61b8 100644
--- a/extensions/bean-validator/runtime/pom.xml
+++ b/extensions/bean-validator/runtime/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-bean-validator-parent</artifactId>
-        <version>0.3.2-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -61,11 +61,27 @@
             <artifactId>camel-bean-validator</artifactId>
             <exclusions>
                 <exclusion>
-                    <artifactId>org.hibernate.validator</artifactId>
-                    <groupId>hibernate-validator</groupId>
+                    <groupId>org.hibernate.validator</groupId>
+                    <artifactId>hibernate-validator</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.glassfish</groupId>
+                    <artifactId>javax.el</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.el</groupId>
+                    <artifactId>javax.el-api</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.glassfish</groupId>
+            <artifactId>jakarta.el</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.oracle.substratevm</groupId>
+            <artifactId>svm</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/BeanValidatorRecorder.java b/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/BeanValidatorRecorder.java
new file mode 100644
index 0000000..eb15f94
--- /dev/null
+++ b/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/BeanValidatorRecorder.java
@@ -0,0 +1,81 @@
+/*
+ * 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.component.bean.validator;
+
+import java.util.Map;
+import javax.validation.ValidatorFactory;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Producer;
+import org.apache.camel.component.bean.validator.BeanValidatorComponent;
+import org.apache.camel.component.bean.validator.BeanValidatorEndpoint;
+import org.apache.camel.component.bean.validator.BeanValidatorProducer;
+import org.apache.camel.support.CamelContextHelper;
+
+@Recorder
+public class BeanValidatorRecorder {
+    public RuntimeValue<BeanValidatorComponent> createBeanValidatorComponent() {
+        return new RuntimeValue<>(new QuarkusBeanValidatorComponent());
+    }
+
+    static class QuarkusBeanValidatorComponent extends BeanValidatorComponent {
+        @Override
+        protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+            BeanValidatorEndpoint endpoint = new QuarkusBeanValidatorEndpoint(uri, this);
+            endpoint.setLabel(remaining);
+
+            setProperties(endpoint, parameters);
+
+            return endpoint;
+        }
+    }
+
+    static class QuarkusBeanValidatorEndpoint extends BeanValidatorEndpoint {
+        public QuarkusBeanValidatorEndpoint(String endpointUri, Component component) {
+            super(endpointUri, component);
+        }
+
+        /*
+         * TODO: we should add an option to programmatically set a ValidatorFactory
+         *       to the BeanValidatorComponent or to automatically look it up from
+         *       the registry
+         */
+        @Override
+        public Producer createProducer() throws Exception {
+            final CamelContext camelContext = getCamelContext();
+            final BeanValidatorProducer producer = new BeanValidatorProducer(this);
+            final String group = getGroup();
+
+            if (group != null) {
+                producer.setGroup(camelContext.getClassResolver().resolveMandatoryClass(group));
+            }
+
+            ValidatorFactory validatorFactory = CamelContextHelper.mandatoryLookup(
+                    camelContext,
+                    "quarkus-hibernate-validator-factory",
+                    ValidatorFactory.class);
+
+            producer.setValidatorFactory(validatorFactory);
+
+            return producer;
+        }
+    }
+}
diff --git a/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java b/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteHibernateValidationProviderResolver.java
similarity index 68%
copy from extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
copy to extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteHibernateValidationProviderResolver.java
index 1b9be1b..f3378c0 100644
--- a/extensions/bean-validator/deployment/src/main/java/org/apache/camel/quarkus/component/bean/validator/deployment/BeanValidatorProcessor.java
+++ b/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteHibernateValidationProviderResolver.java
@@ -14,18 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.bean.validator.deployment;
+package org.apache.camel.quarkus.component.bean.validator.graal;
 
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
-
-class BeanValidatorProcessor {
-
-    private static final String FEATURE = "camel-bean-validator";
-
-    @BuildStep
-    FeatureBuildItem feature() {
-        return new FeatureBuildItem(FEATURE);
-    }
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.camel.component.bean.validator.HibernateValidationProviderResolver;
 
+@Substitute
+@TargetClass(HibernateValidationProviderResolver.class)
+final class SubstituteHibernateValidationProviderResolver {
 }
diff --git a/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteValidatorFactories.java b/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteValidatorFactories.java
new file mode 100644
index 0000000..2ab008c
--- /dev/null
+++ b/extensions/bean-validator/runtime/src/main/java/org/apache/camel/quarkus/component/bean/validator/graal/SubstituteValidatorFactories.java
@@ -0,0 +1,40 @@
+/*
+ * 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.component.bean.validator.graal;
+
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.MessageInterpolator;
+import javax.validation.TraversableResolver;
+import javax.validation.ValidationProviderResolver;
+import javax.validation.ValidatorFactory;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.camel.component.bean.validator.ValidatorFactories;
+
+@TargetClass(ValidatorFactories.class)
+final class SubstituteValidatorFactories {
+    @Substitute
+    public static ValidatorFactory buildValidatorFactory(
+            boolean osgi,
+            ValidationProviderResolver validationProviderResolver,
+            MessageInterpolator messageInterpolator,
+            TraversableResolver traversableResolver,
+            ConstraintValidatorFactory constraintValidatorFactory) {
+        throw new UnsupportedOperationException();
+    }
+}
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index c233963..06ab51d 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension
 == Camel Components
 
 // components: START
-Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
+Number of Camel components: 35 in 31 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
diff --git a/integration-tests/bean-validator/pom.xml b/integration-tests/bean-validator/pom.xml
index 55c0662..cd48916 100644
--- a/integration-tests/bean-validator/pom.xml
+++ b/integration-tests/bean-validator/pom.xml
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
         <artifactId>camel-quarkus-integration-tests</artifactId>
-        <version>0.3.2-SNAPSHOT</version>
+        <version>0.4.1-SNAPSHOT</version>
     </parent>
 
     <artifactId>camel-quarkus-integration-test-bean-validator</artifactId>
diff --git a/integration-tests/bean-validator/src/main/resources/application.properties b/integration-tests/bean-validator/src/main/resources/application.properties
new file mode 100644
index 0000000..9c51e3d
--- /dev/null
+++ b/integration-tests/bean-validator/src/main/resources/application.properties
@@ -0,0 +1,22 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.log.file.enable = false
+quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = INFO
+quarkus.log.category."org.apache.camel.quarkus.component.bean.validator".level = DEBUG
diff --git a/pom.xml b/pom.xml
index 358e608..b0391d2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
         <jetty.version>9.4.18.v20190429</jetty.version>
         <xstream.version>1.4.11</xstream.version>
         <snakeyaml.version>1.25</snakeyaml.version>
+        <joda-time.version>2.10.5</joda-time.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/pom.xml b/poms/bom/pom.xml
index b8134a4..507cf5a 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -535,6 +535,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-scheduler</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-servlet</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
@@ -575,6 +580,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-xslt</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
                 <artifactId>camel-quarkus-zipfile</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
@@ -610,17 +620,6 @@
                 <artifactId>snakeyaml</artifactId>
                 <version>${snakeyaml.version}</version>
             </dependency>
-            <dependency>
-                <groupId>org.apache.camel.quarkus</groupId>
-                <artifactId>camel-quarkus-scheduler</artifactId>
-                <version>${camel-quarkus.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.camel.quarkus</groupId>
-                <artifactId>camel-quarkus-xslt</artifactId>
-                <version>${camel-quarkus.version}</version>
-            </dependency>
-
         </dependencies>
     </dependencyManagement>
 


[camel-quarkus] 02/04: #411 use hibernate-validator extension. Thanks Luca

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

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

commit 8ec7447d64e3706b714059cf9c07924396757b21
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Nov 13 11:52:36 2019 +0100

    #411 use hibernate-validator extension. Thanks Luca
---
 extensions/bean-validator/deployment/pom.xml |  4 ++++
 extensions/bean-validator/runtime/pom.xml    | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/extensions/bean-validator/deployment/pom.xml b/extensions/bean-validator/deployment/pom.xml
index b5f9abe..ef828d1 100644
--- a/extensions/bean-validator/deployment/pom.xml
+++ b/extensions/bean-validator/deployment/pom.xml
@@ -45,6 +45,10 @@
 
     <dependencies>
         <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-hibernate-validator-deployment</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-core-deployment</artifactId>
         </dependency>
diff --git a/extensions/bean-validator/runtime/pom.xml b/extensions/bean-validator/runtime/pom.xml
index 2cc3b91..cc5efa8 100644
--- a/extensions/bean-validator/runtime/pom.xml
+++ b/extensions/bean-validator/runtime/pom.xml
@@ -53,8 +53,18 @@
             <artifactId>camel-quarkus-core</artifactId>
         </dependency>
         <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-hibernate-validator</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-bean-validator</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>org.hibernate.validator</artifactId>
+                    <groupId>hibernate-validator</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
     </dependencies>