@Test void updateIndexOnAddShouldIncrementUnseenMessageCountWhenUnseen() throws Exception { MailboxMessage message = mock(MailboxMessage.class); when(message.createFlags()).thenReturn(new Flags()); when(message.getUid()).thenReturn(MESSAGE_UID); testee.updateIndexOnAdd(message, MAILBOX_ID).block(); Long actual = mailboxCounterDAO.countUnseenMessagesInMailbox(mailbox).block(); assertThat(actual).isEqualTo(1); }
public Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId) { Flags flags = message.createFlags(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, checkDeletedOnAdd(mailboxId, message.createFlags(), message.getUid()), updateFirstUnseenOnAdd(mailboxId, message.createFlags(), message.getUid()), addRecentOnSave(mailboxId, message), incrementCountersOnSave(mailboxId, flags), applicableFlagDAO.updateApplicableFlags(mailboxId, ImmutableSet.copyOf(flags.getUserFlags()))) .then(); }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId) { Flags flags = message.createFlags(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, checkDeletedOnAdd(mailboxId, message.createFlags(), message.getUid()), updateFirstUnseenOnAdd(mailboxId, message.createFlags(), message.getUid()), addRecentOnSave(mailboxId, message), incrementCountersOnSave(mailboxId, flags), applicableFlagDAO.updateApplicableFlags(mailboxId, ImmutableSet.copyOf(flags.getUserFlags()))) .then(); } }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId) { Flags flags = message.createFlags(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, checkDeletedOnAdd(mailboxId, message.createFlags(), message.getUid()), updateFirstUnseenOnAdd(mailboxId, message.createFlags(), message.getUid()), addRecentOnSave(mailboxId, message), incrementCountersOnSave(mailboxId, flags), applicableFlagDAO.updateApplicableFlags(mailboxId, ImmutableSet.copyOf(flags.getUserFlags()))) .then(); } @Inject  CassandraIndexTableHandler(CassandraMailboxRecentsDAO mailboxRecentDAO,
                                      CassandraMailboxCounterDAO mailboxCounterDAO,
                                      CassandraFirstUnseenDAO firstUnseenDAO,
                                      CassandraApplicableFlagDAO applicableFlagDAO,
                                      CassandraDeletedMessageDAO deletedMessageDAO); }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId) { Flags flags = message.createFlags(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, checkDeletedOnAdd(mailboxId, message.createFlags(), message.getUid()), updateFirstUnseenOnAdd(mailboxId, message.createFlags(), message.getUid()), addRecentOnSave(mailboxId, message), incrementCountersOnSave(mailboxId, flags), applicableFlagDAO.updateApplicableFlags(mailboxId, ImmutableSet.copyOf(flags.getUserFlags()))) .then(); } @Inject  CassandraIndexTableHandler(CassandraMailboxRecentsDAO mailboxRecentDAO,
                                      CassandraMailboxCounterDAO mailboxCounterDAO,
                                      CassandraFirstUnseenDAO firstUnseenDAO,
                                      CassandraApplicableFlagDAO applicableFlagDAO,
                                      CassandraDeletedMessageDAO deletedMessageDAO); Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId); Mono<Void> updateIndexOnDelete(CassandraId mailboxId, Collection<MessageMetaData> metaData); Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, UpdatedFlags updatedFlags); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, List<UpdatedFlags> updatedFlags); }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId) { Flags flags = message.createFlags(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, checkDeletedOnAdd(mailboxId, message.createFlags(), message.getUid()), updateFirstUnseenOnAdd(mailboxId, message.createFlags(), message.getUid()), addRecentOnSave(mailboxId, message), incrementCountersOnSave(mailboxId, flags), applicableFlagDAO.updateApplicableFlags(mailboxId, ImmutableSet.copyOf(flags.getUserFlags()))) .then(); } @Inject  CassandraIndexTableHandler(CassandraMailboxRecentsDAO mailboxRecentDAO,
                                      CassandraMailboxCounterDAO mailboxCounterDAO,
                                      CassandraFirstUnseenDAO firstUnseenDAO,
                                      CassandraApplicableFlagDAO applicableFlagDAO,
                                      CassandraDeletedMessageDAO deletedMessageDAO); Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId); Mono<Void> updateIndexOnDelete(CassandraId mailboxId, Collection<MessageMetaData> metaData); Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, UpdatedFlags updatedFlags); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, List<UpdatedFlags> updatedFlags);  }