Repository: james-project Updated Branches: refs/heads/master 747e67154 -> ffd836d54
fixup! JAMES-2039 Add integration testing for mail's preview with ISO-8859-1 encoding Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/dea0525f Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/dea0525f Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/dea0525f Branch: refs/heads/master Commit: dea0525f9d7d5e3a507e243f195e896a239ed99d Parents: dbf21a1 Author: quynhn <qngu...@linagora.com> Authored: Mon Jun 5 15:14:46 2017 +0700 Committer: benwa <btell...@linagora.com> Committed: Tue Jun 6 15:27:26 2017 +0700 ---------------------------------------------------------------------- .../cucumber/GetMessagesMethodStepdefs.java | 17 ++++---- .../test/resources/cucumber/GetMessages.feature | 13 +++--- .../src/test/resources/eml/iso8859_1charset.eml | 43 -------------------- 3 files changed, 17 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/dea0525f/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java index 357e8ae..107eaf3 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java @@ -122,6 +122,12 @@ public class GetMessagesMethodStepdefs { messageIdsByName.put(messageName, id); } + @Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with content-type \"([^\"]*)\" subject \"([^\"]*)\", content \"([^\"]*)\", headers$") + public void appendMessage(String messageName, String mailbox, String contentType, String subject, String content, DataTable headers) throws Exception { + MessageId id = appendMessage(mailbox, ContentType.from(contentType), subject, content, Optional.of(headers.asMap(String.class, String.class))); + messageIdsByName.put(messageName, id); + } + @Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with subject \"([^\"]*)\", content \"([^\"]*)\", headers$") public void appendMessage(String messageName, String mailbox, String subject, String content, DataTable headers) throws Exception { MessageId id = appendMessage(mailbox, ContentType.noContentType(), subject, content, Optional.of(headers.asMap(String.class, String.class))); @@ -235,11 +241,6 @@ public class GetMessagesMethodStepdefs { appendMessage(messageName, "eml/htmlWithLongAndComplicatedContent.eml"); } - @Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with iso charset") - public void appendMessageWithEncoding(String messageName, String mailbox) throws Exception { - appendMessage(messageName, "eml/iso8859_1charset.eml"); - } - private void appendMessage(String messageName, String emlFileName) throws Exception { ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z"); MessageId id = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(userStepdefs.lastConnectedUser, @@ -491,10 +492,10 @@ public class GetMessagesMethodStepdefs { assertAttachment(SECOND_ATTACHMENT, attachmentProperties); } - @Then("^the preview of the message contains:$") - public void assertPreviewOfMessageShouldBePrintedWithEncoding(DataTable preview) throws Exception { + @Then("^the preview of the message contains: (.*)$") + public void assertPreviewOfMessageShouldBePrintedWithEncoding(List<String> preview) throws Exception { String actual = jsonPath.<String>read(FIRST_MESSAGE + ".preview"); - assertThat(actual).contains(preview.asList(String.class)); + assertThat(actual).contains(preview); } private void assertAttachment(String attachment, DataTable attachmentProperties) { http://git-wip-us.apache.org/repos/asf/james-project/blob/dea0525f/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature index 23f8221..a0c4104 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature @@ -294,11 +294,14 @@ Feature: GetMessages method And the preview of the message is not empty And the preview should not contain consecutive spaces or blank characters - Scenario: Preview should display printable characters with iso charset - Given the user has a message "m1" in "INBOX" mailbox with iso charset + Scenario Outline: Preview should display printable characters with charset + Given the user has a message "m1" in "INBOX" mailbox with content-type <content-type> subject "Subject", content <content>, headers + |Content-Transfer-Encoding |<tranfer-encoding> | When the user ask for messages "m1" Then no error is returned And the list should contain 1 message - And the preview of the message is not empty - And the preview of the message contains: - |effectué|à |signée dès| + And the preview of the message contains: <preview> + + Examples: + |content-type |tranfer-encoding |content |preview | + |"text/html; charset=iso-8859-1" |quoted-printable |"Dans le cadre du stage effectu=E9 Mlle 2017, =E0 sign=E9e d=E8s que possible, =E0, tr=E8s, journ=E9e.." |effectué, à , signée dès, très, journée | http://git-wip-us.apache.org/repos/asf/james-project/blob/dea0525f/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/iso8859_1charset.eml ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/iso8859_1charset.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/iso8859_1charset.eml deleted file mode 100644 index ed84e9e..0000000 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/iso8859_1charset.eml +++ /dev/null @@ -1,43 +0,0 @@ -Return-Path: <test@local> -Received: from local -From: Test <test@local> -To: "Testee" <test@local> -Subject: Any subject -Date: Tue, 30 May 2017 10:06:35 +0000 -Message-ID: <2a338825f11d475bb97e82f064a41119@test.local> -Accept-Language: fr-FR, en-US -Content-Language: fr-FR -X-MS-Has-Attach: yes -X-MS-TNEF-Correlator: -x-ms-exchange-transport-fromentityheader: Hosted -x-originating-ip: [10.11.40.174] -Content-Type: multipart/mixed; - boundary="_006_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_" -MIME-Version: 1.0 - ---_006_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_ -Content-Type: multipart/related; - boundary="_005_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_"; - type="multipart/alternative" - ---_005_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_ -Content-Type: multipart/alternative; - boundary="_000_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_" - ---_000_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_ -Content-Type: text/plain; charset="iso-8859-1" -Content-Transfer-Encoding: quoted-printable - -Bonjour, - -Dans le cadre du stage effectu=E9 par ... 201=7, ... =E0= ... sign=E9e d=E8s que possible. - ---_000_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_ -Content-Type: text/html; charset="iso-8859-1" -Content-Transfer-Encoding: quoted-printable - -Bonjour, - -Dans le cadre du stage effectu=E9 par ... 201=7, ... =E0= ... sign=E9e d=E8s que possible. - ---_000_2a338825f11d475bb97e82f064a41119MBXCMC02resslocal_-- \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org