@Test void dateFromHeaderShouldUseCurrentCenturyWhenNone() throws Exception { String headers = "From: user <userdomain>\n" + "To: user1 <user1domain>, user2 <user2domain>\n" + "Cc: usercc <userccdomain>\n" + "Bcc: userbcc <userbccdomain>\n" + "Date: Wed, 17 May 17 14:18:52 +0300\n" + "Subject: test subject\n"; MetaDataWithContent testMail = MetaDataWithContent.builder() .uid(MessageUid.of(2)) .keywords(Keywords.strictFactory().from(Keyword.SEEN)) .size(headers.length()) .internalDate(INTERNAL_DATE) .content(new ByteArrayInputStream(headers.getBytes(StandardCharsets.UTF_8))) .attachments(ImmutableList.of()) .mailboxId(MAILBOX_ID) .messageId(new TestMessageId.Factory().generate()) .build(); MessageFullView testee = messageFullViewFactory.fromMetaDataWithContent(testMail).block(); assertThat(testee.getDate()) .isEqualTo(Instant.parse("2017-05-17T11:18:52.000Z")); }
public Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message) { return Mono.fromCallable(() -> Helpers.parse(message.getContent())) .flatMap(Throwing.function(mimeMessage -> fromMetaDataWithContent(message, mimeMessage))); }
MessageFullViewFactory implements MessageViewFactory<MessageFullView> { public Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message) { return Mono.fromCallable(() -> Helpers.parse(message.getContent())) .flatMap(Throwing.function(mimeMessage -> fromMetaDataWithContent(message, mimeMessage))); } }
MessageFullViewFactory implements MessageViewFactory<MessageFullView> { public Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message) { return Mono.fromCallable(() -> Helpers.parse(message.getContent())) .flatMap(Throwing.function(mimeMessage -> fromMetaDataWithContent(message, mimeMessage))); } @Inject  MessageFullViewFactory(BlobManager blobManager, MessageContentExtractor messageContentExtractor,
                                  HtmlTextExtractor htmlTextExtractor, MessageIdManager messageIdManager,
                                  MessageFastViewProjection fastViewProjection); }
MessageFullViewFactory implements MessageViewFactory<MessageFullView> { public Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message) { return Mono.fromCallable(() -> Helpers.parse(message.getContent())) .flatMap(Throwing.function(mimeMessage -> fromMetaDataWithContent(message, mimeMessage))); } @Inject  MessageFullViewFactory(BlobManager blobManager, MessageContentExtractor messageContentExtractor,
                                  HtmlTextExtractor htmlTextExtractor, MessageIdManager messageIdManager,
                                  MessageFastViewProjection fastViewProjection); @Override Flux<MessageFullView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession); Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message); }
MessageFullViewFactory implements MessageViewFactory<MessageFullView> { public Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message) { return Mono.fromCallable(() -> Helpers.parse(message.getContent())) .flatMap(Throwing.function(mimeMessage -> fromMetaDataWithContent(message, mimeMessage))); } @Inject  MessageFullViewFactory(BlobManager blobManager, MessageContentExtractor messageContentExtractor,
                                  HtmlTextExtractor htmlTextExtractor, MessageIdManager messageIdManager,
                                  MessageFastViewProjection fastViewProjection); @Override Flux<MessageFullView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession); Mono<MessageFullView> fromMetaDataWithContent(MetaDataWithContent message);  }