Skip to content

Commit

Permalink
#1547: refactor logo path
Browse files Browse the repository at this point in the history
  • Loading branch information
lehju committed Apr 9, 2024
1 parent 328d321 commit 6abddca
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class MailAdapter implements MailOutPort {
private final DigiwfEmailApi digiwfEmailApi;

@Override
public void sendMail(Mail mail) throws MessagingException {
this.digiwfEmailApi.sendMail(mail);
public void sendMail(Mail mail, String logoPath) throws MessagingException {
this.digiwfEmailApi.sendMail(mail, logoPath);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public interface MailOutPort {

void sendMail(Mail mail) throws MessagingException;
void sendMail(Mail mail, String logoPath) throws MessagingException;

String getBodyFromTemplate(String templateName, Map<String, Object> content) throws TemplateException, IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void sendMailWithText(final String processInstanceIde, final String type,
de.muenchen.oss.digiwf.email.model.Mail mailModel = createMail(mail);
mailModel.setBody(mail.getBody());

this.sendMail(processInstanceIde, type, integrationName, mailModel);
this.sendMail(processInstanceIde, type, integrationName, mailModel, null);
}

@Override
Expand All @@ -58,7 +58,7 @@ public void sendMailWithTemplate(final String processInstanceIde, final String t
mailModel.setBody(body);
mailModel.setHtmlBody(true);

this.sendMail(processInstanceIde, type, integrationName, mailModel);
this.sendMail(processInstanceIde, type, integrationName, mailModel, "templates/email-logo.png");

} catch (IOException ioException) {
throw new BpmnError("LOAD_TEMPLATE_FAILED", "The template " + mail.getTemplate() + " could not be loaded");
Expand Down Expand Up @@ -86,9 +86,9 @@ private de.muenchen.oss.digiwf.email.model.Mail createMail(BasicMail mail) {
.build();
}

private void sendMail(final String processInstanceIde, final String type, final String integrationName, de.muenchen.oss.digiwf.email.model.Mail mailModel) throws BpmnError {
private void sendMail(final String processInstanceIde, final String type, final String integrationName, de.muenchen.oss.digiwf.email.model.Mail mailModel, String logoPath) throws BpmnError {
try {
this.mailOutPort.sendMail(mailModel);
this.mailOutPort.sendMail(mailModel, logoPath);
// correlate message
final Map<String, Object> correlatePayload = new HashMap<>();
correlatePayload.put("mailSentStatus", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ void sendMail() throws MessagingException {
.receiversCc("receiversCc")
.receiversBcc("receiversBcc")
.build();
mailAdapter.sendMail(mail);
verify(digiwfEmailApi).sendMail(mail);
mailAdapter.sendMail(mail,"logoPath");
verify(digiwfEmailApi).sendMail(mail, "logoPath");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void sendMail() throws MessagingException {
.receiversBcc(mail.getReceiversBcc())
.attachments(List.of())
.build();
verify(mailOutPort).sendMail(mailOutModel);
verify(mailOutPort).sendMail(mailOutModel, null);
verify(correlateMessageOutPort).correlateMessage(processInstanceId, type, integrationName, Map.of("mailSentStatus", true));
}

Expand All @@ -110,13 +110,13 @@ void sendMailWithAttachments() throws MessagingException {
.receiversBcc(mail.getReceiversBcc())
.attachments(List.of(fileAttachment))
.build();
verify(mailOutPort).sendMail(mailOutModel);
verify(mailOutPort).sendMail(mailOutModel, null);
verify(correlateMessageOutPort).correlateMessage(processInstanceId, type, integrationName, Map.of("mailSentStatus", true));
}

@Test
void sendMailThrowsBpmnError() throws MessagingException {
doThrow(new MessagingException("Test Exception")).when(mailOutPort).sendMail(any());
doThrow(new MessagingException("Test Exception")).when(mailOutPort).sendMail(any(), any());
assertThatThrownBy(() -> sendMailInPort.sendMailWithText(processInstanceId, type, integrationName, mail)).isInstanceOf(BpmnError.class);
}

Expand All @@ -134,7 +134,7 @@ void sendMailWithTemplate() throws MessagingException, TemplateException, IOExce
.receiversBcc(mail.getReceiversBcc())
.attachments(List.of())
.build();
verify(mailOutPort).sendMail(mailOutModel);
verify(mailOutPort).sendMail(mailOutModel, "templates/email-logo.png");
verify(correlateMessageOutPort).correlateMessage(processInstanceId, type, integrationName, Map.of("mailSentStatus", true));
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<table cellspacing="0" cellpadding="0" border="0" align="center" width="600" style="margin: auto;" class="email-container">
<tr>
<td style="padding: 20px 0; text-align: center">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABeCAYAAABmZ1vAAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA4gSURBVHgB7d0JUFT3HQfwryIqUUExgko8UEEUUUAEROoVr5hEbIwxidomdqLTaI6e1mqnNlabZJI0xmkOrUkTa5I6UeOFgiKsyimoeOKBVxBFAS/kFOz/t8+VZYBd3nu77Hvw+8w4PNi3iS773f/9/7fo0cPrARhjdWoJxli9OCCMWcABYcwCDghjFrQCq9P0sRXwdnD/xfHsVohO4s8wR+KA1OPZEbcxOrgMjrQxoaMISDswx+GPJ8Ys4BLEDkpEwXMuB7hwBSgtB1zaAr49gD5PAM5OYDrCAbGRykpg+wFgdxqwIxG4f7/2PZ1cRdtmHDD7KaB3NzAd4IDYQPIxYPmXQObZmj9vJUoLJ1GJLauQvr95B1i9CfhmO/DHXwCvTQXTOA6ICtTHRW/4FV8BVQ+kQEweAYwNAUIGAr26SvddvwmknQD2HxEN7zip2vXOv4H8W8CiV8A0jAOiwsffAR+tl66H+IigzAcG96t9n0cn4JlI6c9rUcDvPwEyTgGf/gD0FW2TF54E0yjuxVJo417gn99K1+PCgO9X1AzHfdEmyboI3LlX83n9RCC+WQoMHSh9/8E6UQUrB9MoDogChaItsUy0OR6IapWPeMOv/C3Q3kV6rFS0N97/BgieDYxfAATOFNWofwHfxQJhrwKvvw+4iqGNd+ZK91/NBzYbwDSKA6LA2q1AwS3peuEvpTc8uVcKzF0OrNoAtBDfvyB6rLy7A//dCbz7NZB7Q5QgT0j3UmkzJ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tT/Wg2QeERnJZbTSB0J4SE7U7vcSc7gPSurW6k2y1uEhHC5Quw20ImjV84oSyA3wam+4D4ubWEWp06dIFrDaaYWuvNgKVHlraHM4S3Qekg4XNyxqic+fOqo5vaKoqK+8jISEe9qB0Wr0jNPs2CK2Ge/756WC1KT3H0BKq0iYnaX/8w0T3Abl1+xbUWrDgDYt7zdKpSnJ3CWwKlE5ctIR6xwoKC6AXuv+t075WatES0S1btho/Me/cufPo5x07usG9kzs8PD1FiOZjx47taE5o4mJBQYGxGmoreqpeEd0HJC9PfUAILROta4eO5oyqQ3v27MaMGS/CVpQeHuoouq9i5eRcBrMfpdPf60KlvV4GCE10H5CYmBjjBszMPuLjbdeTRW0avXTvmug+ILdv38a2bVvB7OPSpYu4cuUKbCEtTV+lB2kS3bzr1q1TtNkAs45eVzr1yRb/HYNBe5tTW9MkAkKnJK1c+TGYfZw+nQW1aBFWbm4u9KbJDBRSQFav/gLM9mwxoq7H0oM0mYBQEb58+d+N54lcvsw9W7ZEn/xqe7Msna+iZS169PBS1a0wc+YsODsrH045efKkzdce0LkVUVFTjWukaSsa2q9JDVo8NG/eXNGjo43zu+nIARcXFyhx/ny2cf8ruXx8fOHh4QGlaPVgZaX8c1RonlxQUP1HvVlDx1yrmbGtOiBaR3OtevXshcCgIDEi7A5XVzdjgOjnpt0ATegXSF3G1DNWVHRXjLFcwdGjmcbtbHhafPPU5APCmBq85JYxCzggjFnAAWHMAg4IYxZwQBizgAPCmAUcEMYs4IAwZgEHhDELWlVV4VUwxur0f6NRgX4EUZsxAAAAAElFTkSuQmCC" width="200" height="94" alt="itm_logo" border="0">
<img src="cid:logo" width="200" alt="itm_logo" border="0">
</td>
</tr>
</table>
Expand Down

0 comments on commit 6abddca

Please sign in to comment.