@Test public void sendShouldPositionJMAPRelatedMetadata() throws Exception { FakeMail mail = FakeMail.builder() .name(NAME) .build(); mailSpool.send(mail, new MailMetadata(MESSAGE_ID, USERNAME)); MailQueueItem actual = Flux.from(myQueue.deQueue()).blockFirst(); assertThat(actual.getMail().getAttribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE)) .contains(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of(USERNAME))); assertThat(actual.getMail().getAttribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE)) .contains(new Attribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE, AttributeValue.of(MESSAGE_ID.serialize()))); }
public void send(Mail mail, MailMetadata metadata) throws MailQueueException { mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE, AttributeValue.of(metadata.getMessageId().serialize()))); mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of(metadata.getUsername()))); queue.enQueue(mail); }
MailSpool implements Startable, Disposable { public void send(Mail mail, MailMetadata metadata) throws MailQueueException { mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE, AttributeValue.of(metadata.getMessageId().serialize()))); mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of(metadata.getUsername()))); queue.enQueue(mail); } }
MailSpool implements Startable, Disposable { public void send(Mail mail, MailMetadata metadata) throws MailQueueException { mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE, AttributeValue.of(metadata.getMessageId().serialize()))); mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of(metadata.getUsername()))); queue.enQueue(mail); } @Inject @VisibleForTesting  MailSpool(MailQueueFactory<?> queueFactory); }
MailSpool implements Startable, Disposable { public void send(Mail mail, MailMetadata metadata) throws MailQueueException { mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE, AttributeValue.of(metadata.getMessageId().serialize()))); mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of(metadata.getUsername()))); queue.enQueue(mail); } @Inject @VisibleForTesting  MailSpool(MailQueueFactory<?> queueFactory); void start(); @PreDestroy void dispose(); void send(Mail mail, MailMetadata metadata); }
MailSpool implements Startable, Disposable { public void send(Mail mail, MailMetadata metadata) throws MailQueueException { mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE, AttributeValue.of(metadata.getMessageId().serialize()))); mail.setAttribute(new Attribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE, AttributeValue.of(metadata.getUsername()))); queue.enQueue(mail); } @Inject @VisibleForTesting  MailSpool(MailQueueFactory<?> queueFactory); void start(); @PreDestroy void dispose(); void send(Mail mail, MailMetadata metadata);  }