james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [2/6] james-project git commit: JAMES-2039 Add integration testing for mail's preview with ISO-8859-1 encoding
Date Tue, 06 Jun 2017 08:28:51 GMT
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/2c85e949
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2c85e949
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2c85e949

Branch: refs/heads/master
Commit: 2c85e949f35df1e6bc31cbc9f2a1e9a52a379602
Parents: 747e671
Author: quynhn <qnguyen@linagora.com>
Authored: Wed May 31 15:34:59 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Jun 6 15:27:26 2017 +0700

----------------------------------------------------------------------
 .../cucumber/GetMessagesMethodStepdefs.java     | 11 +++++
 .../test/resources/cucumber/GetMessages.feature |  9 ++++
 .../src/test/resources/eml/iso8859_1charset.eml | 43 ++++++++++++++++++++
 3 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2c85e949/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 bde6f87..29af204 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
@@ -235,6 +235,11 @@ 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 Throwable
{
+        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,
@@ -486,6 +491,12 @@ public class GetMessagesMethodStepdefs {
         assertAttachment(SECOND_ATTACHMENT, attachmentProperties);
     }
 
+    @Then("^the preview of the message contains:$")
+    public void assertPreviewOfMessageShouldBePrintedWithEncoding(DataTable preview) throws
Throwable {
+        String actual = jsonPath.<String>read(FIRST_MESSAGE + ".preview");
+        assertThat(actual).contains(preview.asList(String.class));
+    }
+
     private void assertAttachment(String attachment, DataTable attachmentProperties) {
         attachmentProperties.asList(TableRow.class)
             .stream()

http://git-wip-us.apache.org/repos/asf/james-project/blob/2c85e949/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 f1ea2e7..23f8221 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
@@ -293,3 +293,12 @@ Feature: GetMessages method
     And the list should contain 1 message
     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
+    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|

http://git-wip-us.apache.org/repos/asf/james-project/blob/2c85e949/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
new file mode 100644
index 0000000..ed84e9e
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/iso8859_1charset.eml
@@ -0,0 +1,43 @@
+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-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message