This is an automated email from the ASF dual-hosted git repository. davsclaus 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 1a26717 Created a camel-jsonpath extension #426 (#609) 1a26717 is described below commit 1a267178c1dfe7c6c7584c39c3673cec3a29b271 Author: aldettinger <aldettin...@gmail.com> AuthorDate: Thu Jan 9 11:25:28 2020 +0100 Created a camel-jsonpath extension #426 (#609) --- .../pages/list-of-camel-quarkus-extensions.adoc | 4 +- extensions/jsonpath/deployment/pom.xml | 75 ++++++++++++ .../json/path/deployment/JsonPathProcessor.java | 46 +++++++ extensions/jsonpath/pom.xml | 39 ++++++ extensions/jsonpath/runtime/pom.xml | 87 +++++++++++++ .../Target_DefaultAnnotationExpressionFactory.java | 52 ++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 27 ++++ extensions/pom.xml | 1 + extensions/readme.adoc | 4 +- integration-tests/jsonpath/pom.xml | 136 +++++++++++++++++++++ .../component/json/path/it/JsonPathResource.java | 74 +++++++++++ .../component/json/path/it/JsonPathTestRoute.java | 58 +++++++++ .../component/json/path/it/CarsRequest.java | 45 +++++++ .../component/json/path/it/JsonPathBeanIT.java | 24 ++++ .../component/json/path/it/JsonPathBeanTest.java | 61 +++++++++ .../json/path/it/JsonPathContentBasedRouterIT.java | 24 ++++ .../path/it/JsonPathContentBasedRouterTest.java | 71 +++++++++++ .../component/json/path/it/JsonPathSetBodyIT.java | 24 ++++ .../json/path/it/JsonPathSetBodyTest.java | 51 ++++++++ .../json/path/it/JsonPathTransformIT.java | 24 ++++ .../json/path/it/JsonPathTransformTest.java | 56 +++++++++ .../component/json/path/it/PersonRequest.java | 65 ++++++++++ .../component/json/path/it/StoreRequest.java | 56 +++++++++ integration-tests/pom.xml | 1 + poms/bom-deployment/pom.xml | 5 + poms/bom/pom.xml | 16 ++- 26 files changed, 1121 insertions(+), 5 deletions(-) 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 ce4049d..da68234 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -214,7 +214,7 @@ Number of Camel data formats: 10 in 9 JAR artifacts (0 deprecated) == Camel Languages // languages: START -Number of Camel languages: 8 in 2 JAR artifacts (0 deprecated) +Number of Camel languages: 9 in 3 JAR artifacts (0 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -230,6 +230,8 @@ Number of Camel languages: 8 in 2 JAR artifacts (0 deprecated) | link:https://camel.apache.org/components/latest/header-language.html[Header] (camel-quarkus-core) | 0.2.0 | To use a Camel Message header in expressions or predicates. +| link:https://camel.apache.org/components/latest/jsonpath-language.html[JsonPath] (camel-quarkus-jsonpath) | 1.0.0 | To use JsonPath in Camel expressions or predicates. + | link:https://camel.apache.org/components/latest/ref-language.html[Ref] (camel-quarkus-core) | 0.2.0 | Reference to an existing Camel expression or predicate, which is looked up from the Camel registry. | link:https://camel.apache.org/components/latest/simple-language.html[Simple] (camel-quarkus-core) | 0.2.0 | To use Camels built-in Simple language in Camel expressions or predicates. diff --git a/extensions/jsonpath/deployment/pom.xml b/extensions/jsonpath/deployment/pom.xml new file mode 100644 index 0000000..6912857 --- /dev/null +++ b/extensions/jsonpath/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-jsonpath-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-jsonpath-deployment</artifactId> + <name>Camel Quarkus :: JSON Path :: 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-jsonpath</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/jsonpath/deployment/src/main/java/org/apache/camel/quarkus/component/json/path/deployment/JsonPathProcessor.java b/extensions/jsonpath/deployment/src/main/java/org/apache/camel/quarkus/component/json/path/deployment/JsonPathProcessor.java new file mode 100644 index 0000000..3799b8c --- /dev/null +++ b/extensions/jsonpath/deployment/src/main/java/org/apache/camel/quarkus/component/json/path/deployment/JsonPathProcessor.java @@ -0,0 +1,46 @@ +/* + * 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.json.path.deployment; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.camel.jsonpath.JsonPath; +import org.apache.camel.jsonpath.JsonPathAnnotationExpressionFactory; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; + +class JsonPathProcessor { + + private static final String FEATURE = "camel-jsonpath"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + @BuildStep + List<ReflectiveClassBuildItem> registerReflectiveClassBuildItems() { + List<ReflectiveClassBuildItem> reflectiveClassBuildItems = new ArrayList<>(); + reflectiveClassBuildItems.add(new ReflectiveClassBuildItem(false, false, JsonPathAnnotationExpressionFactory.class)); + reflectiveClassBuildItems.add(new ReflectiveClassBuildItem(true, false, JsonPath.class)); + return reflectiveClassBuildItems; + } + +} diff --git a/extensions/jsonpath/pom.xml b/extensions/jsonpath/pom.xml new file mode 100644 index 0000000..4171ddd --- /dev/null +++ b/extensions/jsonpath/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>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-jsonpath-parent</artifactId> + <name>Camel Quarkus :: JSON Path</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions/jsonpath/runtime/pom.xml b/extensions/jsonpath/runtime/pom.xml new file mode 100644 index 0000000..9a245f2 --- /dev/null +++ b/extensions/jsonpath/runtime/pom.xml @@ -0,0 +1,87 @@ +<?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-jsonpath-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-jsonpath</artifactId> + <name>Camel Quarkus :: JSON Path :: Runtime</name> + <description>Camel JSON Path language</description> + + <properties> + <firstVersion>1.0.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-jsonpath</artifactId> + </dependency> + <dependency> + <groupId>com.oracle.substratevm</groupId> + <artifactId>svm</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/jsonpath/runtime/src/main/java/org/apache/camel/quarkus/component/json/path/Target_DefaultAnnotationExpressionFactory.java b/extensions/jsonpath/runtime/src/main/java/org/apache/camel/quarkus/component/json/path/Target_DefaultAnnotationExpressionFactory.java new file mode 100644 index 0000000..7b277df --- /dev/null +++ b/extensions/jsonpath/runtime/src/main/java/org/apache/camel/quarkus/component/json/path/Target_DefaultAnnotationExpressionFactory.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.json.path; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; + +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; + +import org.apache.camel.support.ObjectHelper; +import org.apache.camel.support.language.DefaultAnnotationExpressionFactory; + +/** + * This alias works around an issue with the JsonPath annotation from camel. In + * camel, DefaultAnnotationExpressionFactory.getAnnotationObjectValue() uses the + * underlying annotation class proxy which is a JVM implementation detail. So, + * this alias makes it possible to get the JsonPath annotation value in native + * mode. + */ +@TargetClass(DefaultAnnotationExpressionFactory.class) +public final class Target_DefaultAnnotationExpressionFactory { + + @Substitute + protected Object getAnnotationObjectValue(Annotation annotation, String methodName) { + try { + // Gets the method reference from the annotation itself, not from + // the underlying proxy + Method method = annotation.annotationType().getDeclaredMethod(methodName); + Object value = ObjectHelper.invokeMethod(method, annotation); + return value; + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException("Cannot determine the Object value of the annotation: " + annotation + + " as it does not have the method: " + methodName + + "() method", e); + } + } +} diff --git a/extensions/jsonpath/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jsonpath/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..c68f299 --- /dev/null +++ b/extensions/jsonpath/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 JSON Path" +description: "Camel JSON Path language" +metadata: + keywords: + - "camel" + - "json" + guide: "https://quarkus.io/guides/camel" + categories: + - "integration" diff --git a/extensions/pom.xml b/extensions/pom.xml index f033fa2..b6a731c 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -72,6 +72,7 @@ <module>infinispan</module> <module>jackson</module> <module>jdbc</module> + <module>jsonpath</module> <module>kafka</module> <module>kotlin</module> <module>log</module> diff --git a/extensions/readme.adoc b/extensions/readme.adoc index af8eb35..e611b8d 100644 --- a/extensions/readme.adoc +++ b/extensions/readme.adoc @@ -215,7 +215,7 @@ Number of Camel data formats: 10 in 9 JAR artifacts (0 deprecated) == Camel Languages // languages: START -Number of Camel languages: 8 in 2 JAR artifacts (0 deprecated) +Number of Camel languages: 9 in 3 JAR artifacts (0 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -231,6 +231,8 @@ Number of Camel languages: 8 in 2 JAR artifacts (0 deprecated) | link:https://camel.apache.org/components/latest/header-language.html[Header] (camel-quarkus-core) | 0.2.0 | To use a Camel Message header in expressions or predicates. +| link:https://camel.apache.org/components/latest/jsonpath-language.html[JsonPath] (camel-quarkus-jsonpath) | 1.0.0 | To use JsonPath in Camel expressions or predicates. + | link:https://camel.apache.org/components/latest/ref-language.html[Ref] (camel-quarkus-core) | 0.2.0 | Reference to an existing Camel expression or predicate, which is looked up from the Camel registry. | link:https://camel.apache.org/components/latest/simple-language.html[Simple] (camel-quarkus-core) | 0.2.0 | To use Camels built-in Simple language in Camel expressions or predicates. diff --git a/integration-tests/jsonpath/pom.xml b/integration-tests/jsonpath/pom.xml new file mode 100644 index 0000000..09e40db --- /dev/null +++ b/integration-tests/jsonpath/pom.xml @@ -0,0 +1,136 @@ +<?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>1.1.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-quarkus-integration-test-jsonpath</artifactId> + <name>Camel Quarkus :: Integration Tests :: JSON Path</name> + <description>Integration tests for Camel Quarkus JSON Path extension</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jsonpath</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-bean</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy-jackson</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>true</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/jsonpath/src/main/java/org/apache/camel/quarkus/component/json/path/it/JsonPathResource.java b/integration-tests/jsonpath/src/main/java/org/apache/camel/quarkus/component/json/path/it/JsonPathResource.java new file mode 100644 index 0000000..15ae702 --- /dev/null +++ b/integration-tests/jsonpath/src/main/java/org/apache/camel/quarkus/component/json/path/it/JsonPathResource.java @@ -0,0 +1,74 @@ +/* + * 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.json.path.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 org.apache.camel.ProducerTemplate; +import org.jboss.logging.Logger; + +@Path("/jsonpath") +@ApplicationScoped +public class JsonPathResource { + + private static final Logger LOG = Logger.getLogger(JsonPathResource.class); + + @Inject + ProducerTemplate producerTemplate; + + @Path("/getBookPriceLevel") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) + public String getBookPriceLevel(String storeRequestJson) { + LOG.infof("Getting book price level from json store request: %s", storeRequestJson); + return producerTemplate.requestBody("direct:getBookPriceLevel", storeRequestJson, String.class); + } + + @Path("/getBookPrice") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) + public String getBookPrice(String storeRequestJson) { + LOG.infof("Getting book price from json store request: %s", storeRequestJson); + return producerTemplate.requestBody("direct:getBookPrice", storeRequestJson, String.class); + } + + @Path("/getFullName") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) + public String getFullName(String personRequestJson) { + LOG.infof("Getting person full name from json person request: %s", personRequestJson); + return producerTemplate.requestBody("direct:getFullName", personRequestJson, String.class); + } + + @Path("/getAllCarColors") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) + public String getAllCarColors(String carsRequestJson) { + LOG.infof("Getting all car colors from json cars request: %s", carsRequestJson); + return producerTemplate.requestBody("direct:getAllCarColors", carsRequestJson, String.class); + } +} diff --git a/integration-tests/jsonpath/src/main/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTestRoute.java b/integration-tests/jsonpath/src/main/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTestRoute.java new file mode 100644 index 0000000..765a736 --- /dev/null +++ b/integration-tests/jsonpath/src/main/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTestRoute.java @@ -0,0 +1,58 @@ +/* + * 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.json.path.it; + +import com.jayway.jsonpath.Option; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.jsonpath.JsonPath; + +import io.quarkus.runtime.annotations.RegisterForReflection; + +public class JsonPathTestRoute extends RouteBuilder { + + @Override + public void configure() { + from("direct:getBookPriceLevel") + .choice() + .when().jsonpath("$.store.book[?(@.price < 10)]") + .setBody(constant("cheap")) + .when().jsonpath("$.store.book[?(@.price < 30)]") + .setBody(constant("average")) + .otherwise() + .setBody(constant("expensive")); + + from("direct:getBookPrice").setBody().jsonpath("$.store.book.price"); + + from("direct:getFullName").bean(FullNameBean.class); + + from("direct:getAllCarColors").transform().jsonpath("$.cars[*].color"); + } + + @RegisterForReflection + protected static class FullNameBean { + // middle name is optional + public static String getName(@JsonPath("person.firstName") String first, + @JsonPath(value = "person.middleName", options = Option.SUPPRESS_EXCEPTIONS) String middle, + @JsonPath("person.lastName") String last) { + if (middle != null) { + return first + " " + middle + " " + last; + } + return first + " " + last; + } + } +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/CarsRequest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/CarsRequest.java new file mode 100644 index 0000000..c742c23 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/CarsRequest.java @@ -0,0 +1,45 @@ +/* + * 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.json.path.it; + +import java.util.List; + +public class CarsRequest { + + private List<Car> cars; + + public List<Car> getCars() { + return cars; + } + + public void setCars(List<Car> cars) { + this.cars = cars; + } + + public static class Car { + private String color; + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + } + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathBeanIT.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathBeanIT.java new file mode 100644 index 0000000..5796ad8 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathBeanIT.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.json.path.it; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class JsonPathBeanIT extends JsonPathBeanTest { + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathBeanTest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathBeanTest.java new file mode 100644 index 0000000..eef90a5 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathBeanTest.java @@ -0,0 +1,61 @@ +/* + * 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.json.path.it; + +import org.apache.camel.quarkus.component.json.path.it.PersonRequest.Person; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +@QuarkusTest +class JsonPathBeanTest { + + private PersonRequest personRequest; + + @BeforeEach + public void setup() { + personRequest = new PersonRequest(); + personRequest.setPerson(new Person()); + personRequest.getPerson().setFirstName("Christophe"); + personRequest.getPerson().setMiddleName("Sylvain"); + personRequest.getPerson().setLastName("Fontane"); + } + + @Test + public void getFullNameShouldSucceed() { + String fullName = RestAssured.given() // + .contentType(ContentType.JSON).body(personRequest).get("/jsonpath/getFullName").then().statusCode(200).extract() + .asString(); + assertEquals("Christophe Sylvain Fontane", fullName); + } + + @Test + public void getFullNameWihtoutMiddleNameShouldSucceed() { + personRequest.getPerson().setMiddleName(null); + + String fullName = RestAssured.given() // + .contentType(ContentType.JSON).body(personRequest).get("/jsonpath/getFullName").then().statusCode(200).extract() + .asString(); + assertEquals("Christophe Fontane", fullName); + } + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathContentBasedRouterIT.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathContentBasedRouterIT.java new file mode 100644 index 0000000..d5fe6af --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathContentBasedRouterIT.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.json.path.it; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class JsonPathContentBasedRouterIT extends JsonPathContentBasedRouterTest { + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathContentBasedRouterTest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathContentBasedRouterTest.java new file mode 100644 index 0000000..5f9d784 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathContentBasedRouterTest.java @@ -0,0 +1,71 @@ +/* + * 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.json.path.it; + +import org.apache.camel.quarkus.component.json.path.it.StoreRequest.Book; +import org.apache.camel.quarkus.component.json.path.it.StoreRequest.Store; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +@QuarkusTest +class JsonPathContentBasedRouterTest { + + private StoreRequest storeRequest; + + @BeforeEach + public void setup() { + storeRequest = new StoreRequest(); + storeRequest.setStore(new Store()); + storeRequest.getStore().setBook(new Book()); + storeRequest.getStore().getBook().setPrice(5.0); + } + + @Test + public void priceLessThan10ShouldReturnCheapLevel() { + String priceLevel = RestAssured.given() // + .contentType(ContentType.JSON).body(storeRequest).get("/jsonpath/getBookPriceLevel").then().statusCode(200) + .extract().asString(); + assertEquals("cheap", priceLevel); + } + + @Test + public void priceBetween10And30ShouldReturnAverageLevel() { + storeRequest.getStore().getBook().setPrice(17.5); + + String priceLevel = RestAssured.given() // + .contentType(ContentType.JSON).body(storeRequest).get("/jsonpath/getBookPriceLevel").then().statusCode(200) + .extract().asString(); + assertEquals("average", priceLevel); + } + + @Test + public void priceGreaterThan30ShouldReturnExpensiveLevel() { + storeRequest.getStore().getBook().setPrice(31.7); + + String priceLevel = RestAssured.given() // + .contentType(ContentType.JSON).body(storeRequest).get("/jsonpath/getBookPriceLevel").then().statusCode(200) + .extract().asString(); + assertEquals("expensive", priceLevel); + } + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathSetBodyIT.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathSetBodyIT.java new file mode 100644 index 0000000..8ea1eb2 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathSetBodyIT.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.json.path.it; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class JsonPathSetBodyIT extends JsonPathSetBodyTest { + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathSetBodyTest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathSetBodyTest.java new file mode 100644 index 0000000..1e8d2e1 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathSetBodyTest.java @@ -0,0 +1,51 @@ +/* + * 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.json.path.it; + +import org.apache.camel.quarkus.component.json.path.it.StoreRequest.Book; +import org.apache.camel.quarkus.component.json.path.it.StoreRequest.Store; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +@QuarkusTest +class JsonPathSetBodyTest { + + private StoreRequest storeRequest; + + @BeforeEach + public void setup() { + storeRequest = new StoreRequest(); + storeRequest.setStore(new Store()); + storeRequest.getStore().setBook(new Book()); + storeRequest.getStore().getBook().setPrice(6.0); + } + + @Test + public void getBookPrice() { + String bookPrice = RestAssured.given() // + .contentType(ContentType.JSON).body(storeRequest).get("/jsonpath/getBookPrice").then().statusCode(200).extract() + .asString(); + assertEquals("6.0", bookPrice); + } + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTransformIT.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTransformIT.java new file mode 100644 index 0000000..41cba15 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTransformIT.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.json.path.it; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class JsonPathTransformIT extends JsonPathTransformTest { + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTransformTest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTransformTest.java new file mode 100644 index 0000000..9ee0c40 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/JsonPathTransformTest.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.json.path.it; + +import java.util.Arrays; +import java.util.List; + +import org.apache.camel.quarkus.component.json.path.it.CarsRequest.Car; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertIterableEquals; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; + +@QuarkusTest +class JsonPathTransformTest { + + private CarsRequest carsRequest; + + @BeforeEach + public void setup() { + carsRequest = new CarsRequest(); + Car redCar = new Car(); + redCar.setColor("red"); + Car greenCar = new Car(); + greenCar.setColor("green"); + carsRequest.setCars(Arrays.asList(redCar, greenCar)); + } + + @Test + public void getAllCarColorsShouldSucceed() { + List<String> colors = RestAssured.given() // + .contentType(ContentType.JSON).body(carsRequest).get("/jsonpath/getAllCarColors").then().statusCode(200) + .extract().body().jsonPath().getList(".", String.class); + + assertIterableEquals(Arrays.asList("red", "green"), colors); + } + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/PersonRequest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/PersonRequest.java new file mode 100644 index 0000000..509e1bf --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/PersonRequest.java @@ -0,0 +1,65 @@ +/* + * 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.json.path.it; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +public class PersonRequest { + + private Person person; + + public Person getPerson() { + return person; + } + + public void setPerson(Person person) { + this.person = person; + } + + @JsonInclude(Include.NON_NULL) + public static class Person { + + private String firstName, lastName, middleName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getMiddleName() { + return middleName; + } + + public void setMiddleName(String middleName) { + this.middleName = middleName; + } + + } + +} diff --git a/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/StoreRequest.java b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/StoreRequest.java new file mode 100644 index 0000000..8300536 --- /dev/null +++ b/integration-tests/jsonpath/src/test/java/org/apache/camel/quarkus/component/json/path/it/StoreRequest.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.json.path.it; + +public class StoreRequest { + + private Store store; + + public Store getStore() { + return store; + } + + public void setStore(Store store) { + this.store = store; + } + + public static class Store { + private Book book; + + public Book getBook() { + return book; + } + + public void setBook(Book book) { + this.book = book; + } + } + + public static class Book { + + private double price; + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + } + +} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index f3a2d51..125095f 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -174,6 +174,7 @@ <module>infinispan</module> <module>jackson</module> <module>jdbc</module> + <module>jsonpath</module> <module>kafka</module> <module>mail</module> <module>microprofile</module> diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index 0e52d4a..24e2d8c 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -226,6 +226,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jsonpath-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kafka-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index 69895f5..cf02610 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -269,6 +269,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-jsonpath</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-kafka</artifactId> <version>${camel.version}</version> </dependency> @@ -644,6 +649,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jsonpath</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kafka</artifactId> <version>${camel-quarkus.version}</version> </dependency> @@ -860,9 +870,9 @@ <version>${xstream.version}</version> </dependency> <dependency> - <groupId>org.asynchttpclient</groupId> - <artifactId>async-http-client</artifactId> - <version>${ahc.version}</version> + <groupId>org.asynchttpclient</groupId> + <artifactId>async-http-client</artifactId> + <version>${ahc.version}</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId>