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 d52b843e1b Set explicit path for regenerated mail test certificates
and add debug logging
d52b843e1b is described below
commit d52b843e1b5ce029d3152ab3586b027f38bc6457
Author: James Netherton <[email protected]>
AuthorDate: Wed Feb 7 11:15:44 2024 +0000
Set explicit path for regenerated mail test certificates and add debug
logging
---
.../camel/quarkus/component/mail/MailTestResource.java | 13 +++++++++++--
.../mail/src/test/resources/generate-certificates.sh | 8 +++++++-
2 files changed, 18 insertions(+), 3 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 de31e0dfcb..a121a51cbb 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
@@ -26,13 +26,16 @@ import java.util.Map;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import org.apache.commons.io.FileUtils;
import org.eclipse.microprofile.config.ConfigProvider;
+import org.jboss.logging.Logger;
import org.testcontainers.DockerClientFactory;
+import org.testcontainers.containers.Container.ExecResult;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.images.builder.Transferable;
import org.testcontainers.utility.MountableFile;
public class MailTestResource implements QuarkusTestResourceLifecycleManager {
+ private static final Logger LOG = Logger.getLogger(MailTestResource.class);
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";
@@ -109,8 +112,14 @@ public class MailTestResource implements
QuarkusTestResourceLifecycleManager {
container.copyFileToContainer(
MountableFile.forClasspathResource(GENERATE_CERTIFICATE_SCRIPT),
"/" + GENERATE_CERTIFICATE_SCRIPT);
- container.execInContainer("/bin/bash", "/" +
GENERATE_CERTIFICATE_SCRIPT, host,
- "DNS:%s,IP:%s".formatted(host, host));
+ ExecResult result = container.execInContainer("/bin/bash", "/" +
GENERATE_CERTIFICATE_SCRIPT, host,
+ "DNS:%s,IP:%s".formatted(host, host), "/" +
GREENMAIL_CERTIFICATE_STORE_FILE);
+
+ LOG.info(GENERATE_CERTIFICATE_SCRIPT + " - STDOUT:");
+ LOG.info(result.getStdout());
+ LOG.info(GENERATE_CERTIFICATE_SCRIPT + " - STDERR:");
+ LOG.info(result.getStderr());
+
container.copyFileFromContainer("/" +
GREENMAIL_CERTIFICATE_STORE_FILE,
certificateStoreLocation.resolve(GREENMAIL_CERTIFICATE_STORE_FILE).toString());
} catch (Exception e) {
diff --git a/integration-tests/mail/src/test/resources/generate-certificates.sh
b/integration-tests/mail/src/test/resources/generate-certificates.sh
index 1312616071..d36cf81c9a 100755
--- a/integration-tests/mail/src/test/resources/generate-certificates.sh
+++ b/integration-tests/mail/src/test/resources/generate-certificates.sh
@@ -19,8 +19,14 @@
export CN=${1:-localhost}
export SUBJECT_ALT_NAMES=${2:-"DNS:localhost,IP:127.0.0.1"}
+export CERT_OUTPUT_FILE=${3:-greenmail.p12}
+
+echo "====> PWD = ${PWD}"
+echo "====> CN = ${CN}"
+echo "====> SUBJECT_ALT_NAMES = ${SUBJECT_ALT_NAMES}"
+echo "====> CERT_OUTPUT_FILE = ${CERT_OUTPUT_FILE}"
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout
greenmail.key -out greenmail.crt -subj "/CN=${CN}" -addext
"subjectAltName=${SUBJECT_ALT_NAMES}"
-openssl pkcs12 -export -out greenmail.p12 -inkey greenmail.key -in
greenmail.crt -password pass:changeit
+openssl pkcs12 -export -out ${CERT_OUTPUT_FILE} -inkey greenmail.key -in
greenmail.crt -password pass:changeit
rm -f *.crt *.key