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

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


The following commit(s) were added to refs/heads/main by this push:
     new b2ed079649 Simplify greenmail container certificate setup
b2ed079649 is described below

commit b2ed07964948c1475307e4bd82b27405d036ce0a
Author: James Netherton <[email protected]>
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())

Reply via email to