@Ignore("JAMES-1716 : should report an error") @Test public void processShouldReturnErrorWhenOutboxNotFound() { TestSystemMailboxesProvider doNotProvideOutbox = new TestSystemMailboxesProvider(Optional::empty, () -> optionalDrafts); SetMessagesCreationProcessor sut = new SetMessagesCreationProcessor(messageFullViewFactory, doNotProvideOutbox, new AttachmentChecker(mockedAttachmentManager), new RecordingMetricFactory(), mockedMailboxManager, mockedMailboxIdFactory, messageAppender, messageSender, referenceUpdater, canSendFrom); SetMessagesResponse actual = sut.process(createMessageInOutbox, session); assertThat(actual.getNotCreated()).hasSize(1).containsKey(creationMessageId); assertThat(actual.getNotCreated().get(creationMessageId).getType()).isEqualTo("invalidProperties"); assertThat(actual.getNotCreated().get(creationMessageId).getDescription()).contains("target mailbox does not exists"); }
@Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); @Override SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); @Override SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession);  }