This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d6d102cdd JCache native mode
5d6d102cdd is described below

commit 5d6d102cdd124ab3d317fe2dff480f6c22e26102
Author: Eugene Berman <eugene.ber...@modusbox.com>
AuthorDate: Tue Sep 13 16:02:12 2022 -0700

    JCache native mode
---
 docs/modules/ROOT/examples/components/jcache.yml   |  6 +-
 .../ROOT/pages/reference/extensions/jcache.adoc    | 14 +++--
 extensions-jvm/pom.xml                             |  1 -
 .../jcache/deployment/pom.xml                      |  0
 .../jcache/deployment/JcacheProcessor.java         | 33 +++++++----
 {extensions-jvm => extensions}/jcache/pom.xml      |  2 +-
 .../jcache/runtime/pom.xml                         |  1 +
 .../main/resources/META-INF/quarkus-extension.yaml |  3 +-
 extensions/pom.xml                                 |  1 +
 integration-tests-jvm/pom.xml                      |  1 -
 .../jcache/pom.xml                                 | 53 +++++++++++++++++
 .../it/JcacheCaffeineReflectionConfiguration.java  | 19 ++-----
 .../component/jcache/it/JcacheResource.java        | 30 ++++++----
 .../quarkus/component/jcache/it/JcacheRoutes.java  | 66 ++++++++++++++++++++++
 .../src/main/resources/application.properties      | 17 ++++++
 .../quarkus/component/jcache/it/JcacheIT.java      | 16 +-----
 .../quarkus/component/jcache/it/JcacheTest.java    | 27 +++++++--
 integration-tests/pom.xml                          |  1 +
 pom.xml                                            |  1 +
 poms/bom-test/pom.xml                              | 11 ++++
 tooling/scripts/test-categories.yaml               |  1 +
 21 files changed, 237 insertions(+), 67 deletions(-)

diff --git a/docs/modules/ROOT/examples/components/jcache.yml 
b/docs/modules/ROOT/examples/components/jcache.yml
index 9429f64751..5536775e60 100644
--- a/docs/modules/ROOT/examples/components/jcache.yml
+++ b/docs/modules/ROOT/examples/components/jcache.yml
@@ -2,11 +2,11 @@
 # This file was generated by 
camel-quarkus-maven-plugin:update-extension-doc-page
 cqArtifactId: camel-quarkus-jcache
 cqArtifactIdBase: jcache
-cqNativeSupported: false
-cqStatus: Preview
+cqNativeSupported: true
+cqStatus: Stable
 cqDeprecated: false
 cqJvmSince: 1.2.0
-cqNativeSince: n/a
+cqNativeSince: 2.13.0
 cqCamelPartName: jcache
 cqCamelPartTitle: JCache
 cqCamelPartDescription: Perform caching operations against JSR107/JCache.
diff --git a/docs/modules/ROOT/pages/reference/extensions/jcache.adoc 
b/docs/modules/ROOT/pages/reference/extensions/jcache.adoc
index 654e8b4360..dd9e205df1 100644
--- a/docs/modules/ROOT/pages/reference/extensions/jcache.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/jcache.adoc
@@ -4,17 +4,17 @@
 = JCache
 :linkattrs:
 :cq-artifact-id: camel-quarkus-jcache
-:cq-native-supported: false
-:cq-status: Preview
-:cq-status-deprecation: Preview
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
 :cq-description: Perform caching operations against JSR107/JCache.
 :cq-deprecated: false
 :cq-jvm-since: 1.2.0
