You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2024/01/02 15:51:29 UTC

(camel-quarkus) branch 3.2.x updated: Simplify greenmail container certificate setup

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

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


The following commit(s) were added to refs/heads/3.2.x by this push:
     new 962d1dcf9e Simplify greenmail container certificate setup
962d1dcf9e is described below

commit 962d1dcf9eb4fc25ebc26dbce7cd4bcdefbf4d27
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Jan 2 09:26:26 2024 +0000

    Simplify greenmail container certificate setup
---
 .../camel/quarkus/component/mail/MailTestResource.java       | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java
index b0139328e4..de31e0dfcb 100644
--- a/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java
+++ b/integration-tests/mail/src/test/java/org/apache/camel/quarkus/component/mail/MailTestResource.java
@@ -29,11 +29,12 @@ import org.eclipse.microprofile.config.ConfigProvider;
 import org.testcontainers.DockerClientFactory;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
-import org.testcontainers.images.builder.ImageFromDockerfile;
 import org.testcontainers.images.builder.Transferable;
 import org.testcontainers.utility.MountableFile;
 
 public class MailTestResource implements QuarkusTestResourceLifecycleManager {
+    private static final String GREENMAIL_IMAGE_NAME = ConfigProvider.getConfig().getValue("greenmail.container.image",
+            String.class);
     private static final String GREENMAIL_CERTIFICATE_STORE_FILE = "greenmail.p12";
     private static final String GENERATE_CERTIFICATE_SCRIPT = "generate-certificates.sh";
     private GenericContainer<?> container;
@@ -56,13 +57,8 @@ public class MailTestResource implements QuarkusTestResourceLifecycleManager {
             regenerateCertificatesForDockerHost();
         }
 
-        //Dockerfile with ImageFromDockerfile is used, because ownership of the certificate has to be changed
-        container = new GenericContainer<>(new ImageFromDockerfile()
-                .withDockerfileFromBuilder(builder -> {
-                    builder.from(ConfigProvider.getConfig().getValue("greenmail.container.image", String.class));
-                    builder.copy(GREENMAIL_CERTIFICATE_STORE_FILE, "/home/greenmail/greenmail.p12");
-                })
-                .withFileFromTransferable(GREENMAIL_CERTIFICATE_STORE_FILE, Transferable.of(getCertificateStoreContent())))
+        container = new GenericContainer<>(GREENMAIL_IMAGE_NAME)
+                .withCopyToContainer(Transferable.of(getCertificateStoreContent()), "/home/greenmail/greenmail.p12")
                 .withExposedPorts(MailProtocol.allPorts())
                 .waitingFor(new HttpWaitStrategy()
                         .forPort(MailProtocol.API.getPort())