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/07/17 14:46:56 UTC

[camel] branch main updated (576602789c6 -> 947d2ef9b54)

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

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


    from 576602789c6 Upgrade jsmpp 3.0.0
     new 4fdebeb3afe CAMEL-19609: remove container references from the HDFS test infra
     new 947d2ef9b54 CAMEL-19609: fixed a cyclic dependency issue with camel-test-infra-hdfs

The 2 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:
 .../component/hdfs/integration/HdfsAppendIT.java    |  3 ++-
 .../hdfs/integration/HdfsConsumerIntegrationIT.java |  3 ++-
 .../HdfsProducerConsumerIntegrationIT.java          |  3 ++-
 test-infra/camel-test-infra-hdfs/pom.xml            | 12 ------------
 ...calHDFSService.java => EmbeddedHDFSService.java} | 14 ++++----------
 .../test/infra/hdfs/v2/services/HDFSContainer.java  | 21 ++++++++++++---------
 .../infra/hdfs/v2/services/HDFSServiceFactory.java  | 15 +++++++--------
 7 files changed, 29 insertions(+), 42 deletions(-)
 rename test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/{ContainerLocalHDFSService.java => EmbeddedHDFSService.java} (77%)


[camel] 02/02: CAMEL-19609: fixed a cyclic dependency issue with camel-test-infra-hdfs

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

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

commit 947d2ef9b545e05082be8b42b837a61842255cb5
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Jul 17 15:21:34 2023 +0200

    CAMEL-19609: fixed a cyclic dependency issue with camel-test-infra-hdfs
---
 .../camel/component/hdfs/integration/HdfsAppendIT.java    |  3 ++-
 .../hdfs/integration/HdfsConsumerIntegrationIT.java       |  3 ++-
 .../integration/HdfsProducerConsumerIntegrationIT.java    |  3 ++-
 test-infra/camel-test-infra-hdfs/pom.xml                  |  6 ------
 .../test/infra/hdfs/v2/services/EmbeddedHDFSService.java  |  4 ++--
 .../camel/test/infra/hdfs/v2/services/HDFSContainer.java  |  7 +++++--
 .../test/infra/hdfs/v2/services/HDFSServiceFactory.java   | 15 +++++++--------
 7 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsAppendIT.java b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsAppendIT.java
index c75b7a3f916..e2770f8d127 100644
--- a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsAppendIT.java
+++ b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsAppendIT.java
@@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.infra.hdfs.v2.services.HDFSService;
 import org.apache.camel.test.infra.hdfs.v2.services.HDFSServiceFactory;
 import org.apache.camel.test.junit5.CamelTestSupport;
