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:57 UTC

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

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();
         }
     }