[prev in list] [next in list] [prev in thread] [next in thread] 

List:       james-dev
Subject:    [1/3] james-project git commit: JAMES-1872 Add integration test for JMAP for getting messages using 
From:       btellier () apache ! org
Date:       2017-03-30 4:28:50
Message-ID: 859d5c7f28da44fb9009f7f9aaa4a2bd () git ! apache ! org
[Download RAW message or body]

Repository: james-project
Updated Branches:
  refs/heads/master 699e9ffd9 -> 84fb8f6ca


JAMES-1872 Add integration test for JMAP for getting messages using two times the \
same CID


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/84fb8f6c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/84fb8f6c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/84fb8f6c

Branch: refs/heads/master
Commit: 84fb8f6ca47b054be12a1328534a9c1ec8713ad9
Parents: 2c1ef3b
Author: Quynh Nguyen <qnguyen@linagora.com>
Authored: Mon Mar 27 14:23:04 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Thu Mar 30 11:28:03 2017 +0700

----------------------------------------------------------------------
 .../cucumber/GetMessagesMethodStepdefs.java        | 17 +++++++++++++----
 .../test/resources/cucumber/GetMessages.feature    | 12 ++++++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/84fb8f6c/server/protocols/jm \
ap-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/j \
ava/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java \
                index c097957..c88b52e 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/te \
st/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
                
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/te \
st/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
 @@ -218,13 +218,18 @@ public class GetMessagesMethodStepdefs {
         appendMessage(messageName, "eml/htmlBodyWithManyEmptyTags.eml");
     }
 
+    @Given("^the user has a message \"([^\"]*)\" in the \"([^\"]*)\" mailbox with \
multiple same inlined attachments \"([^\"]*)\"$") +    public void \
appendMessageWithSameInlinedAttachmentsToMailbox(String messageName, String mailbox, \
String attachmentId) throws Throwable { +        appendMessage(messageName, \
"eml/sameInlinedImages.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,
                
-                new MailboxPath(MailboxConstants.USER_NAMESPACE, \
userStepdefs.lastConnectedUser, DefaultMailboxes.INBOX), +            new \
MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, \
DefaultMailboxes.INBOX),  ClassLoader.getSystemResourceAsStream(emlFileName),
                 Date.from(dateTime.toInstant()), false, new Flags())
-                .getMessageId();
+                    .getMessageId();
         messageIdsByName.put(messageName, id);
     }
 
@@ -260,7 +265,7 @@ public class GetMessagesMethodStepdefs {
     public void requestUnknownMessage() throws Throwable {
         askMessages(ImmutableList.of(mainStepdefs.messageIdFactory.generate()));
     }
-    
+
     private void askMessages(List<MessageId> messageIds) throws Exception {
         requestedMessageIds = messageIds;
         String serializedIds = requestedMessageIds.stream()
@@ -372,7 +377,6 @@ public class GetMessagesMethodStepdefs {
                 .serialize()))
             .distinct()
             .collect(Guavate.toImmutableList());
-
         assertThat(jsonPath.<JSONArray>read(FIRST_MESSAGE + ".mailboxIds"))
             .hasSize(2)
             .containsOnlyElementsOf(values);
@@ -446,6 +450,11 @@ public class GetMessagesMethodStepdefs {
         assertThat(jsonPath.<List<Object>>read(ATTACHMENTS)).hasSize(numberOfAttachments);
  }
 
+    @Then("^the list of attachments of the message contains only one attachment with \
cid \"([^\"]*)\"?$") +    public void assertAttachmentsAndItsCid(String cid) throws \
Throwable { +        assertThat(jsonPath.<String>read(FIRST_ATTACHMENT + \
".cid")).isEqualTo(cid); +    }
+
     @Then("^the first attachment is:$")
     public void assertFirstAttachment(DataTable attachmentProperties) throws \
Throwable {  assertAttachment(FIRST_ATTACHMENT, attachmentProperties);

http://git-wip-us.apache.org/repos/asf/james-project/blob/84fb8f6c/server/protocols/jm \
ap-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 5a860ee..0018491 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
 @@ -128,7 +128,7 @@ Feature: GetMessages method
     Then no error is returned
     And the list of messages is empty
     And the notFound list should contain the requested message id
-    
+
   Scenario: Retrieving message should return mandatory properties when not asked
     Given the user has a message "m1" in "INBOX" mailbox with subject "my test \
subject", content "testmail"  When the user is getting messages "m1" with properties \
"subject" @@ -210,7 +210,7 @@ Feature: GetMessages method
     And the list should contain 1 message
     And the textBody of the message is "Hello text body\n"
     And the htmlBody of the message is "<html>Hello html body</html>\n"
-    
+
   Scenario: Retrieving message with more than 1000 char by line should return \
                message when exists
     Given the user has a message "m1" in "INBOX" mailbox beginning by a long line
     When the user ask for messages "m1"
@@ -268,3 +268,11 @@ Feature: GetMessages method
     Then no error is returned
     And the list should contain 1 message
     And the preview of the message is not empty
+
+  Scenario: Retrieving message which contains multiple same inlined attachments
+    Given the user has a message "m1" in the "inbox" mailbox with multiple same \
inlined attachments "ia1" +    When the user ask for messages "m1"
+    Then no error is returned
+    And the list should contain 1 message
+    And the hasAttachment of the message is "false"
+    And the list of attachments of the message contains only one attachment with cid \
"1482981567586480bfca67b793175279@linagora.com"


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic