@Test void emailWithAttachmentsShouldConvertAttachmentsWhenIndexAttachmentsIsTrue() throws IOException { MailboxMessage mailWithNoInternalDate = new SimpleMailboxMessage(MESSAGE_ID, null, SIZE, BODY_START_OCTET, ClassLoaderUtils.getSystemResourceAsSharedStream("eml/recursiveMail.eml"), new FlagsBuilder().add(Flags.Flag.DELETED, Flags.Flag.SEEN).add("debian", "security").build(), propertyBuilder, MAILBOX_ID); mailWithNoInternalDate.setModSeq(MOD_SEQ); mailWithNoInternalDate.setUid(UID); MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson( new DefaultTextExtractor(), ZoneId.of("Europe/Paris"), IndexAttachments.YES); String convertToJson = messageToElasticSearchJson.convertToJson(mailWithNoInternalDate, ImmutableList.of(USERNAME)); assertThatJson(convertToJson) .when(IGNORING_ARRAY_ORDER) .when(IGNORING_VALUES) .isEqualTo(ClassLoaderUtils.getSystemResourceAsString("eml/recursiveMail.json")); }
public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId, IndexAttachments indexAttachments); @Inject  MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments); }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId, IndexAttachments indexAttachments); @Inject  MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments); String convertToJson(MailboxMessage message, List<Username> usernames); String convertToJsonWithoutAttachment(MailboxMessage message, List<Username> usernames); String getUpdatedJsonMessagePart(Flags flags, ModSeq modSeq); }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId, IndexAttachments indexAttachments); @Inject  MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments); String convertToJson(MailboxMessage message, List<Username> usernames); String convertToJsonWithoutAttachment(MailboxMessage message, List<Username> usernames); String getUpdatedJsonMessagePart(Flags flags, ModSeq modSeq);  }