-:cq-native-since: n/a
+:cq-native-since: 2.13.0
 
 ifeval::[{doc-show-badges} == true]
 [.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.2.0## 
[.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.2.0## [.badge-key]##Native 
since##[.badge-supported]##2.13.0##
 endif::[]
 
 Perform caching operations against JSR107/JCache.
@@ -29,6 +29,10 @@ Please refer to the above link for usage and configuration 
details.
 [id="extensions-jcache-maven-coordinates"]
 == Maven coordinates
 
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-jcache[Create
 a new project with this extension on {link-quarkus-code-generator}, 
window="_blank"]
+
+Or add the coordinates to your existing project:
+
 [source,xml]
 ----
 <dependency>
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index a611f06053..2817222987 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -79,7 +79,6 @@
         <module>jasypt</module>
         <module>java-joor-dsl</module>
         <module>jbpm</module>
-        <module>jcache</module>
         <module>jclouds</module>
         <module>jcr</module>
         <module>jgroups</module>
diff --git a/extensions-jvm/jcache/deployment/pom.xml 
b/extensions/jcache/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/jcache/deployment/pom.xml
rename to extensions/jcache/deployment/pom.xml
diff --git 
a/extensions-jvm/jcache/deployment/src/main/java/org/apache/camel/quarkus/component/jcache/deployment/JcacheProcessor.java
 
b/extensions/jcache/deployment/src/main/java/org/apache/camel/quarkus/component/jcache/deployment/JcacheProcessor.java
similarity index 56%
rename from 
extensions-jvm/jcache/deployment/src/main/java/org/apache/camel/quarkus/component/jcache/deployment/JcacheProcessor.java
rename to 
extensions/jcache/deployment/src/main/java/org/apache/camel/quarkus/component/jcache/deployment/JcacheProcessor.java
index 275b66871d..17c5d3b042 100644
--- 
a/extensions-jvm/jcache/deployment/src/main/java/org/apache/camel/quarkus/component/jcache/deployment/JcacheProcessor.java
+++ 
b/extensions/jcache/deployment/src/main/java/org/apache/camel/quarkus/component/jcache/deployment/JcacheProcessor.java
@@ -16,12 +16,15 @@
  */
 package org.apache.camel.quarkus.component.jcache.deployment;
 
+import java.io.IOException;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
+import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.util.ServiceUtil;
 import org.jboss.logging.Logger;
 
 class JcacheProcessor {
@@ -34,13 +37,19 @@ class JcacheProcessor {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    void registerCachingProvider(BuildProducer<ServiceProviderBuildItem> 
services) {
+        Stream.of("javax.cache.spi.CachingProvider")
+                .forEach(service -> {
+                    try {
+                        Set<String> implementations = 
ServiceUtil.classNamesNamedIn(
+                                Thread.currentThread().getContextClassLoader(),
+                                "META-INF/services/" + service);
+                        services.produce(
+                                new ServiceProviderBuildItem(service, 
implementations));
+                    } catch (IOException e) {
+                        throw new RuntimeException(e);
+                    }
+                });
     }
 }
diff --git a/extensions-jvm/jcache/pom.xml b/extensions/jcache/pom.xml
similarity index 96%
rename from extensions-jvm/jcache/pom.xml
rename to extensions/jcache/pom.xml
index 332cc6e09c..1b4ebbfd8a 100644
--- a/extensions-jvm/jcache/pom.xml
+++ b/extensions/jcache/pom.xml
@@ -21,7 +21,7 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-extensions-jvm</artifactId>
+        <artifactId>camel-quarkus-extensions</artifactId>
         <version>2.13.0-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
diff --git a/extensions-jvm/jcache/runtime/pom.xml 
b/extensions/jcache/runtime/pom.xml
similarity index 98%
rename from extensions-jvm/jcache/runtime/pom.xml
rename to extensions/jcache/runtime/pom.xml
index f99f460640..c6acb54448 100644
--- a/extensions-jvm/jcache/runtime/pom.xml
+++ b/extensions/jcache/runtime/pom.xml
@@ -32,6 +32,7 @@
 
     <properties>
         <camel.quarkus.jvmSince>1.2.0</camel.quarkus.jvmSince>
+        <camel.quarkus.nativeSince>2.13.0</camel.quarkus.nativeSince>
     </properties>
 
     <dependencies>
diff --git 
a/extensions-jvm/jcache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
 b/extensions/jcache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 97%
rename from 
extensions-jvm/jcache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to 
extensions/jcache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 108ffe4b7b..fba39c7a49 100644
--- 
a/extensions-jvm/jcache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ 
b/extensions/jcache/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -24,9 +24,8 @@
 name: "Camel JCache"
 description: "Perform caching operations against JSR107/JCache"
 metadata:
-  unlisted: true
   guide: 
"https://camel.apache.org/camel-quarkus/latest/reference/extensions/jcache.html";
   categories:
   - "integration"
   status:
-  - "preview"
+  - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index d9ffe807f0..62b19a3a48 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -130,6 +130,7 @@
         <module>jackson-protobuf</module>
         <module>jacksonxml</module>
         <module>jaxb</module>
+        <module>jcache</module>
         <module>jdbc</module>
         <module>jfr</module>
         <module>jira</module>
diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml
index c101f12e0d..c79c6453ed 100644
--- a/integration-tests-jvm/pom.xml
+++ b/integration-tests-jvm/pom.xml
@@ -77,7 +77,6 @@
         <module>jasypt</module>
         <module>java-joor-dsl</module>
         <module>jbpm</module>
-        <module>jcache</module>
         <module>jclouds</module>
         <module>jcr</module>
         <module>jgroups</module>
diff --git a/integration-tests-jvm/jcache/pom.xml 
b/integration-tests/jcache/pom.xml
similarity index 62%
rename from integration-tests-jvm/jcache/pom.xml
rename to integration-tests/jcache/pom.xml
index d4c46e2b2a..9132e66a05 100644
--- a/integration-tests-jvm/jcache/pom.xml
+++ b/integration-tests/jcache/pom.xml
@@ -35,10 +35,23 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-jcache</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-caffeine</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>jcache</artifactId>
+        </dependency>
 
         <!-- test dependencies -->
         <dependency>
@@ -63,6 +76,19 @@
             </activation>
             <dependencies>
                 <!-- The following dependencies guarantee that this module is 
built after them. You can update them by running `mvn process-resources 
-Pformat -N` from the source tree root directory -->
+                <dependency>
+                    <groupId>org.apache.camel.quarkus</groupId>
+                    <artifactId>camel-quarkus-direct-deployment</artifactId>
+                    <version>${project.version}</version>
+                    <type>pom</type>
+                    <scope>test</scope>
+                    <exclusions>
+                        <exclusion>
+                            <groupId>*</groupId>
+                            <artifactId>*</artifactId>
+                        </exclusion>
+                    </exclusions>
+                </dependency>
                 <dependency>
                     <groupId>org.apache.camel.quarkus</groupId>
                     <artifactId>camel-quarkus-jcache-deployment</artifactId>
@@ -78,6 +104,33 @@
                 </dependency>
             </dependencies>
         </profile>
+        <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-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
 
b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheCaffeineReflectionConfiguration.java
similarity index 70%
copy from 
integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
copy to 
integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheCaffeineReflectionConfiguration.java
index 1806724a1b..1e1c850790 100644
--- 
a/integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
+++ 
b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheCaffeineReflectionConfiguration.java
@@ -16,19 +16,10 @@
  */
 package org.apache.camel.quarkus.component.jcache.it;
 
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
-
-@QuarkusTest
-class JcacheTest {
-
-    @Test
-    public void loadComponentJcache() {
-        /* A simple autogenerated test */
-        RestAssured.get("/jcache/load/component/jcache")
-                .then()
-                .statusCode(200);
-    }
+import io.quarkus.runtime.annotations.RegisterForReflection;
 
+@RegisterForReflection(classNames = {
+        "com.github.benmanes.caffeine.jcache.copy.JavaSerializationCopier"
+})
+public class JcacheCaffeineReflectionConfiguration {
 }
diff --git 
a/integration-tests-jvm/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheResource.java
 
b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheResource.java
similarity index 67%
rename from 
integration-tests-jvm/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheResource.java
rename to 
integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheResource.java
index f1b98c0fa4..2038594304 100644
--- 
a/integration-tests-jvm/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheResource.java
+++ 
b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheResource.java
@@ -22,9 +22,8 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
-import org.apache.camel.CamelContext;
+import org.apache.camel.*;
 import org.jboss.logging.Logger;
 
 @Path("/jcache")
@@ -37,15 +36,26 @@ public class JcacheResource {
     @Inject
     CamelContext context;
 
-    @Path("/load/component/jcache")
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/sayHello")
     @GET
     @Produces(MediaType.TEXT_PLAIN)
-    public Response loadComponentJcache() throws Exception {
-        /* This is an autogenerated test */
-        if (context.getComponent(COMPONENT_JCACHE) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", 
COMPONENT_JCACHE);
-        return Response.status(500, COMPONENT_JCACHE + " could not be loaded 
from the Camel context").build();
+    public String sayHello() throws Exception {
+        Exchange exchange = producerTemplate.request("direct:getCachedValue", 
new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getMessage().setHeader("Cache-Key", "123");
+            }
+        });
+
+        String body = exchange.getMessage().getBody(String.class);
+        String inCacheProperty = exchange.getProperty("In-Cache", 
String.class);
+
+        String response = body + " : " + inCacheProperty;
+
+        return response;
     }
+
 }
diff --git 
a/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java
 
b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java
new file mode 100644
index 0000000000..f03baac069
--- /dev/null
+++ 
b/integration-tests/jcache/src/main/java/org/apache/camel/quarkus/component/jcache/it/JcacheRoutes.java
@@ -0,0 +1,66 @@
+/*
+ * 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.jcache.it;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.cache.Cache;
+import javax.cache.CacheManager;
+import javax.cache.Caching;
+import javax.cache.configuration.MutableConfiguration;
+import javax.cache.expiry.CreatedExpiryPolicy;
+import javax.cache.expiry.Duration;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jcache.policy.JCachePolicy;
+
+@ApplicationScoped
+public class JcacheRoutes extends RouteBuilder {
+    @Inject
+    @Named("jcachePolicy")
+    JCachePolicy jcachePolicy;
+
+    @Override
+    public void configure() throws Exception {
+        from("direct:getCachedValue")
+                .setProperty("In-Cache", constant("Cached Response"))
+                .policy(jcachePolicy)
+                .setBody(constant("Hello World"))
+                .setProperty("In-Cache", constant("Non-Cached Response"))
+                .end();
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named
+    public JCachePolicy jcachePolicy() {
+        MutableConfiguration configuration = new MutableConfiguration<>();
+        configuration.setTypes(String.class, Object.class);
+        configuration.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new 
Duration(TimeUnit.SECONDS, 3)));
+        CacheManager cacheManager = 
Caching.getCachingProvider().getCacheManager();
+        Cache cache = cacheManager.createCache("MyJCache", configuration);
+
+        JCachePolicy jcachePolicy = new JCachePolicy();
+        jcachePolicy.setCache(cache);
+        jcachePolicy.setKeyExpression(simple("${header.Cache-Key}"));
+        return jcachePolicy;
+    }
+}
diff --git a/integration-tests/jcache/src/main/resources/application.properties 
b/integration-tests/jcache/src/main/resources/application.properties
new file mode 100644
index 0000000000..c00c114854
--- /dev/null
+++ b/integration-tests/jcache/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus.native.resources.includes=reference.conf
\ No newline at end of file
diff --git 
a/integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
 
b/integration-tests/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheIT.java
similarity index 70%
copy from 
integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
copy to 
integration-tests/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheIT.java
index 1806724a1b..e7710e35b3 100644
--- 
a/integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
+++ 
b/integration-tests/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheIT.java
@@ -16,19 +16,9 @@
  */
 package org.apache.camel.quarkus.component.jcache.it;
 
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
 
-@QuarkusTest
-class JcacheTest {
-
-    @Test
-    public void loadComponentJcache() {
-        /* A simple autogenerated test */
-        RestAssured.get("/jcache/load/component/jcache")
-                .then()
-                .statusCode(200);
-    }
+@QuarkusIntegrationTest
+class JcacheIT extends JcacheTest {
 
 }
diff --git 
a/integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
 
b/integration-tests/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
similarity index 60%
rename from 
integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
rename to 
integration-tests/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
index 1806724a1b..5bc1518d5b 100644
--- 
a/integration-tests-jvm/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
+++ 
b/integration-tests/jcache/src/test/java/org/apache/camel/quarkus/component/jcache/it/JcacheTest.java
@@ -20,15 +20,32 @@ import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import org.junit.jupiter.api.Test;
 
+import static org.hamcrest.Matchers.is;
+
 @QuarkusTest
 class JcacheTest {
 
     @Test
-    public void loadComponentJcache() {
-        /* A simple autogenerated test */
-        RestAssured.get("/jcache/load/component/jcache")
+    public void testCache() {
+        RestAssured.get("/jcache/sayHello")
                 .then()
-                .statusCode(200);
-    }
+                .statusCode(200)
+                .body(is("Hello World : Non-Cached Response"));
+
+        RestAssured.get("/jcache/sayHello")
+                .then()
+                .statusCode(200)
+                .body(is("Hello World : Cached Response"));
 
+        //Wait till Cache expires
+        try {
+            Thread.sleep(4000);
+        } catch (InterruptedException e) {
+        }
+
+        RestAssured.get("/jcache/sayHello")
+                .then()
+                .statusCode(200)
+                .body(is("Hello World : Non-Cached Response"));
+    }
 }
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index fd8a2ad83a..99ff783113 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -114,6 +114,7 @@
         <module>jackson-avro</module>
         <module>jackson-protobuf</module>
         <module>jaxb</module>
+        <module>jcache</module>
         <module>jdbc</module>
         <module>jfr</module>
         <module>jira</module>
diff --git a/pom.xml b/pom.xml
index c6244b9eed..813bc8d5bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
         <azure-core-test.version>1.7.9</azure-core-test.version>
         
<cassandra-driver-test.version>3.7.1</cassandra-driver-test.version><!-- Keep 
in sync with testcontainers instead of Debezium bom -->
         <bouncycastle.version>1.70</bouncycastle.version><!-- @sync 
io.quarkus:quarkus-bom:${quarkus.version} dep:org.bouncycastle:bcprov-jdk15on 
-->
+        <caffeine.version>2.9.3</caffeine.version><!-- @sync 
io.quarkus:quarkus-bom:${quarkus.version} 
dep:com.github.ben-manes.caffeine:caffeine -->
         
<commons-beanutils.version>${commons-beanutils-version}</commons-beanutils.version>
         <commons-cli.version>1.4</commons-cli.version><!-- keep in sync with 
Quarkus, via quarkus-bootstrap-core -->
         <commons-collections.version>3.2.2</commons-collections.version><!-- 
used by hbase, should be pretty stable as commons-collections are not developed 
actively anymore -->
diff --git a/poms/bom-test/pom.xml b/poms/bom-test/pom.xml
index 17bf9f89b3..34bec65b1a 100644
--- a/poms/bom-test/pom.xml
+++ b/poms/bom-test/pom.xml
@@ -359,6 +359,17 @@
                 <version>${greenmail.version}</version>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>com.github.ben-manes.caffeine</groupId>
+                <artifactId>jcache</artifactId>
+                <version>${caffeine.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.inject</groupId>
+                        <artifactId>javax.inject</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
diff --git a/tooling/scripts/test-categories.yaml 
b/tooling/scripts/test-categories.yaml
index 5ed3e6cf87..b1b5e9f660 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -24,6 +24,7 @@ group-01:
   - hazelcast
   - http
   - infinispan
+  - jcache
   - jms-artemis-client
   - jsch
   - kafka

Reply via email to