You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2020/11/09 11:19:48 UTC
[camel-quarkus] branch master updated: Added MSV native support
This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new fdd007f Added MSV native support
fdd007f is described below
commit fdd007f31b2e304af11938033c95856caf82a78a
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Nov 9 09:26:58 2020 +0100
Added MSV native support
---
.../ROOT/pages/reference/extensions/msv.adoc | 27 ++++++--
.../ROOT/partials/reference/components/msv.adoc | 6 +-
.../component/msv/deployment/MsvProcessor.java | 46 --------------
extensions-jvm/pom.xml | 1 -
.../msv/deployment/pom.xml | 0
.../component/msv/deployment/MsvProcessor.java | 72 ++++++++++++++++++++++
{extensions-jvm => extensions}/msv/pom.xml | 1 -
{extensions-jvm => extensions}/msv/runtime/pom.xml | 1 +
.../msv/runtime/src/main/doc/configuration.adoc | 15 +++++
.../main/resources/META-INF/quarkus-extension.yaml | 3 +-
extensions/pom.xml | 1 +
.../msv}/pom.xml | 56 +++++++++++++++--
.../quarkus/component/msv/it/MsvResource.java | 21 +++----
.../camel/quarkus/component/msv/it/MsvRoute.java | 18 +++---
.../msv/src/main/resources/application.properties | 17 +++++
.../msv/src/main/resources/schema.rng | 28 +++------
.../camel/quarkus/component/msv/it/MsvIT.java | 16 +----
.../camel/quarkus/component/msv/it/MsvTest.java | 18 ++++--
integration-tests/pom.xml | 1 +
tooling/scripts/test-categories.yaml | 1 +
20 files changed, 226 insertions(+), 123 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/msv.adoc b/docs/modules/ROOT/pages/reference/extensions/msv.adoc
index 21df8da..5685003 100644
--- a/docs/modules/ROOT/pages/reference/extensions/msv.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/msv.adoc
@@ -2,15 +2,15 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= MSV
:cq-artifact-id: camel-quarkus-msv
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
:cq-description: Validate XML payloads using Multi-Schema Validator (MSV).
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.4.0
[.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.4.0##
Validate XML payloads using Multi-Schema Validator (MSV).
@@ -31,3 +31,22 @@ Please refer to the above link for usage and configuration details.
----
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+
+== Additional Camel Quarkus configuration
+
+Beyond standard usages described above, a trick is needed when using msv schemas from classpath resources in native mode. In such a situation, one needs to explicitly embed the resources in the native executable by specifying the `include-patterns` option.
+
+For instance, the route below would load the msv schema from a classpath resource named _schema.rng_:
+[source,java]
+----
+from("direct:start").to("msv:schema.rng");
+----
+
+In order to work in native mode the `include-patterns` configuration should be set. For instance, in the `application.properties` file as below :
+[source,properties]
+----
+quarkus.camel.native.resources.include-patterns = *.rng
+----
+
+More information about selecting resources for inclusion in the native executable could be found at xref:user-guide/native-mode.adoc#embedding-resource-in-native-executable[Embedding resource in native executable].
+
diff --git a/docs/modules/ROOT/partials/reference/components/msv.adoc b/docs/modules/ROOT/partials/reference/components/msv.adoc
index a7abc3c..aa0df03 100644
--- a/docs/modules/ROOT/partials/reference/components/msv.adoc
+++ b/docs/modules/ROOT/partials/reference/components/msv.adoc
@@ -2,11 +2,11 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-msv
:cq-artifact-id-base: msv
-:cq-native-supported: false
-:cq-status: Preview
+:cq-native-supported: true
+:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 1.4.0
:cq-camel-part-name: msv
:cq-camel-part-title: MSV
:cq-camel-part-description: Validate XML payloads using Multi-Schema Validator (MSV).
diff --git a/extensions-jvm/msv/deployment/src/main/java/org/apache/camel/quarkus/component/msv/deployment/MsvProcessor.java b/extensions-jvm/msv/deployment/src/main/java/org/apache/camel/quarkus/component/msv/deployment/MsvProcessor.java
deleted file mode 100644
index b1d1be9..0000000
--- a/extensions-jvm/msv/deployment/src/main/java/org/apache/camel/quarkus/component/msv/deployment/MsvProcessor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.msv.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 io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
-
-class MsvProcessor {
-
- private static final Logger LOG = Logger.getLogger(MsvProcessor.class);
- private static final String FEATURE = "camel-msv";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
- }
-
- /**
- * Remove this once this extension starts supporting the native mode.
- */
- @BuildStep(onlyIf = NativeBuild.class)
- @Record(value = ExecutionTime.RUNTIME_INIT)
- void warnJvmInNative(JvmOnlyRecorder recorder) {
- JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
- recorder.warnJvmInNative(FEATURE); // warn at runtime
- }
-}
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index e1bd37a..337ced7 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -105,7 +105,6 @@
<module>management</module>
<module>milo</module>
<module>mllp</module>
- <module>msv</module>
<module>mvel</module>
<module>mybatis</module>
<module>nitrite</module>
diff --git a/extensions-jvm/msv/deployment/pom.xml b/extensions/msv/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/msv/deployment/pom.xml
rename to extensions/msv/deployment/pom.xml
diff --git a/extensions/msv/deployment/src/main/java/org/apache/camel/quarkus/component/msv/deployment/MsvProcessor.java b/extensions/msv/deployment/src/main/java/org/apache/camel/quarkus/component/msv/deployment/MsvProcessor.java
new file mode 100644
index 0000000..fe8fc68
--- /dev/null
+++ b/extensions/msv/deployment/src/main/java/org/apache/camel/quarkus/component/msv/deployment/MsvProcessor.java
@@ -0,0 +1,72 @@
+/*
+ * 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.msv.deployment;
+
+import com.sun.msv.verifier.jarv.FactoryLoaderImpl;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.support.processor.validation.DefaultValidationErrorHandler;
+import org.relaxng.datatype.DatatypeLibraryFactory;
+
+class MsvProcessor {
+
+ private static final String FEATURE = "camel-msv";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void registerReflectiveClasses(BuildProducer<ReflectiveClassBuildItem> producer) {
+ producer.produce(new ReflectiveClassBuildItem(false, false, FactoryLoaderImpl.class));
+ producer.produce(new ReflectiveClassBuildItem(false, false, DatatypeLibraryFactory.class));
+ producer.produce(new ReflectiveClassBuildItem(false, false, DefaultValidationErrorHandler.class));
+
+ String datatypeLibraryLoaderClass = "org.relaxng.datatype.helpers.DatatypeLibraryLoader$Service$Loader2";
+ producer.produce(new ReflectiveClassBuildItem(false, false, datatypeLibraryLoaderClass));
+ }
+
+ @BuildStep
+ void registerResources(BuildProducer<NativeImageResourceBuildItem> producer) {
+ String verifierFactory = "META-INF/services/org.iso_relax.verifier.VerifierFactoryLoader";
+ producer.produce(new NativeImageResourceBuildItem(verifierFactory));
+ }
+
+ @BuildStep
+ void registerResourceBundles(BuildProducer<NativeImageResourceBundleBuildItem> producer) {
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.verifier.regexp.xmlschema.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.verifier.regexp.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.verifier.identity.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.verifier.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.relaxns.verifier.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.relaxns.grammar.relax.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.reader.xmlschema.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.reader.trex.ng.comp.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.reader.trex.ng.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.reader.trex.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.reader.relax.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.reader.dtd.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.grammar.trex.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.grammar.relaxng.Messages"));
+ producer.produce(new NativeImageResourceBundleBuildItem("com.sun.msv.driver.textui.Messages"));
+ }
+}
diff --git a/extensions-jvm/msv/pom.xml b/extensions/msv/pom.xml
similarity index 97%
copy from extensions-jvm/msv/pom.xml
copy to extensions/msv/pom.xml
index a2f125e..d316904 100644
--- a/extensions-jvm/msv/pom.xml
+++ b/extensions/msv/pom.xml
@@ -33,6 +33,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
- <module>integration-test</module>
</modules>
</project>
diff --git a/extensions-jvm/msv/runtime/pom.xml b/extensions/msv/runtime/pom.xml
similarity index 98%
rename from extensions-jvm/msv/runtime/pom.xml
rename to extensions/msv/runtime/pom.xml
index fafa0f1..a873562 100644
--- a/extensions-jvm/msv/runtime/pom.xml
+++ b/extensions/msv/runtime/pom.xml
@@ -32,6 +32,7 @@
<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>1.4.0</camel.quarkus.nativeSince>
</properties>
<dependencyManagement>
diff --git a/extensions/msv/runtime/src/main/doc/configuration.adoc b/extensions/msv/runtime/src/main/doc/configuration.adoc
new file mode 100644
index 0000000..379aaf5
--- /dev/null
+++ b/extensions/msv/runtime/src/main/doc/configuration.adoc
@@ -0,0 +1,15 @@
+Beyond standard usages described above, a trick is needed when using msv schemas from classpath resources in native mode. In such a situation, one needs to explicitly embed the resources in the native executable by specifying the `include-patterns` option.
+
+For instance, the route below would load the msv schema from a classpath resource named _schema.rng_:
+[source,java]
+----
+from("direct:start").to("msv:schema.rng");
+----
+
+In order to work in native mode the `include-patterns` configuration should be set. For instance, in the `application.properties` file as below :
+[source,properties]
+----
+quarkus.camel.native.resources.include-patterns = *.rng
+----
+
+More information about selecting resources for inclusion in the native executable could be found at xref:user-guide/native-mode.adoc#embedding-resource-in-native-executable[Embedding resource in native executable].
\ No newline at end of file
diff --git a/extensions-jvm/msv/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/msv/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 97%
rename from extensions-jvm/msv/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to extensions/msv/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index dc97da5..d40596f 100644
--- a/extensions-jvm/msv/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ b/extensions/msv/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,9 +24,8 @@
name: "Camel MSV"
description: "Validate XML payloads using Multi-Schema Validator (MSV)"
metadata:
- unlisted: true
guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/msv.html"
categories:
- "integration"
status:
- - "preview"
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 3d1afa0..7ab3743 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -151,6 +151,7 @@
<module>mock</module>
<module>mongodb</module>
<module>mongodb-gridfs</module>
+ <module>msv</module>
<module>mustache</module>
<module>nagios</module>
<module>nats</module>
diff --git a/extensions-jvm/msv/integration-test/pom.xml b/integration-tests/msv/pom.xml
similarity index 60%
rename from extensions-jvm/msv/integration-test/pom.xml
rename to integration-tests/msv/pom.xml
index e051dfa..70b8c77 100644
--- a/extensions-jvm/msv/integration-test/pom.xml
+++ b/integration-tests/msv/pom.xml
@@ -21,13 +21,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
<version>1.4.0-SNAPSHOT</version>
- <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
</parent>
- <artifactId>camel-quarkus-msv-integration-test</artifactId>
- <name>Camel Quarkus :: MSV :: Integration Test</name>
+ <artifactId>camel-quarkus-integration-test-msv</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: MSV</name>
<description>Integration tests for Camel Quarkus MSV extension</description>
<dependencyManagement>
@@ -48,6 +47,10 @@
<artifactId>camel-quarkus-msv</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>
@@ -67,6 +70,21 @@
<!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-msv-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
@@ -80,4 +98,34 @@
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </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>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
</project>
diff --git a/extensions-jvm/msv/integration-test/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvResource.java b/integration-tests/msv/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvResource.java
similarity index 68%
rename from extensions-jvm/msv/integration-test/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvResource.java
rename to integration-tests/msv/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvResource.java
index 9efcce2..0421329 100644
--- a/extensions-jvm/msv/integration-test/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvResource.java
+++ b/integration-tests/msv/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvResource.java
@@ -18,13 +18,13 @@ package org.apache.camel.quarkus.component.msv.it;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
+import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
import org.jboss.logging.Logger;
@Path("/msv")
@@ -33,19 +33,16 @@ public class MsvResource {
private static final Logger LOG = Logger.getLogger(MsvResource.class);
- private static final String COMPONENT_MSV = "msv";
@Inject
- CamelContext context;
+ ProducerTemplate template;
- @Path("/load/component/msv")
+ @Path("/rng/validate")
@GET
+ @Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
- public Response loadComponentMsv() throws Exception {
- /* This is an autogenerated test */
- if (context.getComponent(COMPONENT_MSV) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_MSV);
- return Response.status(500, COMPONENT_MSV + " could not be loaded from the Camel context").build();
+ public String rngValidate(String xml) {
+ LOG.debugf("Calling rngValidate(%s)", xml);
+ return template.requestBody("direct:rng-validate", xml, String.class);
}
+
}
diff --git a/extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java b/integration-tests/msv/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvRoute.java
similarity index 70%
copy from extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
copy to integration-tests/msv/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvRoute.java
index 5a0bd7c..2d144ec 100644
--- a/extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
+++ b/integration-tests/msv/src/main/java/org/apache/camel/quarkus/component/msv/it/MsvRoute.java
@@ -16,19 +16,15 @@
*/
package org.apache.camel.quarkus.component.msv.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import org.apache.camel.ValidationException;
+import org.apache.camel.builder.RouteBuilder;
-@QuarkusTest
-class MsvTest {
+public class MsvRoute extends RouteBuilder {
- @Test
- public void loadComponentMsv() {
- /* A simple autogenerated test */
- RestAssured.get("/msv/load/component/msv")
- .then()
- .statusCode(200);
+ @Override
+ public void configure() {
+ from("direct:rng-validate").doTry().to("msv:schema.rng").setBody(constant("rng-valid"))
+ .doCatch(ValidationException.class).setBody(constant("rng-invalid")).end();
}
}
diff --git a/integration-tests/msv/src/main/resources/application.properties b/integration-tests/msv/src/main/resources/application.properties
new file mode 100644
index 0000000..46bf0d0
--- /dev/null
+++ b/integration-tests/msv/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.camel.native.resources.include-patterns=*.rng
\ No newline at end of file
diff --git a/extensions-jvm/msv/pom.xml b/integration-tests/msv/src/main/resources/schema.rng
similarity index 50%
rename from extensions-jvm/msv/pom.xml
rename to integration-tests/msv/src/main/resources/schema.rng
index a2f125e..0bd3356 100644
--- a/extensions-jvm/msv/pom.xml
+++ b/integration-tests/msv/src/main/resources/schema.rng
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,22 +16,11 @@
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>1.4.0-SNAPSHOT</version>
- <relativePath>../../poms/build-parent/pom.xml</relativePath>
- </parent>
-
- <artifactId>camel-quarkus-msv-parent</artifactId>
- <name>Camel Quarkus :: MSV</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>deployment</module>
- <module>runtime</module>
- <module>integration-test</module>
- </modules>
-</project>
+<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://foo.com/bar" name="mail">
+ <element name="subject">
+ <text/>
+ </element>
+ <element name="body">
+ <text/>
+ </element>
+</element>
diff --git a/extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java b/integration-tests/msv/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvIT.java
similarity index 71%
copy from extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
copy to integration-tests/msv/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvIT.java
index 5a0bd7c..016fc0c 100644
--- a/extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
+++ b/integration-tests/msv/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvIT.java
@@ -16,19 +16,9 @@
*/
package org.apache.camel.quarkus.component.msv.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.NativeImageTest;
-@QuarkusTest
-class MsvTest {
-
- @Test
- public void loadComponentMsv() {
- /* A simple autogenerated test */
- RestAssured.get("/msv/load/component/msv")
- .then()
- .statusCode(200);
- }
+@NativeImageTest
+class MsvIT extends MsvTest {
}
diff --git a/extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java b/integration-tests/msv/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
similarity index 59%
rename from extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
rename to integration-tests/msv/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
index 5a0bd7c..8ea08bb 100644
--- a/extensions-jvm/msv/integration-test/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
+++ b/integration-tests/msv/src/test/java/org/apache/camel/quarkus/component/msv/it/MsvTest.java
@@ -17,18 +17,24 @@
package org.apache.camel.quarkus.component.msv.it;
import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.is;
+
@QuarkusTest
class MsvTest {
@Test
- public void loadComponentMsv() {
- /* A simple autogenerated test */
- RestAssured.get("/msv/load/component/msv")
- .then()
- .statusCode(200);
+ void validateCorrectXmlWithRngXmlSyntaxShouldReturnValid() {
+ String content = "<mail xmlns='http://foo.com/bar'><subject>Hey</subject><body>Hello world!</body></mail>";
+ given().when().body(content).get("/msv/rng/validate").then().statusCode(200).body(is("rng-valid"));
+ }
+
+ @Test
+ void validateIncorrectXmlWithRngXmlSyntaxShouldReturnInvalid() {
+ String content = "<mail xmlns='http://foo.com/bar'><body>Hello world!</body></mail>";
+ given().when().body(content).get("/msv/rng/validate").then().statusCode(200).body(is("rng-invalid"));
}
}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 4ead2df..b1c8f81 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -126,6 +126,7 @@
<module>messaging</module>
<module>microprofile</module>
<module>mongodb</module>
+ <module>msv</module>
<module>mustache</module>
<module>nagios</module>
<module>nats</module>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 5ad16aa..6831550 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -80,6 +80,7 @@ xml-json-olingo4:
- dataformats-json
- dropbox
- jing
+ - msv
- olingo4
- weather
- geocoder