@Test void eventShouldCallSpamAssassinHamLearningWhenTheMessageIsAddedInInbox() throws Exception { SimpleMailboxMessage message = createMessage(inbox); MailboxListener.Added addedEvent = EventFactory.added() .randomEventId() .mailboxSession(MAILBOX_SESSION) .mailbox(inbox) .addMetaData(message.metaData()) .build(); listener.event(addedEvent); verify(spamAssassin).learnHam(any(), any()); }
@Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); @Override Group getDefaultGroup(); @Override ExecutionMode getExecutionMode(); @Override boolean isHandling(Event event); @Override void event(Event event); }
SpamAssassinListener implements SpamEventListener { @Override public void event(Event event) throws MailboxException { Username username = Username.of(getClass().getCanonicalName()); if (event instanceof MessageMoveEvent) { MailboxSession session = mailboxManager.createSystemSession(username); handleMessageMove(event, session, (MessageMoveEvent) event); } if (event instanceof Added) { MailboxSession session = mailboxManager.createSystemSession(username); handleAdded(event, session, (Added) event); } } @Inject  SpamAssassinListener(SpamAssassin spamAssassin, SystemMailboxesProvider systemMailboxesProvider, MailboxManager mailboxManager, MailboxSessionMapperFactory mapperFactory, ExecutionMode executionMode); @Override Group getDefaultGroup(); @Override ExecutionMode getExecutionMode(); @Override boolean isHandling(Event event); @Override void event(Event event);  }