You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/04/26 14:23:09 UTC

[camel] branch camel-3.x updated (a0ae9942dee -> 77d84b45e9d)

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

orpiske pushed a change to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git


    from a0ae9942dee Regen for commit 4204190ea96d3fe3a6914f81d83dd3600264fef8
     new 62bb0f75b5d (chores) camel-test-infra-kafka: do use Kafka 2.x when requested
     new aaf7cc6254a CAMEL-18985: Updated `SyncCommitManager` to perform offsets auto-commit of the last `poll()` only if the auto-commit is enabled in the configuration.
     new 77d84b45e9d (chores) camel-kafka: only run certain Kafka 3 tests when using a Kafka 3 container

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/component/kafka/consumer/SyncCommitManager.java   | 6 ++++--
 .../camel/component/kafka/integration/KafkaConsumerAuthIT.java     | 7 +++++++
 .../component/kafka/integration/KafkaConsumerAuthInvalidIT.java    | 7 +++++++
 .../kafka/integration/KafkaConsumerAuthInvalidWithReconnectIT.java | 7 +++++++
 .../test/infra/kafka/services/ContainerLocalKafkaService.java      | 6 +++++-
 .../camel/test/infra/kafka/services/KafkaServiceFactory.java       | 4 ++--
 6 files changed, 32 insertions(+), 5 deletions(-)


[camel] 03/03: (chores) camel-kafka: only run certain Kafka 3 tests when using a Kafka 3 container

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 77d84b45e9d3f75212071a23caaf1d712095307f
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 26 14:37:56 2023 +0200

    (chores) camel-kafka: only run certain Kafka 3 tests when using a Kafka 3 container
---
 .../camel/component/kafka/integration/KafkaConsumerAuthIT.java     | 7 +++++++
 .../component/kafka/integration/KafkaConsumerAuthInvalidIT.java    | 7 +++++++
 .../kafka/integration/KafkaConsumerAuthInvalidWithReconnectIT.java | 7 +++++++
 3 files changed, 21 insertions(+)

diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthIT.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthIT.java
index 7df5402aa34..a12f5954104 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthIT.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthIT.java
@@ -40,6 +40,8 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.TestMethodOrder;
 import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,6 +50,11 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
