This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git
The following commit(s) were added to refs/heads/main by this push:
new 3ca71fad Ref #424: Add camel-caffeine integration test (#425)
3ca71fad is described below
commit 3ca71fada100a5b9bcf724c0a44ad8f31334c455
Author: François de Parscau <[email protected]>
AuthorDate: Sat Jul 13 10:15:59 2024 +0200
Ref #424: Add camel-caffeine integration test (#425)
---
tests/features/camel-caffeine/pom.xml | 40 +++++++++++++++++
.../camel/test/CamelCaffeineRouteSupplier.java | 51 ++++++++++++++++++++++
.../karaf/camel/itest/CamelCaffeineITest.java | 40 +++++++++++++++++
tests/features/pom.xml | 1 +
4 files changed, 132 insertions(+)
diff --git a/tests/features/camel-caffeine/pom.xml
b/tests/features/camel-caffeine/pom.xml
new file mode 100644
index 00000000..3eab4871
--- /dev/null
+++ b/tests/features/camel-caffeine/pom.xml
@@ -0,0 +1,40 @@
+<?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.karaf</groupId>
+ <artifactId>camel-karaf-features-test</artifactId>
+ <version>4.6.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-caffeine-test</artifactId>
+ <name>Apache Camel :: Karaf :: Tests :: Features :: Caffeine</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-caffeine</artifactId>
+ <version>${camel-version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git
a/tests/features/camel-caffeine/src/main/java/org/apache/karaf/camel/test/CamelCaffeineRouteSupplier.java
b/tests/features/camel-caffeine/src/main/java/org/apache/karaf/camel/test/CamelCaffeineRouteSupplier.java
new file mode 100644
index 00000000..22066ce3
--- /dev/null
+++
b/tests/features/camel-caffeine/src/main/java/org/apache/karaf/camel/test/CamelCaffeineRouteSupplier.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.test;
+
+import static org.apache.camel.builder.Builder.constant;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.caffeine.CaffeineConstants;
+import org.apache.camel.model.RouteDefinition;
+import
org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteSupplier;
+import org.osgi.service.component.annotations.Component;
+
+@Component(
+ name = "karaf-camel-caffeine-test",
+ immediate = true,
+ service = CamelCaffeineRouteSupplier.class
+)
+public class CamelCaffeineRouteSupplier extends
AbstractCamelSingleFeatureResultMockBasedRouteSupplier {
+
+ @Override
+ protected boolean consumerEnabled() {
+ return false;
+ }
+
+ @Override
+ protected void configureProducer(RouteBuilder builder, RouteDefinition
producerRoute) {
+ producerRoute.setBody(constant("OK"))
+ .setHeader(CaffeineConstants.ACTION,
constant(CaffeineConstants.ACTION_PUT))
+ .setHeader(CaffeineConstants.KEY, constant("cachekey"))
+ .to("caffeine-cache://testcache?statsEnabled=true")
+ .setHeader(CaffeineConstants.ACTION,
constant(CaffeineConstants.ACTION_GET))
+ .setHeader(CaffeineConstants.KEY, constant("cachekey"))
+ .to("caffeine-cache://testcache?statsEnabled=true")
+ .log("received: ${body}")
+ .toF("mock:%s", getResultMockName());
+ }
+}
+
diff --git
a/tests/features/camel-caffeine/src/test/java/org/apache/karaf/camel/itest/CamelCaffeineITest.java
b/tests/features/camel-caffeine/src/test/java/org/apache/karaf/camel/itest/CamelCaffeineITest.java
new file mode 100644
index 00000000..2db5c6f3
--- /dev/null
+++
b/tests/features/camel-caffeine/src/test/java/org/apache/karaf/camel/itest/CamelCaffeineITest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed 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.karaf.camel.itest;
+
+import org.apache.camel.component.caffeine.CaffeineConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import
org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelCaffeineITest extends
AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ @Override
+ public void configureMock(MockEndpoint mock) {
+ mock.expectedBodiesReceived("OK");
+ mock.expectedHeaderReceived(CaffeineConstants.ACTION_HAS_RESULT, true);
+ mock.expectedHeaderReceived(CaffeineConstants.ACTION_SUCCEEDED, true);
+ }
+
+ @Test
+ public void testResultMock() throws Exception {
+ assertMockEndpointsSatisfied();
+ }
+}
\ No newline at end of file
diff --git a/tests/features/pom.xml b/tests/features/pom.xml
index 2aa76be8..5d2ce2b3 100644
--- a/tests/features/pom.xml
+++ b/tests/features/pom.xml
@@ -54,6 +54,7 @@
<module>camel-barcode</module>
<module>camel-base64</module>
<module>camel-bindy</module>
+ <module>camel-caffeine</module>
<module>camel-core</module>
<module>camel-drill</module>
<module>camel-ehcache</module>