You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/02/11 15:17:21 UTC
[camel-quarkus] branch master updated: Add olingo4 extension
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton 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 68f9774 Add olingo4 extension
68f9774 is described below
commit 68f9774e5a0d047f2c077a8be102dbe4a747972f
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Feb 11 09:19:43 2020 +0000
Add olingo4 extension
fixes #692
---
.../pages/list-of-camel-quarkus-extensions.adoc | 5 +-
extensions/olingo4/deployment/pom.xml | 91 ++++++++++++++
.../olingo4/deployment/Olingo4Processor.java | 72 +++++++++++
extensions/olingo4/pom.xml | 39 ++++++
extensions/olingo4/runtime/pom.xml | 102 ++++++++++++++++
.../olingo4/graal/ODataImplSubstitutions.java | 33 ++++++
.../main/resources/META-INF/quarkus-extension.yaml | 28 +++++
extensions/pom.xml | 1 +
extensions/readme.adoc | 5 +-
.../httpclient/deployment/HttpClientProcessor.java | 7 ++
integration-tests/olingo4/pom.xml | 132 +++++++++++++++++++++
.../component/olingo4/it/Olingo4Resource.java | 120 +++++++++++++++++++
.../camel/quarkus/component/olingo4/it/Person.java | 68 +++++++++++
.../quarkus/component/olingo4/it/Olingo4IT.java | 24 ++++
.../quarkus/component/olingo4/it/Olingo4Test.java | 120 +++++++++++++++++++
integration-tests/pom.xml | 1 +
pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 21 ++++
19 files changed, 873 insertions(+), 2 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 cced184..b97e9be 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list:
== Camel Components
// components: START
-Number of Camel components: 62 in 53 JAR artifacts (0 deprecated)
+Number of Camel components: 63 in 54 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -135,6 +135,9 @@ Number of Camel components: 62 in 53 JAR artifacts (0 deprecated)
| xref:extensions/netty-http.adoc[Netty HTTP] (camel-quarkus-netty-http) +
`netty-http:protocol:host:port/path` | 0.2.0 | Netty HTTP server and client using the Netty 4.x library.
+| link:https://camel.apache.org/components/latest/olingo4-component.html[Olingo4] (camel-quarkus-olingo4) +
+`olingo4:apiName/methodName` | 1.2.0 | Communicates with OData 4.0 services using Apache Olingo OData API.
+
| link:https://camel.apache.org/components/latest/paho-component.html[Paho] (camel-quarkus-paho) +
`paho:topic` | 0.2.0 | Component for communicating with MQTT message brokers using Eclipse Paho MQTT Client.
diff --git a/extensions/olingo4/deployment/pom.xml b/extensions/olingo4/deployment/pom.xml
new file mode 100644
index 0000000..4271d30
--- /dev/null
+++ b/extensions/olingo4/deployment/pom.xml
@@ -0,0 +1,91 @@
+<?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-olingo4-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-olingo4-deployment</artifactId>
+ <name>Camel Quarkus :: Olingo4 :: 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-support-commons-logging-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-httpclient-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-xml-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jackson-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-olingo4</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/olingo4/deployment/src/main/java/org/apache/camel/quarkus/component/olingo4/deployment/Olingo4Processor.java b/extensions/olingo4/deployment/src/main/java/org/apache/camel/quarkus/component/olingo4/deployment/Olingo4Processor.java
new file mode 100644
index 0000000..967394f
--- /dev/null
+++ b/extensions/olingo4/deployment/src/main/java/org/apache/camel/quarkus/component/olingo4/deployment/Olingo4Processor.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.olingo4.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import org.apache.camel.component.olingo4.Olingo4AppEndpointConfiguration;
+import org.apache.camel.quarkus.core.deployment.UnbannedReflectiveBuildItem;
+import org.apache.olingo.server.core.ODataImpl;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+
+class Olingo4Processor {
+
+ private static final String FEATURE = "camel-olingo4";
+ private static final DotName JSON_DESERIALIZE_DOT_NAME = DotName
+ .createSimple("com.fasterxml.jackson.databind.annotation.JsonDeserialize");
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ UnbannedReflectiveBuildItem whitelistOlingo4AppEndpointConfiguration() {
+ // TODO: Remove this and the associated ReflectiveClassBuildItem for this class in Camel 3.1
+ return new UnbannedReflectiveBuildItem(Olingo4AppEndpointConfiguration.class.getName());
+ }
+
+ @BuildStep
+ AdditionalApplicationArchiveMarkerBuildItem olingoArchiveMarker() {
+ return new AdditionalApplicationArchiveMarkerBuildItem("org/apache/olingo");
+ }
+
+ @BuildStep
+ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndex) {
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, ODataImpl.class));
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, Olingo4AppEndpointConfiguration.class));
+
+ /*
+ * Register Olingo Deserializer classes for reflection. We do this because the Quarkus Jackson extension only
+ * configures reflection where the 'using' annotation value is applied to fields & methods.
+ *
+ * TODO: Remove this when the Quarkus Jackson extension has this enhancement - https://github.com/quarkusio/quarkus/issues/7139
+ */
+ IndexView index = combinedIndex.getIndex();
+ index.getAnnotations(JSON_DESERIALIZE_DOT_NAME)
+ .stream()
+ .map(annotation -> annotation.value("using").asClass().name().toString())
+ .filter(className -> className.startsWith("org.apache.olingo"))
+ .map(className -> new ReflectiveClassBuildItem(true, false, false, className))
+ .forEach(reflectiveClass::produce);
+ }
+}
diff --git a/extensions/olingo4/pom.xml b/extensions/olingo4/pom.xml
new file mode 100644
index 0000000..f459038
--- /dev/null
+++ b/extensions/olingo4/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-olingo4-parent</artifactId>
+ <name>Camel Quarkus :: Olingo4</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/olingo4/runtime/pom.xml b/extensions/olingo4/runtime/pom.xml
new file mode 100644
index 0000000..f4d233b
--- /dev/null
+++ b/extensions/olingo4/runtime/pom.xml
@@ -0,0 +1,102 @@
+<?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-olingo4-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-olingo4</artifactId>
+ <name>Camel Quarkus :: Olingo4 :: Runtime</name>
+
+ <properties>
+ <firstVersion>1.2.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.quarkus</groupId>
+ <artifactId>camel-quarkus-support-commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-support-xml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-olingo4</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.graalvm.nativeimage</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/olingo4/runtime/src/main/java/org/apache/camel/quarkus/component/olingo4/graal/ODataImplSubstitutions.java b/extensions/olingo4/runtime/src/main/java/org/apache/camel/quarkus/component/olingo4/graal/ODataImplSubstitutions.java
new file mode 100644
index 0000000..6e967ec
--- /dev/null
+++ b/extensions/olingo4/runtime/src/main/java/org/apache/camel/quarkus/component/olingo4/graal/ODataImplSubstitutions.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.olingo4.graal;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.core.ODataImpl;
+
+@TargetClass(ODataImpl.class)
+final class ODataImplSubstitutions {
+
+ @Substitute
+ public ODataHttpHandler createHandler(final ServiceMetadata serviceMetadata) {
+ // Avoid the optional and redundant servlet-api dependency
+ throw new UnsupportedOperationException("OData HTTP handlers are not supported in native mode");
+ }
+}
diff --git a/extensions/olingo4/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/olingo4/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..21e2e6e
--- /dev/null
+++ b/extensions/olingo4/runtime/src/main/resources/META-INF/quarkus-extension.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.
+#
+
+---
+name: "Camel Quarkus Olingo4"
+description: "Camel Quarkus Olingo4 Support"
+metadata:
+ keywords:
+ - "camel"
+ - "olingo"
+ - "odata"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
\ No newline at end of file
diff --git a/extensions/pom.xml b/extensions/pom.xml
index ddbddf9..373a23d 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -87,6 +87,7 @@
<module>mongodb</module>
<module>netty</module>
<module>netty-http</module>
+ <module>olingo4</module>
<module>opentracing</module>
<module>paho</module>
<module>pdf</module>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 1f46ba6..fffd02d 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension
== Camel Components
// components: START
-Number of Camel components: 62 in 53 JAR artifacts (0 deprecated)
+Number of Camel components: 63 in 54 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -122,6 +122,9 @@ Number of Camel components: 62 in 53 JAR artifacts (0 deprecated)
| xref:extensions/netty-http.adoc[Netty HTTP] (camel-quarkus-netty-http) +
`netty-http:protocol:host:port/path` | 0.2.0 | Netty HTTP server and client using the Netty 4.x library.
+| link:https://camel.apache.org/components/latest/olingo4-component.html[Olingo4] (camel-quarkus-olingo4) +
+`olingo4:apiName/methodName` | 1.2.0 | Communicates with OData 4.0 services using Apache Olingo OData API.
+
| link:https://camel.apache.org/components/latest/paho-component.html[Paho] (camel-quarkus-paho) +
`paho:topic` | 0.2.0 | Component for communicating with MQTT message brokers using Eclipse Paho MQTT Client.
diff --git a/extensions/support/httpclient/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient/deployment/HttpClientProcessor.java b/extensions/support/httpclient/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient/deployment/HttpClientProcessor.java
index 6e043af..f9cdda9 100644
--- a/extensions/support/httpclient/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient/deployment/HttpClientProcessor.java
+++ b/extensions/support/httpclient/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient/deployment/HttpClientProcessor.java
@@ -20,6 +20,7 @@ import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
@@ -45,4 +46,10 @@ class HttpClientProcessor {
reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, info.name().toString()));
}
}
+
+ @BuildStep
+ NativeImageResourceBuildItem suffixListResource() {
+ // Required by org.apache.http.conn.util.PublicSuffixMatcher
+ return new NativeImageResourceBuildItem("mozilla/public-suffix-list.txt");
+ }
}
diff --git a/integration-tests/olingo4/pom.xml b/integration-tests/olingo4/pom.xml
new file mode 100644
index 0000000..294b65e
--- /dev/null
+++ b/integration-tests/olingo4/pom.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-olingo4</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Olingo4</name>
+ <description>Integration tests for Camel Quarkus Olingo4 extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-olingo4</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jsonb</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <systemProperties>
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>native-image</id>
+ <goals>
+ <goal>native-image</goal>
+ </goals>
+ <configuration>
+ <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+ <cleanupServer>true</cleanupServer>
+ <enableHttpsUrlHandler>true</enableHttpsUrlHandler>
+ <enableServer>false</enableServer>
+ <dumpProxies>false</dumpProxies>
+ <graalvmHome>${graalvmHome}</graalvmHome>
+ <enableJni>true</enableJni>
+ <enableAllSecurityServices>true</enableAllSecurityServices>
+ <disableReports>true</disableReports>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/olingo4/src/main/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4Resource.java b/integration-tests/olingo4/src/main/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4Resource.java
new file mode 100644
index 0000000..de069a2
--- /dev/null
+++ b/integration-tests/olingo4/src/main/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4Resource.java
@@ -0,0 +1,120 @@
+/*
+ * 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.olingo4.it;
+
+import java.net.URI;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.json.Json;
+import javax.json.JsonObjectBuilder;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PATCH;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+
+@Path("/olingo4")
+@ApplicationScoped
+public class Olingo4Resource {
+
+ public static final String TEST_SERVICE_BASE_URL = "https://services.odata.org/TripPinRESTierService";
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/create")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response create(@QueryParam("sessionId") String sessionId, String json) throws Exception {
+ ClientEntity entity = producerTemplate.requestBody(
+ "olingo4://create/People?contentType=application/json;charset=utf-8&serviceUri=" + getServiceURL(sessionId),
+ json, ClientEntity.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(entity)
+ .build();
+ }
+
+ @Path("/read")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response read(@QueryParam("sessionId") String sessionId) {
+ Response.ResponseBuilder responseBuilder = Response.status(200);
+ try {
+ ClientEntity entity = producerTemplate.requestBody(
+ "olingo4://read/People('lewisblack')?serviceUri=" + getServiceURL(sessionId), null, ClientEntity.class);
+
+ JsonObjectBuilder objectBuilder = Json.createObjectBuilder();
+ String[] fields = new String[] { "FirstName", "LastName", "UserName", "MiddleName" };
+ for (String field : fields) {
+ ClientProperty property = entity.getProperty(field);
+ if (property != null) {
+ objectBuilder.add(field, property.getPrimitiveValue().toString());
+ }
+ }
+ responseBuilder.entity(objectBuilder.build());
+ } catch (CamelExecutionException cee) {
+ Exception exception = cee.getExchange().getException();
+ if (exception instanceof ODataClientErrorException) {
+ ODataClientErrorException ex = (ODataClientErrorException) exception;
+ responseBuilder.status(ex.getStatusLine().getStatusCode());
+ } else {
+ throw cee;
+ }
+ }
+ return responseBuilder.build();
+ }
+
+ @Path("/update")
+ @PATCH
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response update(@QueryParam("sessionId") String sessionId, String json) {
+ HttpStatusCode status = producerTemplate.requestBody(
+ "olingo4://update/People('lewisblack')?serviceUri=" + getServiceURL(sessionId), json, HttpStatusCode.class);
+ return Response
+ .status(status.getStatusCode())
+ .build();
+ }
+
+ @Path("/delete")
+ @DELETE
+ public Response delete(@QueryParam("sessionId") String sessionId) {
+ HttpStatusCode status = producerTemplate.requestBody(
+ "olingo4://delete/People('lewisblack')?serviceUri=" + getServiceURL(sessionId), null, HttpStatusCode.class);
+ return Response
+ .status(status.getStatusCode())
+ .build();
+ }
+
+ private String getServiceURL(String sessionId) {
+ return String.format("%s/%s/", TEST_SERVICE_BASE_URL, sessionId);
+ }
+}
diff --git a/integration-tests/olingo4/src/main/java/org/apache/camel/quarkus/component/olingo4/it/Person.java b/integration-tests/olingo4/src/main/java/org/apache/camel/quarkus/component/olingo4/it/Person.java
new file mode 100644
index 0000000..d02e0a2
--- /dev/null
+++ b/integration-tests/olingo4/src/main/java/org/apache/camel/quarkus/component/olingo4/it/Person.java
@@ -0,0 +1,68 @@
+/*
+ * 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.olingo4.it;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Person {
+
+ @JsonProperty("UserName")
+ private String userName;
+
+ @JsonProperty("FirstName")
+ private String firstName;
+
+ @JsonProperty("LastName")
+ private String lastName;
+
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonProperty("MiddleName")
+ private String middleName;
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ 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/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java b/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.java
new file mode 100644
index 0000000..482f054
--- /dev/null
+++ b/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4IT.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.olingo4.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class Olingo4IT extends Olingo4Test {
+
+}
diff --git a/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4Test.java b/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4Test.java
new file mode 100644
index 0000000..845db3c
--- /dev/null
+++ b/integration-tests/olingo4/src/test/java/org/apache/camel/quarkus/component/olingo4/it/Olingo4Test.java
@@ -0,0 +1,120 @@
+/*
+ * 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.olingo4.it;
+
+import java.io.IOException;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.quarkus.component.olingo4.it.Olingo4Resource.TEST_SERVICE_BASE_URL;
+import static org.hamcrest.core.Is.is;
+
+@QuarkusTest
+class Olingo4Test {
+
+ private static String sessionId;
+
+ @BeforeAll
+ public static void beforeAll() throws IOException {
+ // Use the same session id for each request to the demo Olingo4 Service
+ sessionId = getSession();
+ }
+
+ @Test
+ public void testOlingo4CrudOperations() {
+
+ // Create
+ Person person = new Person();
+ person.setUserName("lewisblack");
+ person.setFirstName("Lewis");
+ person.setLastName("Black");
+
+ RestAssured.given()
+ .queryParam("sessionId", sessionId)
+ .contentType(ContentType.JSON)
+ .body(person)
+ .post("/olingo4/create")
+ .then()
+ .statusCode(201);
+
+ // Read
+ RestAssured.given()
+ .queryParam("sessionId", sessionId)
+ .body("msg")
+ .get("/olingo4/read")
+ .then()
+ .contentType(ContentType.JSON)
+ .statusCode(200)
+ .body("FirstName", is(person.getFirstName()), "LastName", is(person.getLastName()), "UserName",
+ is(person.getUserName()), "MiddleName", is(""));
+
+ // Update
+ person.setMiddleName("James");
+
+ RestAssured.given()
+ .queryParam("sessionId", sessionId)
+ .contentType(ContentType.JSON)
+ .body(person)
+ .patch("/olingo4/update")
+ .then()
+ .statusCode(204);
+
+ RestAssured.given()
+ .queryParam("sessionId", sessionId)
+ .body("msg")
+ .get("/olingo4/read")
+ .then()
+ .contentType(ContentType.JSON)
+ .statusCode(200)
+ .body("FirstName", is(person.getFirstName()), "LastName", is(person.getLastName()), "UserName",
+ is(person.getUserName()), "MiddleName", is(person.getMiddleName()));
+
+ // Delete
+ RestAssured.given()
+ .queryParam("sessionId", sessionId)
+ .delete("/olingo4/delete")
+ .then()
+ .statusCode(204);
+
+ RestAssured.given()
+ .queryParam("sessionId", sessionId)
+ .body("msg")
+ .get("/olingo4/read")
+ .then()
+ .statusCode(404);
+ }
+
+ private static String getSession() throws IOException {
+ CloseableHttpClient httpClient = HttpClients.createDefault();
+ HttpGet httpGet = new HttpGet(TEST_SERVICE_BASE_URL);
+ HttpContext httpContext = new BasicHttpContext();
+ httpClient.execute(httpGet, httpContext);
+ HttpUriRequest currentReq = (HttpUriRequest) httpContext.getAttribute(HttpCoreContext.HTTP_REQUEST);
+ return currentReq.getURI().getPath().split("/")[2];
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 8809741..57b4e8c 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -194,6 +194,7 @@
<module>microprofile</module>
<module>mongodb</module>
<module>netty</module>
+ <module>olingo4</module>
<module>opentracing</module>
<module>paho</module>
<module>pdf</module>
diff --git a/pom.xml b/pom.xml
index a865bb0..191a8b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,6 +54,7 @@
<spring.version>5.2.1.RELEASE</spring.version>
<retrofit.version>2.5.0</retrofit.version>
<consul-client.version>1.3.3</consul-client.version>
+ <stax2.version>4.2</stax2.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven.compiler.target>1.8</maven.compiler.target>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 264ab58..364be6a 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -301,6 +301,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-olingo4-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-opentracing-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 61ad17d..4c50f6b 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -378,6 +378,17 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-olingo4</artifactId>
+ <version>${camel.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-opentracing</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -766,6 +777,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-olingo4</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-opentracing</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
@@ -987,6 +1003,11 @@
<version>${ahc.version}</version>
</dependency>
<dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>stax2-api</artifactId>
+ <version>${stax2.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${jetty.version}</version>