You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/03/14 11:15:27 UTC
[camel-quarkus] branch master updated: camel-quarkus-core: make
caffeine cache optional #886
This is an automated email from the ASF dual-hosted git repository.
acosentino 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 41097d1 camel-quarkus-core: make caffeine cache optional #886
new 131e910 Merge pull request #887 from lburgazzoli/github-886
41097d1 is described below
commit 41097d1f36a3e4ebd9bce6d0e1c0f3f77fd4aa34
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Mar 13 19:51:18 2020 +0100
camel-quarkus-core: make caffeine cache optional #886
---
.github/workflows/pr-build.yaml | 1 +
.../pages/list-of-camel-quarkus-extensions.adoc | 4 +-
.../{core => caffeine-lrucache}/deployment/pom.xml | 61 ++---------
.../deployment/CaffeineLRUCacheProcessor.java | 46 ++++++++
extensions-core/{ => caffeine-lrucache}/pom.xml | 34 +++---
.../{core => caffeine-lrucache}/runtime/pom.xml | 83 +++++---------
.../main/resources/META-INF/quarkus-extension.yaml | 26 +++++
extensions-core/core/deployment/pom.xml | 4 -
extensions-core/core/runtime/pom.xml | 15 ++-
extensions-core/pom.xml | 1 +
extensions/readme.adoc | 4 +-
.../core-main-caffeine-lrucache/pom.xml | 119 +++++++++++++++++++++
.../core/CoreMainCaffeineLRUCacheResource.java | 36 +++++++
.../src/main/resources/application.properties | 26 +++++
.../core/CoreMainCaffeineLRUCacheResourceIT.java | 23 ++++
.../core/CoreMainCaffeineLRUCacheResourceTest.java | 39 +++++++
.../camel/quarkus/core/CoreMainResource.java | 2 +
.../apache/camel/quarkus/core/CoreMainTest.java | 2 +
.../apache/camel/quarkus/core/CoreResource.java | 8 ++
.../org/apache/camel/quarkus/core/CoreTest.java | 6 ++
integration-tests/pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 5 +
23 files changed, 416 insertions(+), 135 deletions(-)
diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml
index d556475..b47bf8d 100644
--- a/.github/workflows/pr-build.yaml
+++ b/.github/workflows/pr-build.yaml
@@ -103,6 +103,7 @@ jobs:
core
core-impl
core-main
+ core-main-caffeine-lrucache
core-main-collector
core-main-xml-io
core-main-xml-jaxb
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 c34986f..3d72ef4 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -348,7 +348,7 @@ Number of Camel languages: 11 in 5 JAR artifacts (0 deprecated)
== Miscellaneous Extensions
// others: START
-Number of miscellaneous extensions: 10 in 10 JAR artifacts (0 deprecated)
+Number of miscellaneous extensions: 11 in 11 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -356,6 +356,8 @@ Number of miscellaneous extensions: 10 in 10 JAR artifacts (0 deprecated)
| (camel-quarkus-attachments) | 0.3.0 | Java Attachments support for Camel Message
+| (camel-quarkus-caffeine-lrucache) | 1.0.0-M5 | Provides an implementation of the LRUCacheFactory based on Caffeine
+
| (camel-quarkus-core-cloud) | 0.2.0 | The Camel Quarkus core cloud module
| (camel-quarkus-endpointdsl) | 1.0.0-M3 | camel-quarkus-endpointdsl
diff --git a/extensions-core/core/deployment/pom.xml b/extensions-core/caffeine-lrucache/deployment/pom.xml
similarity index 51%
copy from extensions-core/core/deployment/pom.xml
copy to extensions-core/caffeine-lrucache/deployment/pom.xml
index ced1821..9d2cd57 100644
--- a/extensions-core/core/deployment/pom.xml
+++ b/extensions-core/caffeine-lrucache/deployment/pom.xml
@@ -17,80 +17,40 @@
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">
+<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-core-parent</artifactId>
+ <artifactId>camel-quarkus-caffeine-lrucache-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>camel-quarkus-core-deployment</artifactId>
- <name>Camel Quarkus :: Core :: 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>
+ <artifactId>camel-quarkus-caffeine-lrucache-deployment</artifactId>
+ <name>Caffeine LRUCache - Deployment</name>
<dependencies>
- <!-- quarkus -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-arc-deployment</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
<artifactId>quarkus-caffeine-deployment</artifactId>
</dependency>
- <!-- camel -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-support-common-deployment</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-core</artifactId>
- </dependency>
-
- <!-- test dependencies -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-direct</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-junit5-internal</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
+ <artifactId>camel-quarkus-caffeine-lrucache</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
@@ -104,4 +64,5 @@
</plugin>
</plugins>
</build>
+
</project>
diff --git a/extensions-core/caffeine-lrucache/deployment/src/main/java/org/apache/camel/quarkus/caffeine/lrucache/deployment/CaffeineLRUCacheProcessor.java b/extensions-core/caffeine-lrucache/deployment/src/main/java/org/apache/camel/quarkus/caffeine/lrucache/deployment/CaffeineLRUCacheProcessor.java
new file mode 100644
index 0000000..ce72bf9
--- /dev/null
+++ b/extensions-core/caffeine-lrucache/deployment/src/main/java/org/apache/camel/quarkus/caffeine/lrucache/deployment/CaffeineLRUCacheProcessor.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.caffeine.lrucache.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+
+class CaffeineLRUCacheProcessor {
+ private static final String FEATURE = "caffeine-lrucache";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ NativeImageResourceBuildItem lruCacheFactory() {
+ // The process of discovering the LRUCacheFactory does not use any Camel' built in mechanic
+ // but it based on loading a resource from the classpath, like:
+ //
+ // ClassLoader classLoader = LRUCacheFactory.class.getClassLoader();
+ // URL url = classLoader.getResource("META-INF/services/org/apache/camel/lru-cache-factory");
+ //
+ // Full code here:
+ // https://github.com/apache/camel/blob/8bf781197c7138be5f8293e149a4a46a612cc40c/core/camel-support/src/main/java/org/apache/camel/support/LRUCacheFactory.java#L73-L100
+ //
+ // For such reason we need to include the lru-cache-factory file in the native image
+ return new NativeImageResourceBuildItem("META-INF/services/org/apache/camel/lru-cache-factory");
+ }
+
+}
diff --git a/extensions-core/pom.xml b/extensions-core/caffeine-lrucache/pom.xml
similarity index 54%
copy from extensions-core/pom.xml
copy to extensions-core/caffeine-lrucache/pom.xml
index c16a012..c332501 100644
--- a/extensions-core/pom.xml
+++ b/extensions-core/caffeine-lrucache/pom.xml
@@ -17,28 +17,36 @@
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">
-
+<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-parent</artifactId>
+ <artifactId>camel-quarkus-build-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>
- <artifactId>camel-quarkus-extensions-core</artifactId>
<packaging>pom</packaging>
- <name>Camel Quarkus :: Extensions :: Core</name>
+ <artifactId>camel-quarkus-caffeine-lrucache-parent</artifactId>
+ <name>Caffeine LRUCache - Parent</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bom-deployment</artifactId>
+ <version>${quarkus.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<modules>
- <module>core</module>
- <module>core-cloud</module>
- <module>http-common</module>
- <module>reactive-executor</module>
- <module>xml-io</module>
- <module>xml-jaxb</module>
- <module>xml-jaxp</module>
+ <module>deployment</module>
+ <module>runtime</module>
</modules>
-
</project>
diff --git a/extensions-core/core/runtime/pom.xml b/extensions-core/caffeine-lrucache/runtime/pom.xml
similarity index 50%
copy from extensions-core/core/runtime/pom.xml
copy to extensions-core/caffeine-lrucache/runtime/pom.xml
index c91b25f..e9ff8a4 100644
--- a/extensions-core/core/runtime/pom.xml
+++ b/extensions-core/caffeine-lrucache/runtime/pom.xml
@@ -17,36 +17,27 @@
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">
+<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-core-parent</artifactId>
+ <artifactId>camel-quarkus-caffeine-lrucache-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>camel-quarkus-core</artifactId>
- <name>Camel Quarkus :: Core :: Runtime</name>
- <description>The Camel Quarkus core module</description>
+ <artifactId>camel-quarkus-caffeine-lrucache</artifactId>
+ <name>Caffeine LRUCache - Runtime</name>
+ <description>Provides an implementation of the LRUCacheFactory based on Caffeine</description>
<properties>
- <title>Camel Quarkus Core</title>
- <firstVersion>0.2.0</firstVersion>
+ <title>Camel Quarkus Caffeine LRUCache</title>
+ <firstVersion>1.0.0-M5</firstVersion>
<label>core</label>
</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>io.quarkus</groupId>
@@ -54,51 +45,13 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
- <artifactId>quarkus-arc</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
<artifactId>quarkus-caffeine</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-support-common</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-development-mode-spi</artifactId>
- </dependency>
- <!-- camel -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-base</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-catalog</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-caffeine-lrucache</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-microprofile-config</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.graalvm.nativeimage</groupId>
- <artifactId>svm</artifactId>
- </dependency>
</dependencies>
<build>
@@ -106,8 +59,22 @@
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+ <version>${quarkus.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>extension-descriptor</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}
+ </deployment>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
diff --git a/extensions-core/caffeine-lrucache/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-core/caffeine-lrucache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..b1e869e
--- /dev/null
+++ b/extensions-core/caffeine-lrucache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,26 @@
+#
+# 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 Caffeine LRUCache"
+description: "Provides an implementation of the LRUCacheFactory based on Caffeine"
+metadata:
+ keywords:
+ - "camel"
+ guide: "https://quarkus.io/guides/camel"
+ categories:
+ - "integration"
diff --git a/extensions-core/core/deployment/pom.xml b/extensions-core/core/deployment/pom.xml
index ced1821..da52ac7 100644
--- a/extensions-core/core/deployment/pom.xml
+++ b/extensions-core/core/deployment/pom.xml
@@ -49,10 +49,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-caffeine-deployment</artifactId>
- </dependency>
<!-- camel -->
<dependency>
diff --git a/extensions-core/core/runtime/pom.xml b/extensions-core/core/runtime/pom.xml
index c91b25f..57b7f16 100644
--- a/extensions-core/core/runtime/pom.xml
+++ b/extensions-core/core/runtime/pom.xml
@@ -57,10 +57,6 @@
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-caffeine</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-common</artifactId>
</dependency>
@@ -73,6 +69,13 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
+ <exclusions>
+ <!-- TODO: remove once the fix for https://issues.apache.org/jira/browse/CAMEL-14713 is available-->
+ <exclusion>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-caffeine-lrucache</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -88,10 +91,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-caffeine-lrucache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-microprofile-config</artifactId>
</dependency>
diff --git a/extensions-core/pom.xml b/extensions-core/pom.xml
index c16a012..27e7aa7 100644
--- a/extensions-core/pom.xml
+++ b/extensions-core/pom.xml
@@ -39,6 +39,7 @@
<module>xml-io</module>
<module>xml-jaxb</module>
<module>xml-jaxp</module>
+ <module>caffeine-lrucache</module>
</modules>
</project>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index e4bedfd..366333a 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -338,7 +338,7 @@ Number of Camel languages: 11 in 5 JAR artifacts (0 deprecated)
== Miscellaneous Extensions
// others: START
-Number of miscellaneous extensions: 10 in 10 JAR artifacts (0 deprecated)
+Number of miscellaneous extensions: 11 in 11 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -346,6 +346,8 @@ Number of miscellaneous extensions: 10 in 10 JAR artifacts (0 deprecated)
| (camel-quarkus-attachments) | 0.3.0 | Java Attachments support for Camel Message
+| (camel-quarkus-caffeine-lrucache) | 1.0.0-M5 | Provides an implementation of the LRUCacheFactory based on Caffeine
+
| (camel-quarkus-core-cloud) | 0.2.0 | The Camel Quarkus core cloud module
| (camel-quarkus-endpointdsl) | 1.0.0-M3 | camel-quarkus-endpointdsl
diff --git a/integration-tests/core-main-caffeine-lrucache/pom.xml b/integration-tests/core-main-caffeine-lrucache/pom.xml
new file mode 100644
index 0000000..7152ae1
--- /dev/null
+++ b/integration-tests/core-main-caffeine-lrucache/pom.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-integration-test-core-main-caffein-lrucache</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Core Main Caffeine LRUCache :: Tests</name>
+ <description>The camel integration tests</description>
+
+ <properties>
+ <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
+ <!-- The following rule tells mvnd to build the listed deployment modules before this module. -->
+ <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not -->
+ <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
+ <!-- Please update rule whenever you change the dependencies of this module by running -->
+ <!-- mvn process-resources -Pformat from the root directory -->
+ <mvnd.builder.rule>camel-quarkus-caffeine-lrucache-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-caffeine-lrucache</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</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>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
+</project>
diff --git a/integration-tests/core-main-caffeine-lrucache/src/main/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResource.java b/integration-tests/core-main-caffeine-lrucache/src/main/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResource.java
new file mode 100644
index 0000000..963b3a8
--- /dev/null
+++ b/integration-tests/core-main-caffeine-lrucache/src/main/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResource.java
@@ -0,0 +1,36 @@
+/*
+ * 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.core;
+
+import javax.enterprise.context.ApplicationScoped;
+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.support.LRUCacheFactory;
+
+@Path("/test")
+@ApplicationScoped
+public class CoreMainCaffeineLRUCacheResource {
+ @Path("/lru-cache-factory")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String lruCacheFactory() {
+ return LRUCacheFactory.getInstance().getClass().getName();
+ }
+}
diff --git a/integration-tests/core-main-caffeine-lrucache/src/main/resources/application.properties b/integration-tests/core-main-caffeine-lrucache/src/main/resources/application.properties
new file mode 100644
index 0000000..49c087f
--- /dev/null
+++ b/integration-tests/core-main-caffeine-lrucache/src/main/resources/application.properties
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# Quarkus
+#
+quarkus.log.file.enable = false
+
+#
+# Camel
+#
+camel.context.name=quarkus-camel-example
diff --git a/integration-tests/core-main-caffeine-lrucache/src/test/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResourceIT.java b/integration-tests/core-main-caffeine-lrucache/src/test/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResourceIT.java
new file mode 100644
index 0000000..8cd2ecc
--- /dev/null
+++ b/integration-tests/core-main-caffeine-lrucache/src/test/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResourceIT.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class CoreMainCaffeineLRUCacheResourceIT extends CoreMainCaffeineLRUCacheResourceTest {
+}
diff --git a/integration-tests/core-main-caffeine-lrucache/src/test/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResourceTest.java b/integration-tests/core-main-caffeine-lrucache/src/test/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResourceTest.java
new file mode 100644
index 0000000..5153b2c
--- /dev/null
+++ b/integration-tests/core-main-caffeine-lrucache/src/test/java/org/apache/camel/quarkus/core/CoreMainCaffeineLRUCacheResourceTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.core;
+
+import javax.ws.rs.core.MediaType;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.component.caffeine.lrucache.CaffeineLRUCacheFactory;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+public class CoreMainCaffeineLRUCacheResourceTest {
+ @Test
+ public void testLRUCacheFactory() {
+ RestAssured.given()
+ .accept(MediaType.TEXT_PLAIN)
+ .get("/test/lru-cache-factory")
+ .then()
+ .statusCode(200)
+ .body(is(CaffeineLRUCacheFactory.class.getName()));
+ }
+}
diff --git a/integration-tests/core-main/src/main/java/org/apache/camel/quarkus/core/CoreMainResource.java b/integration-tests/core-main/src/main/java/org/apache/camel/quarkus/core/CoreMainResource.java
index bf0cb0f..96da728 100644
--- a/integration-tests/core-main/src/main/java/org/apache/camel/quarkus/core/CoreMainResource.java
+++ b/integration-tests/core-main/src/main/java/org/apache/camel/quarkus/core/CoreMainResource.java
@@ -48,6 +48,7 @@ import org.apache.camel.spi.Language;
import org.apache.camel.spi.ReactiveExecutor;
import org.apache.camel.spi.Registry;
import org.apache.camel.support.DefaultRegistry;
+import org.apache.camel.support.LRUCacheFactory;
import org.apache.camel.support.processor.DefaultExchangeFormatter;
@Path("/test")
@@ -154,6 +155,7 @@ public class CoreMainResource {
.add("listeners", listeners)
.add("routeBuilders", routeBuilders)
.add("routes", routes)
+ .add("lru-cache-factory", LRUCacheFactory.getInstance().getClass().getName())
.add("autoConfigurationLogSummary", main.getMainConfigurationProperties().isAutoConfigurationLogSummary())
.add("config", Json.createObjectBuilder()
.add("rest-port",
diff --git a/integration-tests/core-main/src/test/java/org/apache/camel/quarkus/core/CoreMainTest.java b/integration-tests/core-main/src/test/java/org/apache/camel/quarkus/core/CoreMainTest.java
index 0db69c5..9324121 100644
--- a/integration-tests/core-main/src/test/java/org/apache/camel/quarkus/core/CoreMainTest.java
+++ b/integration-tests/core-main/src/test/java/org/apache/camel/quarkus/core/CoreMainTest.java
@@ -28,6 +28,7 @@ import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import org.apache.camel.quarkus.core.runtime.support.SupportListener;
import org.apache.camel.reactive.vertx.VertXReactiveExecutor;
+import org.apache.camel.support.DefaultLRUCacheFactory;
import org.junit.jupiter.api.Test;
import static org.apache.camel.quarkus.test.Conditions.doesNotStartWith;
@@ -93,6 +94,7 @@ public class CoreMainTest {
.contains("keep-alive", "configure", "beforeStart", "produced", "endpointdsl")
.doesNotContain("filtered");
+ assertThat(p.getString("lru-cache-factory")).isEqualTo(DefaultLRUCacheFactory.class.getName());
assertThat(p.getBoolean("autoConfigurationLogSummary")).isFalse();
assertThat(p.getMap("registry.components", String.class, String.class)).isNotEmpty();
diff --git a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java b/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java
index 3ce78b5..b4e4f49 100644
--- a/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java
+++ b/integration-tests/core/src/main/java/org/apache/camel/quarkus/core/CoreResource.java
@@ -35,6 +35,7 @@ import org.apache.camel.catalog.RuntimeCamelCatalog;
import org.apache.camel.component.log.LogComponent;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.spi.Registry;
+import org.apache.camel.support.LRUCacheFactory;
import org.apache.camel.support.processor.DefaultExchangeFormatter;
@Path("/test")
@@ -144,4 +145,11 @@ public class CoreResource {
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
+ @Path("/lru-cache-factory")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String lruCacheFactory() {
+ return LRUCacheFactory.getInstance().getClass().getName();
+ }
}
diff --git a/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java b/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java
index 791938b..34977cd 100644
--- a/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java
+++ b/integration-tests/core/src/test/java/org/apache/camel/quarkus/core/CoreTest.java
@@ -22,6 +22,7 @@ import java.net.HttpURLConnection;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.response.Response;
+import org.apache.camel.support.DefaultLRUCacheFactory;
import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.emptyOrNullString;
@@ -70,4 +71,9 @@ public class CoreTest {
RestAssured.when().get("/test/adapt/model-camel-context").then().body(is("true"));
RestAssured.when().get("/test/adapt/extended-camel-context").then().body(is("true"));
}
+
+ @Test
+ public void testLRUCacheFactory() {
+ RestAssured.when().get("/test/lru-cache-factory").then().body(is(DefaultLRUCacheFactory.class.getName()));
+ }
}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 4618e9b..846fb4a 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -153,6 +153,7 @@
<module>core-main-xml-jaxb</module>
<module>core-main-xml-io</module>
<module>core-main-collector</module>
+ <module>core-main-caffeine-lrucache</module>
<module>core-impl</module>
<!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat -->
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index b9d4a2d..498c89e 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -176,6 +176,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-caffeine-lrucache-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-consul-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 5933dd0..154fd58 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -827,6 +827,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-caffeine-lrucache</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-consul</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>