+@EnabledIfSystemProperties({
+    @EnabledIfSystemProperty(named = "kafka.instance.type", matches = "local-kafka3-container",
+                             disabledReason = "Requires Kafka 3.x"),
+    @EnabledIfSystemProperty(named = "kafka.instance.type", matches = "kafka", disabledReason = "Requires Kafka 3.x")
+})
 @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class KafkaConsumerAuthIT extends BaseEmbeddedKafkaAuthTestSupport {
diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidIT.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidIT.java
index 41968af2ad0..b2ae9058a7c 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidIT.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidIT.java
@@ -40,12 +40,19 @@ import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.TestMethodOrder;
 import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.fail;
 
+@EnabledIfSystemProperties({
+    @EnabledIfSystemProperty(named = "kafka.instance.type", matches = "local-kafka3-container",
+                             disabledReason = "Requires Kafka 3.x"),
+    @EnabledIfSystemProperty(named = "kafka.instance.type", matches = "kafka", disabledReason = "Requires Kafka 3.x")
+})
 @DisabledIfSystemProperty(named = "ci.env.name", matches = "github.com", disabledReason = "Flaky on Github CI")
 @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidWithReconnectIT.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidWithReconnectIT.java
index d02fc094865..8afb6e89097 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidWithReconnectIT.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaConsumerAuthInvalidWithReconnectIT.java
@@ -42,12 +42,19 @@ import org.junit.jupiter.api.Order;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
 import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.fail;
 
+@EnabledIfSystemProperties({
+    @EnabledIfSystemProperty(named = "kafka.instance.type", matches = "local-kafka3-container",
+                             disabledReason = "Requires Kafka 3.x"),
+    @EnabledIfSystemProperty(named = "kafka.instance.type", matches = "kafka", disabledReason = "Requires Kafka 3.x")
+})
 @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class KafkaConsumerAuthInvalidWithReconnectIT extends AbstractKafkaTestSupport {


[camel] 02/03: CAMEL-18985: Updated `SyncCommitManager` to perform offsets auto-commit of the last `poll()` only if the auto-commit is enabled in the configuration.

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit aaf7cc6254af09a380a21afc069996dabb87fdc2
Author: oleg_pershai <Ol...@epam.com>
AuthorDate: Tue Apr 25 21:36:52 2023 +0100

    CAMEL-18985: Updated `SyncCommitManager` to perform offsets auto-commit of the last `poll()` only if the auto-commit is enabled in the configuration.
---
 .../apache/camel/component/kafka/consumer/SyncCommitManager.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/SyncCommitManager.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/SyncCommitManager.java
index a494a8b10a6..9850e45d156 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/SyncCommitManager.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/SyncCommitManager.java
@@ -46,8 +46,10 @@ public class SyncCommitManager extends AbstractCommitManager {
 
     @Override
     public void commit() {
-        LOG.info("Auto commitSync {} from {}", threadId, printableTopic);
-        consumer.commitSync();
+        if (kafkaConsumer.getEndpoint().getConfiguration().isAutoCommitEnable()) {
+            LOG.info("Auto commitSync {} from {}", threadId, printableTopic);
+            consumer.commitSync();
+        }
     }
 
     @Override


[camel] 01/03: (chores) camel-test-infra-kafka: do use Kafka 2.x when requested

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 62bb0f75b5d682e2f409c29fb625153d99a59789
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 26 11:58:03 2023 +0200

    (chores) camel-test-infra-kafka: do use Kafka 2.x when requested
---
 .../camel/test/infra/kafka/services/ContainerLocalKafkaService.java | 6 +++++-
 .../apache/camel/test/infra/kafka/services/KafkaServiceFactory.java | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaService.java b/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaService.java
index f776398b474..f12537305b9 100644
--- a/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaService.java
+++ b/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/ContainerLocalKafkaService.java
@@ -26,6 +26,7 @@ import org.testcontainers.utility.DockerImageName;
 
 public class ContainerLocalKafkaService implements KafkaService, ContainerService<KafkaContainer> {
     public static final String KAFKA3_IMAGE_NAME = "confluentinc/cp-kafka:7.3.2";
+    public static final String KAFKA2_IMAGE_NAME = "confluentinc/cp-kafka:5.5.12";
 
     private static final Logger LOG = LoggerFactory.getLogger(ContainerLocalKafkaService.class);
     private final KafkaContainer kafka;
@@ -70,7 +71,10 @@ public class ContainerLocalKafkaService implements KafkaService, ContainerServic
     }
 
     public static ContainerLocalKafkaService kafka2Container() {
-        return new ContainerLocalKafkaService();
+        KafkaContainer container = new KafkaContainer(DockerImageName.parse(KAFKA2_IMAGE_NAME));
+        container = container.withEmbeddedZookeeper();
+
+        return new ContainerLocalKafkaService(container);
     }
 
     public static ContainerLocalKafkaService kafka3Container() {
diff --git a/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/KafkaServiceFactory.java b/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/KafkaServiceFactory.java
index 377cd13b9fd..241362d68fd 100644
--- a/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/KafkaServiceFactory.java
+++ b/test-infra/camel-test-infra-kafka/src/test/java/org/apache/camel/test/infra/kafka/services/KafkaServiceFactory.java
@@ -61,7 +61,7 @@ public final class KafkaServiceFactory {
                 .addMapping("local-strimzi-container", StrimziService::new)
                 .addRemoteMapping(RemoteKafkaService::new)
                 .addMapping("local-kafka3-container", ContainerLocalKafkaService::kafka3Container)
-                .addMapping("local-kafka2-container", ContainerLocalKafkaService::new)
+                .addMapping("local-kafka2-container", ContainerLocalKafkaService::kafka2Container)
                 .addMapping("local-redpanda-container", RedpandaService::new)
                 .build();
     }
@@ -77,7 +77,7 @@ public final class KafkaServiceFactory {
                         .addMapping("local-kafka3-container",
                                 () -> new SingletonKafkaService(ContainerLocalKafkaService.kafka3Container(), "kafka3"))
                         .addMapping("local-kafka2-container",
-                                () -> new SingletonKafkaService(new ContainerLocalKafkaService(), "kafka2"))
+                                () -> new SingletonKafkaService(ContainerLocalKafkaService.kafka2Container(), "kafka2"))
                         .addMapping("local-strimzi-container",
                                 () -> new SingletonKafkaService(new StrimziService(), "strimzi"))
                         .addMapping("local-redpanda-container",