You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/06/14 07:24:12 UTC

[james-project] branch master updated (5834996ba2 -> 55afb3235c)

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

btellier pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


    from 5834996ba2 [DOCUMENTATION] Fix some broken links in README.adoc (#1591)
     new c0f54afd00 [CLEAN CODE] data-ldap test - avoid start twice ldap container
     new 207d9cb7f4 [CLEAN CODE] Replace dinkel/openldap -> osixia/openldap in test (no maintained long time)
     new ce3faf0f32 [CLEAN CODE] Remove unused SpamAssassinWaitStrategy class
     new 55afb3235c Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest

The 4 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:
 .../src/test/resources/ldif-files/Dockerfile       |  3 -
 .../blob/objectstorage/aws/S3BlobStoreDAOTest.java |  3 +-
 .../james/user/ldap/DockerLdapSingleton.java       |  3 -
 .../james/user/ldap/LdapGenericContainer.java      | 48 +++++++++-------
 .../james/user/ldap/LdapHealthCheckTest.java       | 10 +---
 .../ReadOnlyUsersLDAPRepositoryEmptyListTest.java  |  5 +-
 .../user/ldap/ReadOnlyUsersLDAPRepositoryTest.java | 14 ++---
 .../test/resources/invalid/ldif-files/Dockerfile   |  3 -
 .../src/test/resources/ldif-files/Dockerfile       |  3 -
 .../apache/james/util/docker/DockerContainer.java  | 18 +++++-
 .../java/org/apache/james/util/docker/Images.java  |  1 +
 .../spamassassin/SpamAssassinWaitStrategy.java     | 67 ----------------------
 12 files changed, 56 insertions(+), 122 deletions(-)
 delete mode 100644 server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile
 delete mode 100644 server/data/data-ldap/src/test/resources/invalid/ldif-files/Dockerfile
 delete mode 100644 server/data/data-ldap/src/test/resources/ldif-files/Dockerfile
 delete mode 100644 third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[james-project] 02/04: [CLEAN CODE] Replace dinkel/openldap -> osixia/openldap in test (no maintained long time)

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 207d9cb7f48aeb4e6ad26307396822ef81e7d1e7
Author: Tung Tran <vt...@linagora.com>
AuthorDate: Wed Jun 7 16:06:56 2023 +0700

    [CLEAN CODE] Replace dinkel/openldap -> osixia/openldap in test (no maintained long time)
---
 .../src/test/resources/ldif-files/Dockerfile       |  3 --
 .../james/user/ldap/LdapGenericContainer.java      | 48 +++++++++++++---------
 .../user/ldap/ReadOnlyUsersLDAPRepositoryTest.java |  4 +-
 .../test/resources/invalid/ldif-files/Dockerfile   |  3 --
 .../src/test/resources/ldif-files/Dockerfile       |  3 --
 .../apache/james/util/docker/DockerContainer.java  | 18 +++++++-
 .../java/org/apache/james/util/docker/Images.java  |  1 +
 7 files changed, 48 insertions(+), 32 deletions(-)

diff --git a/server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile b/server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile
deleted file mode 100644
index d889a35fb7..0000000000
--- a/server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM dinkel/openldap:latest
-
-COPY populate.ldif /etc/ldap/prepopulate/prepop.ldif
diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java
index 2182311b12..335e2d65a6 100644
--- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java
+++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java
@@ -18,16 +18,21 @@
  ****************************************************************/
 package org.apache.james.user.ldap;
 
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
+import java.time.Duration;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.apache.http.client.utils.URIBuilder;
 import org.apache.james.util.docker.DockerContainer;
-import org.apache.james.util.docker.RateLimiters;
+import org.apache.james.util.docker.Images;
 import org.junit.rules.ExternalResource;
-import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
-import org.testcontainers.images.builder.ImageFromDockerfile;
+import org.testcontainers.containers.BindMode;
+import org.testcontainers.containers.startupcheck.MinimumDurationRunningStartupCheckStrategy;
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
 
-import java.util.Optional;
-import java.util.UUID;
+import com.github.fge.lambdas.Throwing;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
 
 public class LdapGenericContainer extends ExternalResource {
 
@@ -67,17 +72,19 @@ public class LdapGenericContainer extends ExternalResource {
         }
 
         private DockerContainer createContainer() {
-            return DockerContainer.fromDockerfile(
-                new ImageFromDockerfile("openldap_" + UUID.randomUUID())
-                    .withFileFromClasspath("populate.ldif", dockerFilePrefix.orElse("") + "ldif-files/populate.ldif")
-                    .withFileFromClasspath("Dockerfile", dockerFilePrefix.orElse("") + "ldif-files/Dockerfile"))
+            return DockerContainer.fromName(Images.OPEN_LDAP)
+                .withClasspathResourceMapping(dockerFilePrefix.orElse("") + "ldif-files/populate.ldif",
+                    "/container/service/slapd/assets/config/bootstrap/ldif/data.ldif", BindMode.READ_ONLY)
                 .withAffinityToContainer()
-                .withEnv("SLAPD_DOMAIN", domain)
-                .withEnv("SLAPD_PASSWORD", password)
-                .withEnv("SLAPD_CONFIG_PASSWORD", password)
-                .withExposedPorts(LdapGenericContainer.DEFAULT_LDAP_PORT)
+                .withEnv("LDAP_DOMAIN", domain)
+                .withEnv("LDAP_ADMIN_PASSWORD", password)
+                .withEnv("LDAP_CONFIG_PASSWORD", password)
+                .withExposedPorts(DEFAULT_LDAP_PORT)
+                .withCommands("--copy-service", "--loglevel", "debug")
                 .withName("james-testing-openldap-" + UUID.randomUUID())
-                .waitingFor(new HostPortWaitStrategy().withRateLimiter(RateLimiters.TWENTIES_PER_SECOND));
+                .waitingFor(new LogMessageWaitStrategy().withRegEx(".*slapd starting\\n").withTimes(1)
+                    .withStartupTimeout(Duration.ofMinutes(3)))
+                .withStartupCheckStrategy(new MinimumDurationRunningStartupCheckStrategy(Duration.ofSeconds(10)));
         }
     }
 
@@ -116,10 +123,11 @@ public class LdapGenericContainer extends ExternalResource {
     }
 
     public String getLdapHost() {
-        return "ldap://" +
-                container.getContainerIp() +
-                ":" +
-                LdapGenericContainer.DEFAULT_LDAP_PORT;
+        return Throwing.supplier(() -> new URIBuilder()
+            .setScheme("ldap")
+            .setHost(container.getContainer().getHost())
+            .setPort(container.getMappedPort(DEFAULT_LDAP_PORT))
+            .build()).get().toString();
     }
 
     /**
diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java
index 7253854708..ab87a3b618 100644
--- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java
+++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java
@@ -490,8 +490,8 @@ class ReadOnlyUsersLDAPRepositoryTest {
         configuration.addProperty("[@credentials]", ADMIN_PASSWORD);
         configuration.addProperty("[@userBase]", "ou=people,dc=james,dc=org");
         configuration.addProperty("[@userObjectClass]", "inetOrgPerson");
-        configuration.addProperty("[@connectionTimeout]", "100");
-        configuration.addProperty("[@readTimeout]", "100");
+        configuration.addProperty("[@connectionTimeout]", "2000");
+        configuration.addProperty("[@readTimeout]", "2000");
         return configuration;
     }
 }
diff --git a/server/data/data-ldap/src/test/resources/invalid/ldif-files/Dockerfile b/server/data/data-ldap/src/test/resources/invalid/ldif-files/Dockerfile
deleted file mode 100644
index d889a35fb7..0000000000
--- a/server/data/data-ldap/src/test/resources/invalid/ldif-files/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM dinkel/openldap:latest
-
-COPY populate.ldif /etc/ldap/prepopulate/prepop.ldif
diff --git a/server/data/data-ldap/src/test/resources/ldif-files/Dockerfile b/server/data/data-ldap/src/test/resources/ldif-files/Dockerfile
deleted file mode 100644
index 7e3b0b473f..0000000000
--- a/server/data/data-ldap/src/test/resources/ldif-files/Dockerfile
+++ /dev/null
@@ -1,3 +0,0 @@
-FROM dinkel/openldap:latest
-
-COPY populate.ldif /etc/ldap.dist/prepopulate/prepop.ldif
diff --git a/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java b/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java
index 169ee804fc..c4c271e852 100644
--- a/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java
+++ b/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java
@@ -35,10 +35,12 @@ import org.junit.runners.model.Statement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.DockerClientFactory;
+import org.testcontainers.containers.BindMode;
 import org.testcontainers.containers.Container;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.Network;
 import org.testcontainers.containers.output.OutputFrame;
+import org.testcontainers.containers.startupcheck.StartupCheckStrategy;
 import org.testcontainers.containers.wait.strategy.WaitStrategy;
 import org.testcontainers.images.builder.ImageFromDockerfile;
 
@@ -86,6 +88,16 @@ public class DockerContainer implements TestRule, BeforeAllCallback, AfterAllCal
         return this;
     }
 
+    public DockerContainer withClasspathResourceMapping(String resourcePath, String containerPath, BindMode mode) {
+        container.withClasspathResourceMapping(resourcePath, containerPath, mode);
+        return this;
+    }
+
+    public DockerContainer withStartupCheckStrategy(StartupCheckStrategy strategy) {
+        container.withStartupCheckStrategy(strategy);
+        return this;
+    }
+
     public DockerContainer withNetwork(Network network) {
         container.withNetwork(network);
         return this;
@@ -137,7 +149,7 @@ public class DockerContainer implements TestRule, BeforeAllCallback, AfterAllCal
     }
 
     public Container.ExecResult exec(String... command) throws IOException, InterruptedException {
-       return container.execInContainer(command);
+        return container.execInContainer(command);
     }
 
     public void start() {
@@ -164,6 +176,10 @@ public class DockerContainer implements TestRule, BeforeAllCallback, AfterAllCal
         return container.getMappedPort(originalPort);
     }
 
+    public GenericContainer<?> getContainer() {
+        return container;
+    }
+
     @SuppressWarnings("deprecation")
     public String getContainerIp() {
         return container.getContainerInfo()
diff --git a/server/testing/src/main/java/org/apache/james/util/docker/Images.java b/server/testing/src/main/java/org/apache/james/util/docker/Images.java
index 13c11ad521..fd55e97646 100644
--- a/server/testing/src/main/java/org/apache/james/util/docker/Images.java
+++ b/server/testing/src/main/java/org/apache/james/util/docker/Images.java
@@ -28,4 +28,5 @@ public interface Images {
     String OPENSEARCH = "opensearchproject/opensearch:2.4.0";
     String TIKA = "apache/tika:1.28.2";
     String MOCK_SMTP_SERVER = "linagora/mock-smtp-server:0.6";
+    String OPEN_LDAP = "osixia/openldap:1.5.0";
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[james-project] 04/04: Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 55afb3235c3de5d8f06c9b0f752e131eef4efe8b
Author: Tung Tran <vt...@linagora.com>
AuthorDate: Thu Jun 8 16:26:40 2023 +0700

    Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest
---
 .../org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
index 5f19f46694..43b7cf7818 100644
--- a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
+++ b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java
@@ -82,7 +82,8 @@ public class S3BlobStoreDAOTest implements BlobStoreDAOContract {
 
         final int count = 1500;
         Flux.range(0, count)
-            .flatMap(i -> store.save(TEST_BUCKET_NAME, new TestBlobId("test-blob-id-" + i), ByteSource.wrap(ELEVEN_KILOBYTES)))
+            .concatMap(i -> store.save(TEST_BUCKET_NAME, new TestBlobId("test-blob-id-" + i),
+                ByteSource.wrap(ELEVEN_KILOBYTES)))
             .blockLast();
 
         assertThat(Flux.from(testee().listBlobs(TEST_BUCKET_NAME)).count().block())


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[james-project] 01/04: [CLEAN CODE] data-ldap test - avoid start twice ldap container

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit c0f54afd004d0d39cfe2386732a136428fc416f4
Author: Tung Tran <vt...@linagora.com>
AuthorDate: Wed Jun 7 10:17:46 2023 +0700

    [CLEAN CODE] data-ldap test - avoid start twice ldap container
---
 .../java/org/apache/james/user/ldap/DockerLdapSingleton.java   |  3 ---
 .../java/org/apache/james/user/ldap/LdapHealthCheckTest.java   | 10 ++--------
 .../user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java    |  5 +----
 .../james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java       | 10 +++-------
 4 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java
index 9de0fa7107..262101484d 100644
--- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java
+++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java
@@ -34,7 +34,4 @@ public class DockerLdapSingleton {
         .password(ADMIN_PASSWORD)
         .build();
 
-    static {
-        ldapContainer.start();
-    }
 }
diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java
index 61c2d8f3c0..f0204c3c5a 100644
--- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java
+++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java
@@ -18,8 +18,6 @@
  ****************************************************************/
 package org.apache.james.user.ldap;
 
-import static org.apache.james.user.ldap.DockerLdapSingleton.ADMIN_PASSWORD;
-import static org.apache.james.user.ldap.DockerLdapSingleton.DOMAIN;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.james.core.healthcheck.Result;
@@ -30,13 +28,9 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 class LdapHealthCheckTest {
-    static LdapGenericContainer ldapContainer = LdapGenericContainer.builder()
-        .domain(DOMAIN)
-        .password(ADMIN_PASSWORD)
-        .build();
-
-    LdapHealthCheck ldapHealthCheck;
 
+    static LdapGenericContainer ldapContainer = DockerLdapSingleton.ldapContainer;
+    private LdapHealthCheck ldapHealthCheck;
     @BeforeAll
     static void setUpAll() {
         ldapContainer.start();
diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java
index 0f9e17c35a..90cb77aed6 100644
--- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java
+++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java
@@ -39,10 +39,7 @@ import org.junit.jupiter.api.Test;
 import com.google.common.collect.ImmutableList;
 
 class ReadOnlyUsersLDAPRepositoryEmptyListTest {
-    static LdapGenericContainer ldapContainer = LdapGenericContainer.builder()
-        .domain(DOMAIN)
-        .password(ADMIN_PASSWORD)
-        .build();
+    static LdapGenericContainer ldapContainer = DockerLdapSingleton.ldapContainer;
 
     DomainList domainList;
     private ReadOnlyUsersLDAPRepository ldapRepository;
diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java
index 01d791f665..7253854708 100644
--- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java
+++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java
@@ -26,7 +26,6 @@ import static org.apache.james.user.ldap.DockerLdapSingleton.DOMAIN;
 import static org.apache.james.user.ldap.DockerLdapSingleton.JAMES_USER;
 import static org.apache.james.user.ldap.DockerLdapSingleton.PASSWORD;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.Optional;
@@ -63,10 +62,7 @@ class ReadOnlyUsersLDAPRepositoryTest {
     static final String BAD_PASSWORD = "badpassword";
     public static final String SUPPORTS_VIRTUAL_HOSTING = "supportsVirtualHosting";
 
-    static LdapGenericContainer ldapContainer = LdapGenericContainer.builder()
-        .domain(DOMAIN)
-        .password(ADMIN_PASSWORD)
-        .build();
+    static LdapGenericContainer ldapContainer = DockerLdapSingleton.ldapContainer;
 
     @BeforeAll
     static void setUpAll() {
@@ -245,13 +241,13 @@ class ReadOnlyUsersLDAPRepositoryTest {
         void testShouldStillWorkAfterRestartingLDAP() throws Exception {
             usersRepository.test(JAMES_USER_MAIL, PASSWORD);
 
-            DockerLdapSingleton.ldapContainer.pause();
+            ldapContainer.pause();
             try {
                 usersRepository.test(JAMES_USER_MAIL, PASSWORD);
             } catch (Exception e) {
                 LOGGER.info("This exception is expected as we shut down the LDAP and forced its use", e);
             }
-            DockerLdapSingleton.ldapContainer.unpause();
+            ldapContainer.unpause();
 
             assertThat(usersRepository.test(JAMES_USER_MAIL, PASSWORD)).isTrue();
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[james-project] 03/04: [CLEAN CODE] Remove unused SpamAssassinWaitStrategy class

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit ce3faf0f32380a207f9f289fe869a850673f26dc
Author: Tung Tran <vt...@linagora.com>
AuthorDate: Wed Jun 7 16:09:27 2023 +0700

    [CLEAN CODE] Remove unused SpamAssassinWaitStrategy class
---
 .../spamassassin/SpamAssassinWaitStrategy.java     | 67 ----------------------
 1 file changed, 67 deletions(-)

diff --git a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java b/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java
deleted file mode 100644
index 8947a2cbfd..0000000000
--- a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************
- * 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.james.spamassassin;
-
-import java.io.IOException;
-import java.time.Duration;
-import java.util.concurrent.TimeUnit;
-
-import org.rnorth.ducttape.unreliables.Unreliables;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.wait.strategy.WaitStrategy;
-import org.testcontainers.containers.wait.strategy.WaitStrategyTarget;
-
-import com.google.common.primitives.Ints;
-
-public class SpamAssassinWaitStrategy implements WaitStrategy {
-
-    private static final Duration DEFAULT_TIMEOUT = Duration.ofMinutes(1);
-    private final GenericContainer<?> spamAssassinContainer;
-    private final Duration timeout;
-
-    public SpamAssassinWaitStrategy(GenericContainer<?> spamAssassinContainer) {
-        this(spamAssassinContainer, DEFAULT_TIMEOUT);
-    }
-
-    public SpamAssassinWaitStrategy(GenericContainer<?> spamAssassinContainer, Duration timeout) {
-        this.spamAssassinContainer = spamAssassinContainer;
-        this.timeout = timeout;
-    }
-
-    @Override
-    public void waitUntilReady(WaitStrategyTarget waitStrategyTarget) {
-        Unreliables.retryUntilTrue(Ints.checkedCast(timeout.getSeconds()), TimeUnit.SECONDS, () -> {
-                try {
-                    return spamAssassinContainer
-                        .execInContainer("spamassassin", "-V")
-                        .getStdout()
-                        .contains("SpamAssassin version 3.4.2");
-                } catch (IOException | InterruptedException e) {
-                    return false;
-                }
-            }
-        );
-    }
-
-    @Override
-    public WaitStrategy withStartupTimeout(Duration startupTimeout) {
-        return new SpamAssassinWaitStrategy(spamAssassinContainer, startupTimeout);
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org