@Test public void processShouldNotSpoolMailWhenNotSavingToOutbox() throws Exception { SetMessagesRequest notInOutboxCreationRequest = SetMessagesRequest.builder() .create(CreationMessageId.of("anything-really"), creationMessageBuilder.mailboxId("any-id-but-outbox-id") .build()) .build(); when(mockedMailboxManager.getMailbox(any(MailboxId.class), any())) .thenReturn(outbox); when(mockedMailboxIdFactory.fromString(anyString())).thenReturn(OUTBOX_ID); sut.process(notInOutboxCreationRequest, session); verify(mockedMailSpool, never()).send(any(Mail.class), any(MailMetadata.class)); }
@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);  }