You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2016/07/08 10:59:16 UTC
[2/5] james-project git commit: JAMES-1791 Support inline attachments
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageAttachmentTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageAttachmentTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageAttachmentTest.java
new file mode 100644
index 0000000..5d8ebcd
--- /dev/null
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageAttachmentTest.java
@@ -0,0 +1,100 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import com.google.common.base.Optional;
+
+public class MessageAttachmentTest {
+
+ @Test(expected=IllegalStateException.class)
+ public void buildShouldThrowWhenAttachmentIsNotGiven() {
+ MessageAttachment.builder()
+ .build();
+ }
+
+ @Test(expected=IllegalArgumentException.class)
+ public void builderShouldThrowWhenAttachmentIsNull() {
+ MessageAttachment.builder()
+ .attachment(null);
+ }
+
+ @Test
+ public void buildShouldWorkWhenMandatoryAttributesAreGiven() {
+ Attachment attachment = Attachment.builder()
+ .bytes("content".getBytes())
+ .type("type")
+ .build();
+ MessageAttachment expectedMessageAttachment = new MessageAttachment(attachment, Optional.<String> absent(), false);
+
+ MessageAttachment messageAttachment = MessageAttachment.builder()
+ .attachment(attachment)
+ .build();
+
+ assertThat(messageAttachment).isEqualTo(expectedMessageAttachment);
+ }
+
+ @Test
+ public void buildShouldSetIsInlineDefaultValueWhenNotGiven() {
+ Attachment attachment = Attachment.builder()
+ .bytes("content".getBytes())
+ .type("type")
+ .build();
+
+ MessageAttachment messageAttachment = MessageAttachment.builder()
+ .attachment(attachment)
+ .build();
+
+ assertThat(messageAttachment.isInline()).isFalse();
+ }
+
+ @Test(expected=IllegalStateException.class)
+ public void buildShouldThrowWhenIsInlineAndNoCid() {
+ Attachment attachment = Attachment.builder()
+ .bytes("content".getBytes())
+ .type("type")
+ .build();
+
+ MessageAttachment.builder()
+ .attachment(attachment)
+ .isInline(true)
+ .build();
+ }
+
+ @Test
+ public void buildShouldSetAttributesWhenAllAreGiven() {
+ Attachment attachment = Attachment.builder()
+ .bytes("content".getBytes())
+ .type("type")
+ .build();
+ MessageAttachment expectedMessageAttachment = new MessageAttachment(attachment, Optional.of("cid"), true);
+
+ MessageAttachment messageAttachment = MessageAttachment.builder()
+ .attachment(attachment)
+ .cid("cid")
+ .isInline(true)
+ .build();
+
+ assertThat(messageAttachment).isEqualTo(expectedMessageAttachment);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
index f0d614b..82ac2a3 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
@@ -38,6 +38,7 @@ import org.apache.james.mailbox.model.MessageMetaData;
import org.apache.james.mailbox.model.MessageRange;
import org.apache.james.mailbox.model.UpdatedFlags;
import org.apache.james.mailbox.store.FlagsUpdateCalculator;
+import org.apache.james.mailbox.store.mail.AttachmentMapper;
import org.apache.james.mailbox.store.mail.MessageMapper;
import org.apache.james.mailbox.store.mail.MessageMapper.FetchType;
import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
@@ -65,6 +66,7 @@ public class MessageMapperTest<T extends MapperProvider> {
private IProducer<T> producer;
private MapperProvider mapperProvider;
private MessageMapper messageMapper;
+ private AttachmentMapper attachmentMapper;
private SimpleMailbox benwaInboxMailbox;
private SimpleMailbox benwaWorkMailbox;
@@ -87,7 +89,8 @@ public class MessageMapperTest<T extends MapperProvider> {
this.producer = producer;
this.mapperProvider = producer.newInstance();
this.mapperProvider.ensureMapperPrepared();
- this. messageMapper = mapperProvider.createMessageMapper();
+ this.messageMapper = mapperProvider.createMessageMapper();
+ this.attachmentMapper = mapperProvider.createAttachmentMapper();
benwaInboxMailbox = createMailbox(new MailboxPath("#private", "benwa", "INBOX"));
benwaWorkMailbox = createMailbox( new MailboxPath("#private", "benwa", "INBOX"+DELIMITER+"work"));
@@ -99,8 +102,37 @@ public class MessageMapperTest<T extends MapperProvider> {
message4 = createMessage(benwaInboxMailbox, "Subject: Test4 \n\nBody4\n.\n", BODY_START, new PropertyBuilder());
message5 = createMessage(benwaInboxMailbox, "Subject: Test5 \n\nBody5\n.\n", BODY_START, new PropertyBuilder());
message6 = createMessage(benwaWorkMailbox, "Subject: Test6 \n\nBody6\n.\n", BODY_START, new PropertyBuilder());
- message7With1Attachment = createMessage(attachmentsMailbox, "Subject: Test7 \n\nBody7\n.\n", BODY_START, new PropertyBuilder(), ImmutableList.of(AttachmentId.from("123")));
- message8With2Attachments = createMessage(attachmentsMailbox, "Subject: Test8 \n\nBody8\n.\n", BODY_START, new PropertyBuilder(), ImmutableList.of(AttachmentId.from("123"), AttachmentId.from("456")));
+
+ Attachment attachment = Attachment.builder()
+ .attachmentId(AttachmentId.from("123"))
+ .bytes("attachment".getBytes())
+ .type("content")
+ .build();
+ attachmentMapper.storeAttachment(attachment);
+ Attachment attachment2 = Attachment.builder()
+ .attachmentId(AttachmentId.from("456"))
+ .bytes("attachment2".getBytes())
+ .type("content")
+ .build();
+ attachmentMapper.storeAttachment(attachment2);
+ message7With1Attachment = createMessage(attachmentsMailbox, "Subject: Test7 \n\nBody7\n.\n", BODY_START, new PropertyBuilder(),
+ ImmutableList.of(MessageAttachment.builder()
+ .attachment(attachment)
+ .cid("cid")
+ .isInline(true)
+ .build()));
+ message8With2Attachments = createMessage(attachmentsMailbox, "Subject: Test8 \n\nBody8\n.\n", BODY_START, new PropertyBuilder(),
+ ImmutableList.of(
+ MessageAttachment.builder()
+ .attachment(attachment)
+ .cid("cid")
+ .isInline(true)
+ .build(),
+ MessageAttachment.builder()
+ .attachment(attachment2)
+ .cid("cid2")
+ .isInline(false)
+ .build()));
}
@@ -268,53 +300,53 @@ public class MessageMapperTest<T extends MapperProvider> {
}
@ContractTest
- public void messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsIdsEmptyWhenNoAttachment() throws MailboxException, IOException{
+ public void messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsEmptyWhenNoAttachment() throws MailboxException, IOException{
saveMessages();
MessageMapper.FetchType fetchType = MessageMapper.FetchType.Full;
Iterator<MailboxMessage> retrievedMessageIterator = messageMapper.findInMailbox(benwaInboxMailbox, MessageRange.one(message1.getUid()), fetchType, LIMIT);
- assertThat(retrievedMessageIterator.next().getAttachmentsIds()).isEmpty();
+ assertThat(retrievedMessageIterator.next().getAttachments()).isEmpty();
}
@ContractTest
- public void messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsIdsLoadedWhenOneAttachment() throws MailboxException, IOException{
+ public void messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsLoadedWhenOneAttachment() throws MailboxException, IOException{
saveMessages();
MessageMapper.FetchType fetchType = MessageMapper.FetchType.Full;
Iterator<MailboxMessage> retrievedMessageIterator = messageMapper.findInMailbox(attachmentsMailbox, MessageRange.one(message7With1Attachment.getUid()), fetchType, LIMIT);
- assertThat(retrievedMessageIterator.next().getAttachmentsIds()).isEqualTo(message7With1Attachment.getAttachmentsIds());
+ assertThat(retrievedMessageIterator.next().getAttachments()).isEqualTo(message7With1Attachment.getAttachments());
}
@ContractTest
- public void messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsIdsLoadedWhenTwoAttachments() throws MailboxException, IOException{
+ public void messagesRetrievedUsingFetchTypeFullShouldHaveAttachmentsLoadedWhenTwoAttachments() throws MailboxException, IOException{
saveMessages();
MessageMapper.FetchType fetchType = MessageMapper.FetchType.Full;
Iterator<MailboxMessage> retrievedMessageIterator = messageMapper.findInMailbox(attachmentsMailbox, MessageRange.one(message8With2Attachments.getUid()), fetchType, LIMIT);
- assertThat(retrievedMessageIterator.next().getAttachmentsIds()).isEqualTo(message8With2Attachments.getAttachmentsIds());
+ assertThat(retrievedMessageIterator.next().getAttachments()).isEqualTo(message8With2Attachments.getAttachments());
}
@ContractTest
- public void messagesRetrievedUsingFetchTypeBodyShouldHaveAttachmentsIdsLoadedWhenOneAttachment() throws MailboxException, IOException{
+ public void messagesRetrievedUsingFetchTypeBodyShouldHaveAttachmentsLoadedWhenOneAttachment() throws MailboxException, IOException{
saveMessages();
MessageMapper.FetchType fetchType = MessageMapper.FetchType.Body;
Iterator<MailboxMessage> retrievedMessageIterator = messageMapper.findInMailbox(attachmentsMailbox, MessageRange.one(message7With1Attachment.getUid()), fetchType, LIMIT);
- assertThat(retrievedMessageIterator.next().getAttachmentsIds()).isEqualTo(message7With1Attachment.getAttachmentsIds());
+ assertThat(retrievedMessageIterator.next().getAttachments()).isEqualTo(message7With1Attachment.getAttachments());
}
@ContractTest
- public void messagesRetrievedUsingFetchTypeHeadersShouldHaveAttachmentsIdsEmptyWhenOneAttachment() throws MailboxException, IOException{
+ public void messagesRetrievedUsingFetchTypeHeadersShouldHaveAttachmentsEmptyWhenOneAttachment() throws MailboxException, IOException{
Assume.assumeTrue(mapperProvider.supportPartialAttachmentFetch());
saveMessages();
MessageMapper.FetchType fetchType = MessageMapper.FetchType.Headers;
Iterator<MailboxMessage> retrievedMessageIterator = messageMapper.findInMailbox(attachmentsMailbox, MessageRange.one(message7With1Attachment.getUid()), fetchType, LIMIT);
- assertThat(retrievedMessageIterator.next().getAttachmentsIds()).isEmpty();
+ assertThat(retrievedMessageIterator.next().getAttachments()).isEmpty();
}
@ContractTest
- public void messagesRetrievedUsingFetchTypeMetadataShouldHaveAttachmentsIdsEmptyWhenOneAttachment() throws MailboxException, IOException{
+ public void messagesRetrievedUsingFetchTypeMetadataShouldHaveAttachmentsEmptyWhenOneAttachment() throws MailboxException, IOException{
Assume.assumeTrue(mapperProvider.supportPartialAttachmentFetch());
saveMessages();
MessageMapper.FetchType fetchType = MessageMapper.FetchType.Metadata;
Iterator<MailboxMessage> retrievedMessageIterator = messageMapper.findInMailbox(attachmentsMailbox, MessageRange.one(message7With1Attachment.getUid()), fetchType, LIMIT);
- assertThat(retrievedMessageIterator.next().getAttachmentsIds()).isEmpty();
+ assertThat(retrievedMessageIterator.next().getAttachments()).isEmpty();
}
@ContractTest
@@ -742,8 +774,8 @@ public class MessageMapperTest<T extends MapperProvider> {
return messageMapper.findInMailbox(benwaInboxMailbox, MessageRange.one(message.getUid()), MessageMapper.FetchType.Metadata, LIMIT).next();
}
- private SimpleMailboxMessage createMessage(Mailbox mailbox, String content, int bodyStart, PropertyBuilder propertyBuilder, List<AttachmentId> attachmentsIds) {
- return new SimpleMailboxMessage(new Date(), content.length(), bodyStart, new SharedByteArrayInputStream(content.getBytes()), new Flags(), propertyBuilder, mailbox.getMailboxId(), attachmentsIds);
+ private SimpleMailboxMessage createMessage(Mailbox mailbox, String content, int bodyStart, PropertyBuilder propertyBuilder, List<MessageAttachment> attachments) {
+ return new SimpleMailboxMessage(new Date(), content.length(), bodyStart, new SharedByteArrayInputStream(content.getBytes()), new Flags(), propertyBuilder, mailbox.getMailboxId(), attachments);
}
private SimpleMailboxMessage createMessage(Mailbox mailbox, String content, int bodyStart, PropertyBuilder propertyBuilder) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
index ca6847d..2512123 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/impl/MessageParserTest.java
@@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.apache.james.mailbox.store.mail.model.Attachment;
+import org.apache.james.mailbox.store.mail.model.MessageAttachment;
import org.junit.Before;
import org.junit.Test;
@@ -40,101 +41,117 @@ public class MessageParserTest {
@Test
public void getAttachmentsShouldBeEmptyWhenNoAttachment() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/noAttachment.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/noAttachment.eml"));
assertThat(attachments).isEmpty();
}
@Test
public void getAttachmentsShouldRetrieveAttachmentsWhenOneAttachment() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeInlined.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeTextInlined.eml"));
assertThat(attachments).hasSize(1);
}
@Test
public void getAttachmentsShouldRetrieveAttachmentNameWhenOne() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeInlined.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeTextInlined.eml"));
assertThat(attachments).hasSize(1);
Optional<String> expectedName = Optional.of("exploits_of_a_mom.png");
- assertThat(attachments.get(0).getName()).isEqualTo(expectedName);
+ assertThat(attachments.get(0).getAttachment().getName()).isEqualTo(expectedName);
}
@Test
public void getAttachmentsShouldRetrieveEmptyNameWhenNone() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithoutName.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithoutName.eml"));
assertThat(attachments).hasSize(1);
- assertThat(attachments.get(0).getName()).isEqualTo(Optional.absent());
+ assertThat(attachments.get(0).getAttachment().getName()).isEqualTo(Optional.absent());
}
@Test
public void getAttachmentsShouldNotFailWhenContentTypeIsNotHere() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithoutContentType.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithoutContentType.eml"));
assertThat(attachments).hasSize(1);
- assertThat(attachments.get(0).getType()).isEqualTo("application/octet-stream");
+ assertThat(attachments.get(0).getAttachment().getType()).isEqualTo("application/octet-stream");
}
@Test
public void getAttachmentsShouldNotFailWhenContentTypeIsEmpty() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithEmptyContentType.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithEmptyContentType.eml"));
assertThat(attachments).hasSize(1);
- assertThat(attachments.get(0).getType()).isEqualTo("application/octet-stream");
+ assertThat(attachments.get(0).getAttachment().getType()).isEqualTo("application/octet-stream");
}
@Test
public void getAttachmentsShouldRetrieveTheAttachmentContentTypeWhenOneAttachment() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeInlined.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeTextInlined.eml"));
assertThat(attachments).hasSize(1);
- assertThat(attachments.get(0).getType()).isEqualTo("application/octet-stream");
+ assertThat(attachments.get(0).getAttachment().getType()).isEqualTo("application/octet-stream");
}
@Test
public void getAttachmentsShouldRetrieveTheAttachmentContentTypeWhenOneAttachmentWithSimpleContentType() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithSimpleContentType.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentWithSimpleContentType.eml"));
assertThat(attachments).hasSize(1);
- assertThat(attachments.get(0).getType()).isEqualTo("application/octet-stream");
+ assertThat(attachments.get(0).getAttachment().getType()).isEqualTo("application/octet-stream");
}
@Test
public void getAttachmentsShouldRetrieveTheAttachmentSizeWhenOneAttachment() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeInlined.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeTextInlined.eml"));
assertThat(attachments).hasSize(1);
- assertThat(attachments.get(0).getSize()).isEqualTo(3071);
+ assertThat(attachments.get(0).getAttachment().getSize()).isEqualTo(3071);
}
@Test
public void getAttachmentsShouldReturnTheExpectedAttachment() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeInlined.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneAttachmentAndSomeTextInlined.eml"));
- Attachment attachment = attachments.get(0);
+ Attachment attachment = attachments.get(0).getAttachment();
assertThat(attachment.getStream()).hasContentEqualTo(ClassLoader.getSystemResourceAsStream("eml/gimp.png"));
}
@Test
public void getAttachmentsShouldRetrieveAttachmentsWhenTwo() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"));
assertThat(attachments).hasSize(2);
}
@Test
public void getAttachmentsShouldNotRetrieveEmbeddedAttachmentsWhenSome() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/embeddedAttachmentWithInline.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/embeddedAttachmentWithInline.eml"));
assertThat(attachments).hasSize(1);
}
@Test
public void getAttachmentsShouldNotRetrieveInlineAttachmentsWhenSome() throws Exception {
- List<Attachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/embeddedAttachmentWithAttachment.eml"));
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/embeddedAttachmentWithAttachment.eml"));
assertThat(attachments).hasSize(1);
}
+
+ @Test
+ public void getAttachmentsShouldRetrieveTheAttachmentCIDWhenOne() throws Exception {
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneInlinedAttachment.eml"));
+
+ assertThat(attachments).hasSize(1);
+ assertThat(attachments.get(0).getCid()).isEqualTo(Optional.of("<pa...@linagora.com>"));
+ }
+
+ @Test
+ public void getAttachmentsShouldSetInlineWhenOneInlinedAttachment() throws Exception {
+ List<MessageAttachment> attachments = testee.retrieveAttachments(ClassLoader.getSystemResourceAsStream("eml/oneInlinedAttachment.eml"));
+
+ assertThat(attachments).hasSize(1);
+ assertThat(attachments.get(0).isInline()).isTrue();
+ }
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeInlined.eml
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeInlined.eml b/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeInlined.eml
deleted file mode 100644
index 578af96..0000000
--- a/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeInlined.eml
+++ /dev/null
@@ -1,39 +0,0 @@
-Mail content:
-To: "=?utf-8?B?UmFuaSBBc3NhZg==?=" <ra...@jri.obm.lng.org>
-Subject: =?utf-8?B?VHIuIDogUGhvdG9zICE=?=
-Importance: Normal
-MIME-Version: 1.0
-Content-Type: multipart/mixed;
- boundary="----=_Part_0_1330682067197"
-
-------=_Part_0_1330682067197
-Content-Type: multipart/alternative;
- boundary="----=_Part_2_1330682067197"
-
-------=_Part_2_1330682067197
-Content-Type: text/plain;
- charset= utf-8
-Content-Transfer-Encoding: 8bit
-Content-Disposition: inline
-
-Content of part 1-1
-------=_Part_2_1330682067197
-Content-Type: text/html;
- charset= utf-8
-Content-Transfer-Encoding: 8bit
-Content-Disposition: inline
-
-<b>Content of part 1-2</b>
-------=_Part_2_1330682067197--
-
-------=_Part_0_1330682067197
-Content-Type: application/octet-stream;
- name="exploits_of_a_mom.png"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
- filename="gimp.png"
-
-iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAALxklEQVR4Ae2Xe0xUZ97H5X4RiyAXEARURBSYCzNnLjMwwAx3huGOIBcUFJERAUVRq+KlwHABFdu+b9+0766x1W21ttnUtE3rul6aGNtm3XbdWncjaa3VXrZRK6IgfPd3Tp6wOGmyo0v/cOMknxwy5xzO7/P8LueZaWlpaU80TwWeCvy3CcRwXJlUqp39RApIOE4i5hQPxBz30hMpIJIrjktkseMimfzPUyoglilTf/XVl8u1Ik4xrOJE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UQLUUeUshVNIJSExMvLK9rT03P+upbGVd09nZfo9/XPJlM2/P390dnZKRAWFsZL8JT+OwG7SRLuxEzCn5VTOBHFRJREPKEn0ggTUcRWtoJRyr4zscwlEXHsXinLbDgbn37sWW7bdm2L9/Pzu+nu7o6NGzeitbWVshEAlokvCPsJARskXFlPeDORYJaRCCYjZuWlYNnREFqGhlCxczJ27WJ279xJgXsRHmyAOLJnnyTAQxkVjvPnz4evry94eWuBX5RgOEwSmU54ErOYzGxiDhHGpMKJCCvC2bkwFvBsFrQ3m3bTWeBO7Fl2jPUErKFy44/p1gK2ijgSzkzGnfBgQcxkAfkwfBk+DG9iJrvWg93ryoJ2nBy41bMPWQvQ7pk/LrMSeCQRe8JhkpATk3JhQblZ4crOOVsFLGwTrAOfDLv3AAErWq0FHldm
ktQEDlbYM+yseYTnLSOGCDD6H1/ARilrpuD/LyYuMoFDVgJPBqx3/p84YS3wpInonmQBxlOBpwJPBf4JszXhha5WvGwAAAAASUVORK5CYII=
-
-------=_Part_0_1330682067197--
-
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeTextInlined.eml
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeTextInlined.eml b/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeTextInlined.eml
new file mode 100644
index 0000000..578af96
--- /dev/null
+++ b/mailbox/store/src/test/resources/eml/oneAttachmentAndSomeTextInlined.eml
@@ -0,0 +1,39 @@
+Mail content:
+To: "=?utf-8?B?UmFuaSBBc3NhZg==?=" <ra...@jri.obm.lng.org>
+Subject: =?utf-8?B?VHIuIDogUGhvdG9zICE=?=
+Importance: Normal
+MIME-Version: 1.0
+Content-Type: multipart/mixed;
+ boundary="----=_Part_0_1330682067197"
+
+------=_Part_0_1330682067197
+Content-Type: multipart/alternative;
+ boundary="----=_Part_2_1330682067197"
+
+------=_Part_2_1330682067197
+Content-Type: text/plain;
+ charset= utf-8
+Content-Transfer-Encoding: 8bit
+Content-Disposition: inline
+
+Content of part 1-1
+------=_Part_2_1330682067197
+Content-Type: text/html;
+ charset= utf-8
+Content-Transfer-Encoding: 8bit
+Content-Disposition: inline
+
+<b>Content of part 1-2</b>
+------=_Part_2_1330682067197--
+
+------=_Part_0_1330682067197
+Content-Type: application/octet-stream;
+ name="exploits_of_a_mom.png"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="gimp.png"
+
+iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAALxklEQVR4Ae2Xe0xUZ97H5X4RiyAXEARURBSYCzNnLjMwwAx3huGOIBcUFJERAUVRq+KlwHABFdu+b9+0766x1W21ttnUtE3rul6aGNtm3XbdWncjaa3VXrZRK6IgfPd3Tp6wOGmyo0v/cOMknxwy5xzO7/P8LueZaWlpaU80TwWeCvy3CcRwXJlUqp39RApIOE4i5hQPxBz30hMpIJIrjktkseMimfzPUyoglilTf/XVl8u1Ik4xrOJEEMu4wSkVEMmVZ6VSTeivFXy0TDZfIlfc0qil0KpIQM59P6UCUk71lVShPD1t2jT7qQ4+Sq32prq/GhfHjSXFSxGvEfMCQ1MsoLzOadT3pArFwBQ3LSdRqK4mJyfcz0xRwaCLRVKcBDEybmxqBRTKH8uXpEOj0/1MD3wuMTHR8T9adY4LoOD3KuPj7xYVGlGYo0e6gUNKoowkpKBmHpXJZO5TKXCrpjwT5pWFSM1IvROrVH0hksujf+laAHYWi8XT+nsKyIlvVKlSeVSu0twtXpI/Yq4rR2lBKoxpamQmK5Gm55CcIAP1wxAvOWUCEk4xVLvchIaVedi8rgq1NSXjqnjdHcrGayK5yhStVPpbLLvE/Xt6Tnf3Wu529XSM9fZ13Wzbse2kJiGhK1ap/ETCqe5lGLNum+trxnZsbca6tcuwJM+AvKw4mNI1yEpVURYUSE2S8wJ3RSKN35QJUJPdM6/IQ8vaCmzdZMbObU2w7G7BhhbzeEFR4e2SsrIRChqnz5zE999/h9HREXz19SD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CYII=
+
+------=_Part_0_1330682067197--
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/mailbox/store/src/test/resources/eml/oneInlinedAttachment.eml
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/resources/eml/oneInlinedAttachment.eml b/mailbox/store/src/test/resources/eml/oneInlinedAttachment.eml
new file mode 100644
index 0000000..50c0b80
--- /dev/null
+++ b/mailbox/store/src/test/resources/eml/oneInlinedAttachment.eml
@@ -0,0 +1,201 @@
+Return-Path: <ad...@linagora.com>
+Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
+ by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
+ Tue, 05 Jul 2016 11:47:47 +0200
+X-Sieve: CMU Sieve 2.2
+Received: from [10.69.0.107] (mne69-10-88-173-78-196.fbx.proxad.net [88.173.78.196])
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
+ (No client certificate requested)
+ by alderaan.linagora.com (Postfix) with ESMTPSA id F1F3E74E
+ for <ad...@linagora.com>; Tue, 5 Jul 2016 11:47:46 +0200 (CEST)
+To: Antoine DUPRAT <ad...@linagora.com>
+From: Antoine DUPRAT <ad...@linagora.com>
+Subject: Inline attachment
+Message-ID: <26...@linagora.com>
+Date: Tue, 5 Jul 2016 11:47:46 +0200
+User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
+ Thunderbird/45.1.1
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+ boundary="------------FC06E08B3CDF05E9A3E28077"
+
+This is a multi-part message in MIME format.
+--------------FC06E08B3CDF05E9A3E28077
+Content-Type: text/plain; charset=utf-8; format=flowed
+Content-Transfer-Encoding: 7bit
+
+This is an inline attachment:
+
+
+
+
+Cheers!
+
+--------------FC06E08B3CDF05E9A3E28077
+Content-Type: multipart/related;
+ boundary="------------47107B0D40019CDFED2C4263"
+
+
+--------------47107B0D40019CDFED2C4263
+Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: 7bit
+
+<html>
+ <head>
+
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <body bgcolor="#FFFFFF" text="#000000">
+ This is an inline attachment:<br>
+ <br>
+ <img alt="" src="cid:part1.37A15C92.A7C3488D@linagora.com"
+ height="73" width="73"><br>
+ <br>
+ <br>
+ Cheers!<br>
+ </body>
+</html>
+
+--------------47107B0D40019CDFED2C4263
+Content-Type: image/png;
+ name="james-logo-square.png"
+Content-Transfer-Encoding: base64
+Content-ID: <pa...@linagora.com>
+Content-Disposition: inline;
+ filename="james-logo-square.png"
+
+iVBORw0KGgoAAAANSUhEUgAAAEkAAABJCAYAAABxcwvcAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAl2cEFnAAAASQAAAEkA
+HD4S4QAAGnxJREFUeNrtnHmQJVeV3n/n3sy31avl1d5V1Uu1elN3q7W2BDJCgAAJhsXMeMYi
+gLEDxtgEBDEmHGMwoO4Ze/AMDAPYQASeGARjPAwCBIgBLBrREtrV2npT73t1bV3bq3qv3pJ5
+7/Ef+ao3NUNbAaInok9EVb6XLyvfzS/P/c6553xZoqrKZfsnzfy2B/DPwS6DdBF2GaSLsMsg
+XYRdBuki7DJIF2GXQboIuwzSRVjw6zqRqgcUjT3V+WOEmTaCMA/eoibAi2JxQIATUIWAevK3
+pBAP4PDGIiKX1N37NY5FQIX5ygyP3/9fOfDMZ6lMbcNRx6uCVxQDePAgqjj1OBSUxuc++fwS
+WwP8Wm+YRwnDiKwZYu+j3+HEri8we/JhnDoA1BvQCKseowKECIlbOQFnBEGRSwylXxtIjphY
+IqzJsvSKm2lpa2VseC8nnvg+p555ClWPxA6lDnicACIYFVSUmgUVizTgvpTsIkFSVM/8oOe+
+V1UsAYG3RKks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WIIc6+0H/qsEZp
+Rs7iwvPfn6kpgMy7uqaipEDlTBLuPZYUjdrSGcnJb1zFsfCA4W9bSHq+yeV/DfSr7dJ6sOwS
+tcsgXYRdBuki7DJIF2GXQboIuwzSRdhlkC7CLoN0EXYZpIuw/wdvAzezhw7dYAAAACV0RVh0
+ZGF0ZTpjcmVhdGUAMjAxMC0xMC0xNlQxMjo0MDo0MCswMDowMALp72sAAAAldEVYdGRhdGU6
+bW9kaWZ5ADIwMTAtMTAtMTZUMTI6NDA6NDArMDA6MDBztFfXAAAAF3RFWHRwbmc6Yml0LWRl
+cHRoLXdyaXR0ZW4ACKfELPIAAAAASUVORK5CYII=
+--------------47107B0D40019CDFED2C4263--
+
+--------------FC06E08B3CDF05E9A3E28077--
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/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 8907f98..252afd0 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
@@ -39,6 +39,7 @@ import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.mail.Flags;
+import org.apache.james.jmap.methods.integration.cucumber.util.TableRow;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
import org.javatuples.Pair;
@@ -317,8 +318,8 @@ public class GetMessagesMethodStepdefs {
}
private void assertAttachment(String attachment, DataTable attachmentProperties) {
- attachmentProperties.asMap(String.class, String.class).entrySet()
+ attachmentProperties.asList(TableRow.class)
.stream()
- .map(entry -> response.body(attachment + "." + entry.getKey(), equalTo(entry.getValue())));
+ .forEach(row -> response.body(attachment + "." + row.getKey(), equalTo(row.getValue())));
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/BooleanFromString.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/BooleanFromString.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/BooleanFromString.java
new file mode 100644
index 0000000..2a98f56
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/BooleanFromString.java
@@ -0,0 +1,34 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber.util;
+
+import java.util.Optional;
+
+public class BooleanFromString implements ObjectFromString<Boolean> {
+
+ @Override
+ public Optional<Boolean> extract(String source) {
+ if (source.equals("true") || source.equals("false")) {
+ return Optional.of(Boolean.valueOf(source));
+ }
+ return Optional.empty();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/IntegerFromString.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/IntegerFromString.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/IntegerFromString.java
new file mode 100644
index 0000000..94a2dd8
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/IntegerFromString.java
@@ -0,0 +1,35 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber.util;
+
+import java.util.Optional;
+
+public class IntegerFromString implements ObjectFromString<Integer> {
+
+ @Override
+ public Optional<Integer> extract(String source) {
+ try {
+ return Optional.of(Integer.valueOf(source));
+ } catch (Exception e) {
+ return Optional.empty();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromString.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromString.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromString.java
new file mode 100644
index 0000000..776a0a8
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromString.java
@@ -0,0 +1,27 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber.util;
+
+import java.util.Optional;
+
+public interface ObjectFromString<T> {
+
+ Optional<T> extract(String source);
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromStringExtractor.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromStringExtractor.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromStringExtractor.java
new file mode 100644
index 0000000..1e50b14
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/ObjectFromStringExtractor.java
@@ -0,0 +1,42 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber.util;
+
+import java.util.List;
+import java.util.Optional;
+
+import com.google.common.collect.ImmutableList;
+
+public class ObjectFromStringExtractor {
+
+ private static final List<ObjectFromString<?>> EXTRACTORS = ImmutableList.of(
+ new StringFromString(),
+ new IntegerFromString(),
+ new BooleanFromString());
+
+ public Object extract(String value) {
+ return EXTRACTORS.stream()
+ .map(extractor -> extractor.extract(value))
+ .filter(Optional::isPresent)
+ .map(Optional::get)
+ .findFirst()
+ .orElse(null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/StringFromString.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/StringFromString.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/StringFromString.java
new file mode 100644
index 0000000..4cc33fd
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/StringFromString.java
@@ -0,0 +1,35 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+
+package org.apache.james.jmap.methods.integration.cucumber.util;
+
+import java.util.Optional;
+
+public class StringFromString implements ObjectFromString<String> {
+
+ @Override
+ public Optional<String> extract(String source) {
+ if (source.startsWith("\"") && source.endsWith("\"")) {
+ return Optional.of(source.substring(1, source.length() - 1));
+ }
+ return Optional.empty();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/TableRow.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/TableRow.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/TableRow.java
new file mode 100644
index 0000000..b806e8c
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/util/TableRow.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber.util;
+
+import com.google.common.base.MoreObjects;
+
+public class TableRow {
+
+ private String key;
+ private String value;
+
+ public TableRow(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return new ObjectFromStringExtractor().extract(value);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects
+ .toStringHelper(this)
+ .add("key", key)
+ .add("value", value)
+ .toString();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/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 0ec32fd..9b77a3f 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
@@ -142,13 +142,19 @@ Feature: GetMessages method
And the hasAttachment of the message is "true"
And the list of attachments of the message contains 2 attachments
And the first attachment is:
- |blobId |"223a76c0e8c1b1762487d8e0598bd88497d73ef2" |
- |type |"image/jpeg" |
- |size |846 |
+ |key | value |
+ |blobId |"223a76c0e8c1b1762487d8e0598bd88497d73ef2" |
+ |type |"image/jpeg" |
+ |size |846 |
+ |cid |null |
+ |isInline |false |
And the second attachment is:
- |blobId |"58aa22c2ec5770fb9e574ba19008dbfc647eba43" |
- |type |"image/jpeg" |
- |size |597 |
+ |key | value |
+ |blobId |"58aa22c2ec5770fb9e574ba19008dbfc647eba43" |
+ |type |"image/jpeg" |
+ |size |597 |
+ |cid |"<pa...@linagora.com>" |
+ |isInline |true |
Scenario: Retrieving message should return attachments and html body when some attachments and html message
Given the user has a message in "inbox" mailbox with two attachments
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
index 85f0e3b..f6c18fc 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
@@ -54,7 +54,8 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Content-Type: image/jpeg;
name="4037_015.jpg"
Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
+Content-ID: <pa...@linagora.com>
+Content-Disposition: inline;
filename="4037_015.jpg"
iVBORw0KGgoAAAANSUhEUgAABYUAAAL4CAIAAACrzA8fAAAACXBIWXMAAAsTAAALEwEAmpwY
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap/doc/specs/spec/message.mdwn
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/doc/specs/spec/message.mdwn b/server/protocols/jmap/doc/specs/spec/message.mdwn
index 55d9523..ab144cb 100644
--- a/server/protocols/jmap/doc/specs/spec/message.mdwn
+++ b/server/protocols/jmap/doc/specs/spec/message.mdwn
@@ -112,9 +112,6 @@ An **Attachment** object has the following properties:
The id used within the message body to reference this attachment. This is only unique when paired with the message id, and has no meaning without reference to that.
- **isInline**: `Boolean`
True if the attachment is referenced by a `cid:` link from within the HTML body of the message.
- <aside class="warning">
- Inlined attachments are not parsed yet.
- </aside>
- **width**: `Number|null`
The width (in px) of the image, if the attachment is an image.
- **height**: `Number|null`
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
index 39319c5..5d6cb7e 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
@@ -42,15 +42,12 @@ import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.MessageRange;
-import org.apache.james.mailbox.store.mail.AttachmentMapper;
-import org.apache.james.mailbox.store.mail.AttachmentMapperFactory;
import org.apache.james.mailbox.store.mail.MailboxMapperFactory;
import org.apache.james.mailbox.store.mail.MessageMapper;
import org.apache.james.mailbox.store.mail.MessageMapperFactory;
-import org.apache.james.mailbox.store.mail.model.Attachment;
-import org.apache.james.mailbox.store.mail.model.AttachmentId;
import org.apache.james.mailbox.store.mail.model.Mailbox;
import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.MessageAttachment;
import org.apache.james.util.streams.ImmutableCollectors;
import org.javatuples.Pair;
@@ -68,18 +65,15 @@ public class GetMessagesMethod implements Method {
private static final Method.Response.Name RESPONSE_NAME = Method.Response.name("messages");
private final MessageMapperFactory messageMapperFactory;
private final MailboxMapperFactory mailboxMapperFactory;
- private final AttachmentMapperFactory attachmentMapperFactory;
private final MessageFactory messageFactory;
@Inject
@VisibleForTesting GetMessagesMethod(
MessageMapperFactory messageMapperFactory,
MailboxMapperFactory mailboxMapperFactory,
- AttachmentMapperFactory attachmentMapperFactory,
MessageFactory messageFactory) {
this.messageMapperFactory = messageMapperFactory;
this.mailboxMapperFactory = mailboxMapperFactory;
- this.attachmentMapperFactory = attachmentMapperFactory;
this.messageFactory = messageFactory;
}
@@ -165,13 +159,10 @@ public class GetMessagesMethod implements Method {
Iterable<MailboxMessage> iterable = () -> value.getValue0();
Stream<MailboxMessage> targetStream = StreamSupport.stream(iterable.spliterator(), false);
- Function<List<AttachmentId>, List<Attachment>> retrieveAttachments = retrieveAttachments(attachmentMapperFactory.getAttachmentMapper(mailboxSession));
-
MailboxPath mailboxPath = value.getValue1();
return targetStream
- .map(message -> CompletedMailboxMessage.builder().mailboxMessage(message).attachmentIds(message.getAttachmentsIds()))
+ .map(message -> CompletedMailboxMessage.builder().mailboxMessage(message).attachments(message.getAttachments()))
.map(builder -> builder.mailboxPath(mailboxPath))
- .map(builder -> builder.retrieveAttachments(retrieveAttachments))
.map(builder -> builder.build());
}
@@ -184,9 +175,8 @@ public class GetMessagesMethod implements Method {
public static class Builder {
private MailboxMessage mailboxMessage;
- private List<AttachmentId> attachmentIds;
+ private List<MessageAttachment> attachments;
private MailboxPath mailboxPath;
- private Function<List<AttachmentId>, List<Attachment>> retrieveAttachments;
private Builder() {
}
@@ -197,9 +187,9 @@ public class GetMessagesMethod implements Method {
return this;
}
- public Builder attachmentIds(List<AttachmentId> attachmentIds) {
- Preconditions.checkArgument(attachmentIds != null);
- this.attachmentIds = attachmentIds;
+ public Builder attachments(List<MessageAttachment> attachments) {
+ Preconditions.checkArgument(attachments != null);
+ this.attachments = attachments;
return this;
}
@@ -209,37 +199,22 @@ public class GetMessagesMethod implements Method {
return this;
}
- public Builder retrieveAttachments(Function<List<AttachmentId>, List<Attachment>> retrieveAttachments) {
- Preconditions.checkArgument(retrieveAttachments != null);
- this.retrieveAttachments = retrieveAttachments;
- return this;
- }
-
public CompletedMailboxMessage build() {
Preconditions.checkState(mailboxMessage != null);
- Preconditions.checkState(attachmentIds != null);
+ Preconditions.checkState(attachments != null);
Preconditions.checkState(mailboxPath != null);
- Preconditions.checkState(retrieveAttachments != null);
- return new CompletedMailboxMessage(mailboxMessage, retrieveAttachments.apply(attachmentIds), mailboxPath);
+ return new CompletedMailboxMessage(mailboxMessage, attachments, mailboxPath);
}
}
private final MailboxMessage mailboxMessage;
- private final List<Attachment> attachments;
+ private final List<MessageAttachment> attachments;
private final MailboxPath mailboxPath;
- public CompletedMailboxMessage(MailboxMessage mailboxMessage, List<Attachment> attachments, MailboxPath mailboxPath) {
+ public CompletedMailboxMessage(MailboxMessage mailboxMessage, List<MessageAttachment> attachments, MailboxPath mailboxPath) {
this.mailboxMessage = mailboxMessage;
this.attachments = attachments;
this.mailboxPath = mailboxPath;
}
}
-
- private Function<List<AttachmentId>, List<Attachment>> retrieveAttachments(AttachmentMapper attachmentMapper) {
- return (attachmentsIds) -> {
- return attachmentsIds.stream()
- .map(Throwing.function(id -> attachmentMapper.getAttachment(id)))
- .collect(ImmutableCollectors.toImmutableList());
- };
- }
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Attachment.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Attachment.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Attachment.java
index 8aa0927..2cbed7f 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Attachment.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Attachment.java
@@ -135,7 +135,7 @@ public class Attachment {
return cid;
}
- public boolean isInline() {
+ public boolean isIsInline() {
return isInline;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MessageFactory.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MessageFactory.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MessageFactory.java
index b31f403..126dcb9 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MessageFactory.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MessageFactory.java
@@ -33,6 +33,7 @@ import org.apache.james.jmap.model.message.EMailer;
import org.apache.james.jmap.model.message.IndexableMessage;
import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.apache.james.mailbox.store.mail.model.MessageAttachment;
import org.apache.james.util.streams.ImmutableCollectors;
import com.google.common.base.Strings;
@@ -54,7 +55,7 @@ public class MessageFactory {
}
public Message fromMailboxMessage(MailboxMessage mailboxMessage,
- List<org.apache.james.mailbox.store.mail.model.Attachment> attachments,
+ List<MessageAttachment> attachments,
Function<Long, MessageId> uidToMessageId) {
IndexableMessage im = IndexableMessage.from(mailboxMessage, new DefaultTextExtractor(), UTC_ZONE_ID);
@@ -150,18 +151,20 @@ public class MessageFactory {
return im.getBodyHtml().map(Strings::emptyToNull).orElse(null);
}
- private List<Attachment> getAttachments(List<org.apache.james.mailbox.store.mail.model.Attachment> attachments) {
+ private List<Attachment> getAttachments(List<MessageAttachment> attachments) {
return attachments.stream()
.map(this::fromMailboxAttachment)
.collect(ImmutableCollectors.toImmutableList());
}
- private Attachment fromMailboxAttachment(org.apache.james.mailbox.store.mail.model.Attachment attachment) {
+ private Attachment fromMailboxAttachment(MessageAttachment attachment) {
return Attachment.builder()
.blobId(attachment.getAttachmentId().getId())
- .type(attachment.getType())
- .name(attachment.getName().orNull())
- .size(attachment.getSize())
+ .type(attachment.getAttachment().getType())
+ .name(attachment.getAttachment().getName().orNull())
+ .size(attachment.getAttachment().getSize())
+ .cid(attachment.getCid().orNull())
+ .isInline(attachment.isInline())
.build();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/896bc961/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
index 9bfafe7..6bca35f 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
@@ -133,28 +133,28 @@ public class GetMessagesMethodTest {
@Test
public void processShouldThrowWhenNullRequest() {
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
GetMessagesRequest request = null;
assertThatThrownBy(() -> testee.process(request, mock(ClientId.class), mock(MailboxSession.class))).isInstanceOf(NullPointerException.class);
}
@Test
public void processShouldThrowWhenNullSession() {
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
MailboxSession mailboxSession = null;
assertThatThrownBy(() -> testee.process(mock(GetMessagesRequest.class), mock(ClientId.class), mailboxSession)).isInstanceOf(NullPointerException.class);
}
@Test
public void processShouldThrowWhenNullClientId() {
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
ClientId clientId = null;
assertThatThrownBy(() -> testee.process(mock(GetMessagesRequest.class), clientId, mock(MailboxSession.class))).isInstanceOf(NullPointerException.class);
}
@Test
public void processShouldThrowWhenRequestHasAccountId() {
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
assertThatThrownBy(() -> testee.process(
GetMessagesRequest.builder().accountId("abc").build(), mock(ClientId.class), mock(MailboxSession.class))).isInstanceOf(NotImplementedException.class);
}
@@ -176,7 +176,7 @@ public class GetMessagesMethodTest {
new MessageId(ROBERT, inboxPath, message3Uid)))
.build();
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result).hasSize(1)
@@ -205,7 +205,7 @@ public class GetMessagesMethodTest {
.ids(ImmutableList.of(new MessageId(ROBERT, inboxPath, messageUid)))
.build();
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result).hasSize(1)
@@ -229,7 +229,7 @@ public class GetMessagesMethodTest {
.properties(ImmutableList.of())
.build();
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result).hasSize(1)
@@ -250,7 +250,7 @@ public class GetMessagesMethodTest {
.ids(ImmutableList.of(new MessageId(ROBERT, inboxPath, message1Uid)))
.build();
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
Stream<JmapResponse> result = testee.process(request, clientId, session);
assertThat(result).hasSize(1)
@@ -274,7 +274,7 @@ public class GetMessagesMethodTest {
Set<MessageProperty> expected = Sets.newHashSet(MessageProperty.id, MessageProperty.subject);
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result).hasSize(1)
@@ -298,7 +298,7 @@ public class GetMessagesMethodTest {
Set<MessageProperty> expected = Sets.newHashSet(MessageProperty.id, MessageProperty.textBody);
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result).hasSize(1)
@@ -325,7 +325,7 @@ public class GetMessagesMethodTest {
Set<MessageProperty> expected = Sets.newHashSet(MessageProperty.id, MessageProperty.headers);
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result)
@@ -351,7 +351,7 @@ public class GetMessagesMethodTest {
.properties(ImmutableList.of("headers.from", "headers.heADER2"))
.build();
- GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
+ GetMessagesMethod testee = new GetMessagesMethod(mailboxSessionMapperFactory, mailboxSessionMapperFactory, messageFactory);
List<JmapResponse> result = testee.process(request, clientId, session).collect(Collectors.toList());
assertThat(result)
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org