-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mail-connector): Adding Dropdown for Outbound Connector to switc…
…h content type between plain text and html (#3569) * feat(smpt-outbound-connector): adding drop down to distinguish between mime type of plain text or html to send html templates * fix: formating of code * chore: generate template and use an enum and backwards compatible * chore: adding multipart to dropdown and change content type to mutlipart mixed * feat(email-connector): correct PR to add multipart and HTML in the body * feat(email-connector):change labels * feat(email-connector): make Multipart work correctly for email connector * others(tests-email-connector): add a tests and correct a test function * others(email-connector): fixes after rebase * others(email-connector): fixes after rebase 2 --------- Co-authored-by: Mathias Vandaele <[email protected]>
- Loading branch information
1 parent
bb91a09
commit 1aa3e05
Showing
10 changed files
with
355 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
classes = {TestConnectorRuntimeApplication.class}, | ||
properties = { | ||
"spring.main.allow-bean-definition-overriding=true", | ||
"camunda.connector.polling.enabled=false", | ||
}, | ||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@CamundaSpringProcessTest | ||
|
@@ -82,7 +83,7 @@ public void beforeEach() { | |
} | ||
|
||
@Test | ||
public void shouldSendSMTPEmail() { | ||
public void shouldSendSMTPTextEmail() { | ||
File elementTemplate = | ||
ElementTemplate.from(ELEMENT_TEMPLATE_PATH) | ||
.property("authentication.type", "simple") | ||
|
@@ -96,6 +97,7 @@ public void shouldSendSMTPEmail() { | |
.property("smtpFrom", "[email protected]") | ||
.property("smtpTo", "[email protected]") | ||
.property("smtpSubject", "subject") | ||
.property("contentType", "PLAIN") | ||
.property("smtpBody", "content") | ||
.property("resultExpression", RESULT_EXPRESSION_SEND_EMAIL) | ||
.writeTo(new File(tempDir, "template.json")); | ||
|
@@ -116,6 +118,42 @@ public void shouldSendSMTPEmail() { | |
assertThat(getPlainTextBody(message.getFirst())).isEqualTo("content"); | ||
} | ||
|
||
@Test | ||
public void shouldSendSMTPHtmlEmail() { | ||
File elementTemplate = | ||
ElementTemplate.from(ELEMENT_TEMPLATE_PATH) | ||
.property("authentication.type", "simple") | ||
.property("authentication.simpleAuthenticationUsername", "[email protected]") | ||
.property("authentication.simpleAuthenticationPassword", "password") | ||
.property("protocol", "smtp") | ||
.property("data.smtpPort", getUnsecureSmtpPort()) | ||
.property("data.smtpHost", LOCALHOST) | ||
.property("smtpCryptographicProtocol", "NONE") | ||
.property("data.smtpActionDiscriminator", "sendEmailSmtp") | ||
.property("smtpFrom", "[email protected]") | ||
.property("smtpTo", "[email protected]") | ||
.property("smtpSubject", "subject") | ||
.property("contentType", "HTML") | ||
.property("smtpHtmlBody", "<h1>content</h1>") | ||
.property("resultExpression", RESULT_EXPRESSION_SEND_EMAIL) | ||
.writeTo(new File(tempDir, "template.json")); | ||
|
||
BpmnModelInstance model = getBpmnModelInstance("sendEmailTask"); | ||
BpmnModelInstance updatedModel = getBpmnModelInstance(model, elementTemplate, "sendEmailTask"); | ||
var result = getZeebeTest(updatedModel); | ||
|
||
assertThat(result).isNotNull(); | ||
assertThat(result.getProcessInstanceEvent()).hasVariable("sent", true); | ||
|
||
assertTrue(super.waitForNewEmails(5000, 1)); | ||
List<Message> message = List.of(super.getLastReceivedEmails()); | ||
assertThat(message).isNotNull(); | ||
assertThat(getSenders(message.getFirst())).hasSize(1).first().isEqualTo("[email protected]"); | ||
assertThat(getReceivers(message.getFirst())).hasSize(1).first().isEqualTo("[email protected]"); | ||
assertThat(getSubject(message.getFirst())).isEqualTo("subject"); | ||
assertThat(getHtmlBody(message.getFirst())).isEqualTo("<h1>content</h1>"); | ||
} | ||
|
||
@Test | ||
public void shouldListPop3Email() { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.