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 8225eaddd Added missing runtime compression libraries bundles in
camel-kafka feature (#648)
8225eaddd is described below
commit 8225eadddb33d21b5e4edcd8ac39dedf74500614
Author: Robin Vishwakarma <[email protected]>
AuthorDate: Fri Oct 17 13:02:47 2025 +0300
Added missing runtime compression libraries bundles in camel-kafka feature
(#648)
---
features/src/main/feature/camel-features.xml | 2 +
tests/features/camel-kafka/pom.xml | 33 ++++++++++
.../test/CamelKafkaCompressionRouteSupplier.java | 74 ++++++++++++++++++++++
...aITest.java => CamelKafkaCompressionITest.java} | 34 ++++------
.../apache/karaf/camel/itest/CamelKafkaITest.java | 9 ++-
5 files changed, 126 insertions(+), 26 deletions(-)
diff --git a/features/src/main/feature/camel-features.xml
b/features/src/main/feature/camel-features.xml
index 072502da8..883779b08 100644
--- a/features/src/main/feature/camel-features.xml
+++ b/features/src/main/feature/camel-features.xml
@@ -1935,6 +1935,8 @@
<feature version='${camel-osgi-version-range}'>camel-core</feature>
<bundle
dependency='true'>wrap:mvn:org.apache.kafka/kafka-clients/${kafka-version}</bundle>
<bundle
dependency='true'>mvn:com.github.luben/zstd-jni/${auto-detect-version}</bundle>
+ <bundle
dependency="true">mvn:org.xerial.snappy/snappy-java/${auto-detect-version}</bundle>
+ <bundle
dependency="true">wrap:mvn:org.lz4/lz4-java/${auto-detect-version}</bundle>
<bundle>mvn:org.apache.camel.karaf/camel-kafka/${project.version}</bundle>
</feature>
<feature name='camel-kamelet' version='${project.version}'
start-level='50'>
diff --git a/tests/features/camel-kafka/pom.xml
b/tests/features/camel-kafka/pom.xml
index a3a4f3807..8dcd6fe72 100644
--- a/tests/features/camel-kafka/pom.xml
+++ b/tests/features/camel-kafka/pom.xml
@@ -50,6 +50,39 @@
<filtering>false</filtering>
</resource>
</resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <phase>integration-test</phase>
+ <configuration>
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ <systemPropertyVariables>
+
<camel.karaf.itest.dump.logs>${dump.logs.on.failure}</camel.karaf.itest.dump.logs>
+
<camel.karaf.itest.keep.docker.images>true</camel.karaf.itest.keep.docker.images>
+
<camel.karaf.version>${project.version}</camel.karaf.version>
+
<project.version>${project.version}</project.version>
+
<project.target>${project.build.directory}</project.target>
+
<users.file.location>${users.file.location}</users.file.location>
+
<org.ops4j.pax.logging.DefaultServiceLog.level>WARN</org.ops4j.pax.logging.DefaultServiceLog.level>
+ </systemPropertyVariables>
+
<forkedProcessExitTimeoutInSeconds>10</forkedProcessExitTimeoutInSeconds>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
</build>
</project>
\ No newline at end of file
diff --git
a/tests/features/camel-kafka/src/main/java/org/apache/karaf/camel/test/CamelKafkaCompressionRouteSupplier.java
b/tests/features/camel-kafka/src/main/java/org/apache/karaf/camel/test/CamelKafkaCompressionRouteSupplier.java
new file mode 100644
index 000000000..0321e8b54
--- /dev/null
+++
b/tests/features/camel-kafka/src/main/java/org/apache/karaf/camel/test/CamelKafkaCompressionRouteSupplier.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.camel.test;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.kafka.KafkaComponent;
+import org.apache.camel.component.kafka.KafkaConfiguration;
+import org.apache.camel.model.RouteDefinition;
+import
org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteSupplier;
+import org.apache.karaf.camel.itests.CamelRouteSupplier;
+import org.osgi.service.component.annotations.Component;
+
+import java.util.function.Function;
+
+
+@Component(
+ name = "karaf-camel-kafka-compression-test",
+ immediate = true,
+ service = CamelRouteSupplier.class
+)
+public class CamelKafkaCompressionRouteSupplier extends
AbstractCamelSingleFeatureResultMockBasedRouteSupplier {
+
+ @Override
+ protected String getResultMockName() {
+ return "camel-kafka-test";
+ }
+
+ @Override
+ public String getTestComponentName() {
+ return "camel-kafka-test";
+ }
+
+ @Override
+ public void configure(CamelContext camelContext) {
+ KafkaComponent kafka = new KafkaComponent();
+ KafkaConfiguration config = new KafkaConfiguration();
+ config.setBreakOnFirstError(true);
+ config.setBrokers(System.getProperty("kafka.server"));
+ kafka.setConfiguration(config);
+ camelContext.addComponent("kafka", kafka);
+ }
+
+ private static final String KAFKA_TOPIC = "testTopic";
+
+ @Override
+ protected Function<RouteBuilder, RouteDefinition> consumerRoute() {
+ return builder ->
+ builder.fromF("kafka://%s?autoOffsetReset=earliest",
KAFKA_TOPIC)
+ .log("received kafka message ${body}");
+ }
+
+ @Override
+ protected void configureProducer(RouteBuilder builder, RouteDefinition
producerRoute) {
+ producerRoute.log("calling kafka topic")
+ .setBody(builder.constant("OK"))
+ .toF("kafka://%s?compressionCodec=snappy", KAFKA_TOPIC)
+ .log("kafka topic called");
+ }
+}
+
diff --git
a/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
b/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaCompressionITest.java
similarity index 61%
copy from
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
copy to
tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaCompressionITest.java
index 89617f9a9..9d90447c2 100644
---
a/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
+++
b/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaCompressionITest.java
@@ -13,26 +13,30 @@
*/
package org.apache.karaf.camel.itest;
-import java.util.function.Consumer;
-
import org.apache.camel.component.mock.MockEndpoint;
import
org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
import org.apache.karaf.camel.itests.CamelKarafTestHint;
-import org.apache.karaf.camel.itests.GenericContainerResource;
import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testcontainers.containers.KafkaContainer;
-import org.testcontainers.utility.DockerImageName;
-@CamelKarafTestHint(externalResourceProvider =
CamelKafkaITest.ExternalResourceProviders.class)
+@CamelKarafTestHint(externalResourceProvider =
CamelKafkaITest.ExternalResourceProviders.class,
+ camelRouteSuppliers = "karaf-camel-kafka-compression-test")
@RunWith(PaxExamWithExternalResource.class)
@ExamReactorStrategy(PerClass.class)
-public class CamelKafkaITest extends
AbstractCamelSingleFeatureResultMockBasedRouteITest {
+public class CamelKafkaCompressionITest extends
AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+ @Override
+ public String getTestComponentName() {
+ return "camel-kafka-test";
+ }
+
+ @Override
+ public String getCamelFeatureName() {
+ return "camel-kafka";
+ }
@Override
public void configureMock(MockEndpoint mock) {
@@ -43,16 +47,4 @@ public class CamelKafkaITest extends
AbstractCamelSingleFeatureResultMockBasedRo
public void testResultMock() throws Exception {
assertMockEndpointsSatisfied();
}
-
- public static final class ExternalResourceProviders {
-
- public static GenericContainerResource createKafkaContainer() {
- final KafkaContainer kafkaContainer =
- new
KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.6.1"));
-
- return new GenericContainerResource(kafkaContainer,
(Consumer<GenericContainerResource>) resource -> {
- resource.setProperty("kafka.server",
kafkaContainer.getBootstrapServers());
- });
- }
- }
}
\ No newline at end of file
diff --git
a/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
b/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
index 89617f9a9..90a4b222c 100644
---
a/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
+++
b/tests/features/camel-kafka/src/test/java/org/apache/karaf/camel/itest/CamelKafkaITest.java
@@ -13,8 +13,6 @@
*/
package org.apache.karaf.camel.itest;
-import java.util.function.Consumer;
-
import org.apache.camel.component.mock.MockEndpoint;
import
org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
import org.apache.karaf.camel.itests.CamelKarafTestHint;
@@ -24,12 +22,13 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.utility.DockerImageName;
-@CamelKarafTestHint(externalResourceProvider =
CamelKafkaITest.ExternalResourceProviders.class)
+import java.util.function.Consumer;
+
+@CamelKarafTestHint(externalResourceProvider =
CamelKafkaITest.ExternalResourceProviders.class,
+ camelRouteSuppliers = "karaf-camel-kafka-test")
@RunWith(PaxExamWithExternalResource.class)
@ExamReactorStrategy(PerClass.class)
public class CamelKafkaITest extends
AbstractCamelSingleFeatureResultMockBasedRouteITest {