This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch camel-master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 86029ea1acf4a9e4cac220478dbcaf6c51c39de6 Author: Luca Burgazzoli <lburgazz...@gmail.com> AuthorDate: Tue Mar 2 15:41:14 2021 +0100 dsl: support for yaml-dsl --- .../ROOT/pages/reference/extensions/yaml-dsl.adoc | 27 +++ .../deployment/CamelMainNativeImageProcessor.java | 5 - extensions-core/pom.xml | 1 + extensions-core/yaml-dsl/deployment/pom.xml | 61 ++++++ extensions-core/{ => yaml-dsl}/pom.xml | 23 +-- extensions-core/yaml-dsl/runtime/pom.xml | 110 +++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 31 +++ integration-tests/main-yaml/pom.xml | 215 +++++++++++++++++++++ .../camel/quarkus/main/CoreMainYamlResource.java | 62 ++++++ .../src/main/resources/application.properties | 21 ++ .../src/main/resources/routes/my-rests.yaml | 28 +++ .../src/main/resources/routes/my-routes.yaml | 24 +++ .../apache/camel/quarkus/main/CoreMainYamlIT.java | 23 +++ .../camel/quarkus/main/CoreMainYamlTest.java | 49 +++++ integration-tests/pom.xml | 1 + poms/bom/pom.xml | 15 ++ tooling/scripts/test-categories.yaml | 1 + 17 files changed, 675 insertions(+), 22 deletions(-) diff --git a/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc new file mode 100644 index 0000000..8a85791 --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/yaml-dsl.adoc @@ -0,0 +1,27 @@ +// Do not edit directly! +// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page += YAML DSL +:cq-artifact-id: camel-quarkus-yaml-dsl +:cq-native-supported: true +:cq-status: Stable +:cq-description: An YAML stack for parsing YAML route definitions +:cq-deprecated: false +:cq-jvm-since: 1.8.0 +:cq-native-since: 1.8.0 + +[.badges] +[.badge-key]##JVM since##[.badge-supported]##1.8.0## [.badge-key]##Native since##[.badge-supported]##1.8.0## + +An YAML stack for parsing YAML route definitions + +== Maven coordinates + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-yaml-dsl</artifactId> +</dependency> +---- + +Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. diff --git a/extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CamelMainNativeImageProcessor.java b/extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CamelMainNativeImageProcessor.java index bab94d6..60183d8 100644 --- a/extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CamelMainNativeImageProcessor.java +++ b/extensions-core/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/CamelMainNativeImageProcessor.java @@ -23,7 +23,6 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import org.apache.camel.quarkus.support.common.CamelCapabilities; import org.apache.camel.support.ResourceHelper; import org.apache.camel.util.AntPathMatcher; import org.jboss.logging.Logger; @@ -50,10 +49,6 @@ public class CamelMainNativeImageProcessor { Capabilities capabilities, BuildProducer<NativeImageResourceBuildItem> nativeResource) { - if (!capabilities.isCapabilityPresent(CamelCapabilities.XML)) { - return; - } - for (String path : CamelMainHelper.routesIncludePatter().collect(Collectors.toList())) { String scheme = ResourceHelper.getScheme(path); diff --git a/extensions-core/pom.xml b/extensions-core/pom.xml index ded3939..134a3ae 100644 --- a/extensions-core/pom.xml +++ b/extensions-core/pom.xml @@ -43,6 +43,7 @@ <module>xml-jaxp</module> <module>caffeine-lrucache</module> <module>main</module> + <module>yaml-dsl</module> </modules> </project> diff --git a/extensions-core/yaml-dsl/deployment/pom.xml b/extensions-core/yaml-dsl/deployment/pom.xml new file mode 100644 index 0000000..3896b0d --- /dev/null +++ b/extensions-core/yaml-dsl/deployment/pom.xml @@ -0,0 +1,61 @@ +<?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-yaml-dsl-parent</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-yaml-dsl-deployment</artifactId> + <name>Camel Quarkus :: YAML DSL DSL :: Deployment</name> + + <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-yaml-dsl</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-core/pom.xml b/extensions-core/yaml-dsl/pom.xml similarity index 69% copy from extensions-core/pom.xml copy to extensions-core/yaml-dsl/pom.xml index ded3939..29f2b03 100644 --- a/extensions-core/pom.xml +++ b/extensions-core/yaml-dsl/pom.xml @@ -18,31 +18,20 @@ --> <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</artifactId> + <artifactId>camel-quarkus-build-parent</artifactId> <version>1.8.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-extensions-core</artifactId> + <artifactId>camel-quarkus-yaml-dsl-parent</artifactId> + <name>Camel Quarkus :: YAML DSL</name> <packaging>pom</packaging> - <name>Camel Quarkus :: Extensions :: Core</name> - <modules> - <module>core</module> - <module>core-cloud</module> - <module>http-common</module> - <module>reactive-executor</module> - <module>threadpoolfactory-vertx</module> - <module>xml-io</module> - <module>xml-io-dsl</module> - <module>xml-jaxb</module> - <module>xml-jaxp</module> - <module>caffeine-lrucache</module> - <module>main</module> + <module>deployment</module> + <module>runtime</module> </modules> - </project> diff --git a/extensions-core/yaml-dsl/runtime/pom.xml b/extensions-core/yaml-dsl/runtime/pom.xml new file mode 100644 index 0000000..8f1c70c --- /dev/null +++ b/extensions-core/yaml-dsl/runtime/pom.xml @@ -0,0 +1,110 @@ +<?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-yaml-dsl-parent</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-yaml-dsl</artifactId> + <name>Camel Quarkus :: YAML DSL :: Runtime</name> + <description>An YAML stack for parsing YAML route definitions</description> + + <properties> + <camel.quarkus.jvmSince>1.8.0</camel.quarkus.jvmSince> + <camel.quarkus.nativeSince>1.8.0</camel.quarkus.nativeSince> + </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-yaml-dsl</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> + + <profiles> + <profile> + <id>full</id> + <activation> + <property> + <name>!quickly</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-maven-plugin</artifactId> + <executions> + <execution> + <id>update-extension-doc-page</id> + <goals> + <goal>update-extension-doc-page</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/extensions-core/yaml-dsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-core/yaml-dsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..afab50f --- /dev/null +++ b/extensions-core/yaml-dsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -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. +# + +# This is a generated file. Do not edit directly! +# To re-generate, run the following command from the top level directory: +# +# mvn -N cq:update-quarkus-metadata +# +--- +name: "Camel XML IO DSL" +description: "An XML stack for parsing XML route definitions" +metadata: + guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/xml-io-dsl.html" + categories: + - "integration" + status: + - "stable" diff --git a/integration-tests/main-yaml/pom.xml b/integration-tests/main-yaml/pom.xml new file mode 100644 index 0000000..0cda9bc --- /dev/null +++ b/integration-tests/main-yaml/pom.xml @@ -0,0 +1,215 @@ +<?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.8.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>camel-quarkus-integration-test-main-yaml</artifactId> + <name>Camel Quarkus :: Integration Tests :: Main YAML :: Tests</name> + <description>The camel integration tests</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-main</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-yaml-dsl</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</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-rest</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-timer</artifactId> + </dependency> + + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-jsonb</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy-jsonb</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-xpath</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> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </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-direct-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-log-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-main-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-rest-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-timer-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-xml-io-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-xpath-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </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/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java new file mode 100644 index 0000000..1763a33 --- /dev/null +++ b/integration-tests/main-yaml/src/main/java/org/apache/camel/quarkus/main/CoreMainYamlResource.java @@ -0,0 +1,62 @@ +/* + * 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; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.json.Json; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.apache.camel.ExtendedCamelContext; +import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader; +import org.apache.camel.spi.RoutesBuilderLoader; + +@Path("/test") +@ApplicationScoped +public class CoreMainYamlResource { + @Inject + CamelMain main; + + @Path("/main/describe") + @GET + @Produces(MediaType.APPLICATION_JSON) + public JsonObject describeMain() { + final ExtendedCamelContext camelContext = main.getCamelContext().adapt(ExtendedCamelContext.class); + + JsonArrayBuilder listeners = Json.createArrayBuilder(); + main.getMainListeners().forEach(listener -> listeners.add(listener.getClass().getName())); + + JsonArrayBuilder routeBuilders = Json.createArrayBuilder(); + main.configure().getRoutesBuilders().forEach(builder -> routeBuilders.add(builder.getClass().getName())); + + JsonArrayBuilder routes = Json.createArrayBuilder(); + main.getCamelContext().getRoutes().forEach(route -> routes.add(route.getId())); + + return Json.createObjectBuilder() + .add("yaml-routes-builder-loader", + camelContext.getBootstrapFactoryFinder(RoutesBuilderLoader.FACTORY_PATH) + .findClass(YamlRoutesBuilderLoader.EXTENSION).get().getName()) + .add("routeBuilders", routeBuilders) + .add("routes", routes) + .build(); + } +} diff --git a/integration-tests/main-yaml/src/main/resources/application.properties b/integration-tests/main-yaml/src/main/resources/application.properties new file mode 100644 index 0000000..0030f2f --- /dev/null +++ b/integration-tests/main-yaml/src/main/resources/application.properties @@ -0,0 +1,21 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# +# Main +# +camel.main.routes-include-pattern = classpath:routes/my-routes.yaml,classpath:routes/my-rests.yaml diff --git a/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml b/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml new file mode 100644 index 0000000..e56034e --- /dev/null +++ b/integration-tests/main-yaml/src/main/resources/routes/my-rests.yaml @@ -0,0 +1,28 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +- rest: + path: "/greeting" + verb: + - method: "get" + to: "direct:rest" +- route: + id: "rest-route" + from: "direct:rest" + steps: + - set-body: + constant: "Hello World!!!" diff --git a/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml b/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml new file mode 100644 index 0000000..4cd422b --- /dev/null +++ b/integration-tests/main-yaml/src/main/resources/routes/my-routes.yaml @@ -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. +## --------------------------------------------------------------------------- + +- route: + id: "my-yaml-route" + from: "timer:from-xml?period=3000" + steps: + - set-body: + constant: "Hello World!!!" + - to: "log:from-yaml" diff --git a/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlIT.java b/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlIT.java new file mode 100644 index 0000000..8735fb4 --- /dev/null +++ b/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlIT.java @@ -0,0 +1,23 @@ +/* + * 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; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +public class CoreMainYamlIT extends CoreMainYamlTest { +} diff --git a/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java b/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java new file mode 100644 index 0000000..0a2c2af --- /dev/null +++ b/integration-tests/main-yaml/src/test/java/org/apache/camel/quarkus/main/CoreMainYamlTest.java @@ -0,0 +1,49 @@ +/* + * 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; + +import javax.ws.rs.core.MediaType; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.path.json.JsonPath; +import org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +@QuarkusTest +public class CoreMainYamlTest { + @Test + public void testMainInstanceWithYamlRoutes() { + JsonPath p = RestAssured.given() + .accept(MediaType.APPLICATION_JSON) + .get("/test/main/describe") + .then() + .statusCode(200) + .extract() + .body() + .jsonPath(); + + assertThat(p.getString("yaml-routes-builder-loader")) + .isEqualTo(YamlRoutesBuilderLoader.class.getName()); + assertThat(p.getList("routeBuilders", String.class)) + .isEmpty(); + assertThat(p.getList("routes", String.class)) + .contains("my-yaml-route", "rest-route"); + } +} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 98c3c8f..08fd199 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -58,6 +58,7 @@ <module>main-collector</module> <module>main-caffeine-lrucache</module> <module>main-command-mode</module> + <module>main-yaml</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/poms/bom/pom.xml b/poms/bom/pom.xml index bcbb9dd..7e0227d 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -2095,6 +2095,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-yaml-dsl</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-yammer</artifactId> <version>${camel.version}</version> </dependency> @@ -5347,6 +5352,16 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-yaml-dsl</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-yaml-dsl-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-yammer</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml index 89e8007..83a95ca 100644 --- a/tooling/scripts/test-categories.yaml +++ b/tooling/scripts/test-categories.yaml @@ -48,6 +48,7 @@ core-main-validation: - main-discovery-disabled - main-xml-io - main-xml-jaxb + - main-yaml - bean-validator - json-validator - validator