@@ -40,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class HdfsAppendIT extends CamelTestSupport {
     @RegisterExtension
-    public static HDFSService service = HDFSServiceFactory.createSingletonService();
+    public static HDFSService service = HDFSServiceFactory.createSingletonService(AvailablePortFinder.getNextAvailable());
 
     private static final Logger LOG = LoggerFactory.getLogger(HdfsAppendIT.class);
 
diff --git a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsConsumerIntegrationIT.java b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsConsumerIntegrationIT.java
index 6ca0840873a..770fc8acbf2 100644
--- a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsConsumerIntegrationIT.java
+++ b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsConsumerIntegrationIT.java
@@ -30,6 +30,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.support.DefaultScheduledPollConsumerScheduler;
+import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.infra.hdfs.v2.services.HDFSService;
 import org.apache.camel.test.infra.hdfs.v2.services.HDFSServiceFactory;
 import org.apache.camel.test.junit5.CamelTestSupport;
@@ -58,7 +59,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class HdfsConsumerIntegrationIT extends CamelTestSupport {
     @RegisterExtension
-    public static HDFSService service = HDFSServiceFactory.createSingletonService();
+    public static HDFSService service = HDFSServiceFactory.createSingletonService(AvailablePortFinder.getNextAvailable());
 
     private static final int ITERATIONS = 200;
 
diff --git a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsProducerConsumerIntegrationIT.java b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsProducerConsumerIntegrationIT.java
index 3c24cdf0c58..8ff7f86b3c7 100644
--- a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsProducerConsumerIntegrationIT.java
+++ b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/integration/HdfsProducerConsumerIntegrationIT.java
@@ -26,6 +26,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.infra.hdfs.v2.services.HDFSService;
 import org.apache.camel.test.infra.hdfs.v2.services.HDFSServiceFactory;
 import org.apache.camel.test.junit5.CamelTestSupport;
@@ -42,7 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class HdfsProducerConsumerIntegrationIT extends CamelTestSupport {
     @RegisterExtension
-    public static HDFSService service = HDFSServiceFactory.createSingletonService();
+    public static HDFSService service = HDFSServiceFactory.createSingletonService(AvailablePortFinder.getNextAvailable());
 
     private static final int ITERATIONS = 400;
 
diff --git a/test-infra/camel-test-infra-hdfs/pom.xml b/test-infra/camel-test-infra-hdfs/pom.xml
index 98f6eb14b85..0061c0a6831 100644
--- a/test-infra/camel-test-infra-hdfs/pom.xml
+++ b/test-infra/camel-test-infra-hdfs/pom.xml
@@ -38,12 +38,6 @@
             <type>test-jar</type>
         </dependency>
 
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-junit5</artifactId>
-            <scope>test</scope>
-        </dependency>
-
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-minicluster</artifactId>
diff --git a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java
index b6d81275b0c..75dc0bbb497 100644
--- a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java
+++ b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java
@@ -24,8 +24,8 @@ public class EmbeddedHDFSService implements HDFSService {
     private static final Logger LOG = LoggerFactory.getLogger(EmbeddedHDFSService.class);
     private final HDFSContainer container;
 
-    public EmbeddedHDFSService() {
-        container = new HDFSContainer();
+    public EmbeddedHDFSService(int port) {
+        container = new HDFSContainer(port);
     }
 
     @Override
diff --git a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java
index a5d5091786a..ed3d13ab2e6 100644
--- a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java
+++ b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.test.infra.hdfs.v2.services;
 
-import org.apache.camel.test.AvailablePortFinder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.slf4j.Logger;
@@ -25,15 +24,19 @@ import org.slf4j.LoggerFactory;
 public class HDFSContainer {
     private static final Logger LOG = LoggerFactory.getLogger(HDFSContainer.class);
 
+    private final int port;
     private MiniDFSCluster cluster;
 
+    public HDFSContainer(int port) {
+        this.port = port;
+    }
 
     public void start() {
         try {
             Configuration conf = new Configuration();
             conf.set("dfs.namenode.fs-limits.max-directory-items", "1048576");
             cluster = new MiniDFSCluster.Builder(conf)
-                    .nameNodePort(AvailablePortFinder.getNextAvailable())
+                    .nameNodePort(port)
                     .numDataNodes(3)
                     .format(true)
                     .build();
diff --git a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java
index 0433b19ce2f..db0e202a047 100644
--- a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java
+++ b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java
@@ -38,6 +38,8 @@ public final class HDFSServiceFactory {
         }
     }
 
+    private static HDFSService INSTANCE;
+
     private HDFSServiceFactory() {
 
     }
@@ -46,16 +48,13 @@ public final class HDFSServiceFactory {
         return new SimpleTestServiceBuilder<>("hdfs");
     }
 
-    public static HDFSService createSingletonService() {
-        return SingletonServiceHolder.INSTANCE;
-    }
-
-    private static class SingletonServiceHolder {
-        static final HDFSService INSTANCE;
-        static {
+    public static HDFSService createSingletonService(int port) {
+        if (INSTANCE == null) {
             SimpleTestServiceBuilder<HDFSService> instance = builder();
-            instance.addLocalMapping(() -> new SingletonHDFSService(new EmbeddedHDFSService(), "hdfs"));
+            instance.addLocalMapping(() -> new SingletonHDFSService(new EmbeddedHDFSService(port), "hdfs"));
             INSTANCE = instance.build();
         }
+
+        return INSTANCE;
     }
 }


[camel] 01/02: CAMEL-19609: remove container references from the HDFS test infra

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

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

commit 4fdebeb3afeff3693d07ac3b454d9d91ec13a9fd
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Jul 17 15:10:53 2023 +0200

    CAMEL-19609: remove container references from the HDFS test infra
---
 test-infra/camel-test-infra-hdfs/pom.xml                   |  6 ------
 ...ainerLocalHDFSService.java => EmbeddedHDFSService.java} | 12 +++---------
 .../camel/test/infra/hdfs/v2/services/HDFSContainer.java   | 14 +++++++-------
 .../test/infra/hdfs/v2/services/HDFSServiceFactory.java    |  2 +-
 4 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/test-infra/camel-test-infra-hdfs/pom.xml b/test-infra/camel-test-infra-hdfs/pom.xml
index 6cb33deabf0..98f6eb14b85 100644
--- a/test-infra/camel-test-infra-hdfs/pom.xml
+++ b/test-infra/camel-test-infra-hdfs/pom.xml
@@ -44,12 +44,6 @@
             <scope>test</scope>
         </dependency>
 
-        <dependency>
-            <groupId>org.testcontainers</groupId>
-            <artifactId>testcontainers</artifactId>
-            <version>${testcontainers-version}</version>
-        </dependency>
-
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-minicluster</artifactId>
diff --git a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/ContainerLocalHDFSService.java b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java
similarity index 79%
rename from test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/ContainerLocalHDFSService.java
rename to test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java
index 19adad6f636..b6d81275b0c 100644
--- a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/ContainerLocalHDFSService.java
+++ b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/EmbeddedHDFSService.java
@@ -17,15 +17,14 @@
 
 package org.apache.camel.test.infra.hdfs.v2.services;
 
-import org.apache.camel.test.infra.common.services.ContainerService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ContainerLocalHDFSService implements HDFSService, ContainerService<HDFSContainer> {
-    private static final Logger LOG = LoggerFactory.getLogger(ContainerLocalHDFSService.class);
+public class EmbeddedHDFSService implements HDFSService {
+    private static final Logger LOG = LoggerFactory.getLogger(EmbeddedHDFSService.class);
     private final HDFSContainer container;
 
-    public ContainerLocalHDFSService() {
+    public EmbeddedHDFSService() {
         container = new HDFSContainer();
     }
 
@@ -39,11 +38,6 @@ public class ContainerLocalHDFSService implements HDFSService, ContainerService<
         return container.getPort();
     }
 
-    @Override
-    public HDFSContainer getContainer() {
-        return container;
-    }
-
     @Override
     public void initialize() {
         LOG.info("Trying to start the HDFS container");
diff --git a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java
index c5184d8553b..a5d5091786a 100644
--- a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java
+++ b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSContainer.java
@@ -19,13 +19,15 @@ package org.apache.camel.test.infra.hdfs.v2.services;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.testcontainers.containers.GenericContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class HDFSContainer extends GenericContainer {
+public class HDFSContainer {
+    private static final Logger LOG = LoggerFactory.getLogger(HDFSContainer.class);
 
     private MiniDFSCluster cluster;
 
-    @Override
+
     public void start() {
         try {
             Configuration conf = new Configuration();
@@ -36,22 +38,20 @@ public class HDFSContainer extends GenericContainer {
                     .format(true)
                     .build();
         } catch (Throwable e) {
-            logger().warn("Couldn't start HDFS cluster. Test is not started, but passed!", e);
+            LOG.warn("Couldn't start HDFS cluster. Test is not started, but passed!", e);
         }
     }
 
-    @Override
     public void stop() {
         try {
             if (cluster != null) {
                 cluster.shutdown();
             }
         } catch (Exception e) {
-            logger().warn("Error shutting down the HDFS container", e);
+            LOG.warn("Error shutting down the HDFS container", e);
         }
     }
 
-    @Override
     public String getHost() {
         return "localhost";
     }
diff --git a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java
index 597db426fa1..0433b19ce2f 100644
--- a/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java
+++ b/test-infra/camel-test-infra-hdfs/src/test/java/org/apache/camel/test/infra/hdfs/v2/services/HDFSServiceFactory.java
@@ -54,7 +54,7 @@ public final class HDFSServiceFactory {
         static final HDFSService INSTANCE;
         static {
             SimpleTestServiceBuilder<HDFSService> instance = builder();
-            instance.addLocalMapping(() -> new SingletonHDFSService(new ContainerLocalHDFSService(), "hdfs"));
+            instance.addLocalMapping(() -> new SingletonHDFSService(new EmbeddedHDFSService(), "hdfs"));
             INSTANCE = instance.build();
         }
     }