@Test void findMailboxWithPathLikeShouldReturnMailboxesWhenExistsInBothTables() { mailboxDAO.save(MAILBOX) .block(); mailboxPathDAO.save(MAILBOX_PATH, MAILBOX_ID) .block(); mailboxPathV2DAO.save(MAILBOX_PATH, MAILBOX_ID) .block(); List<Mailbox> mailboxes = testee.findMailboxWithPathLike(MailboxQuery.builder() .privateNamespace() .username(USER) .expression(Wildcard.INSTANCE) .build() .asUserBound()) .collectList().block(); assertThat(mailboxes).containsOnly(MAILBOX); }
@Override public Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query) { String fixedNamespace = query.getFixedNamespace(); Username fixedUser = query.getFixedUser(); return listPaths(fixedNamespace, fixedUser) .filter(idAndPath -> query.isPathMatch(idAndPath.getMailboxPath())) .distinct(CassandraIdAndPath::getMailboxPath) .concatMap(this::retrieveMailbox); }
CassandraMailboxMapper implements MailboxMapper { @Override public Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query) { String fixedNamespace = query.getFixedNamespace(); Username fixedUser = query.getFixedUser(); return listPaths(fixedNamespace, fixedUser) .filter(idAndPath -> query.isPathMatch(idAndPath.getMailboxPath())) .distinct(CassandraIdAndPath::getMailboxPath) .concatMap(this::retrieveMailbox); } }
CassandraMailboxMapper implements MailboxMapper { @Override public Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query) { String fixedNamespace = query.getFixedNamespace(); Username fixedUser = query.getFixedUser(); return listPaths(fixedNamespace, fixedUser) .filter(idAndPath -> query.isPathMatch(idAndPath.getMailboxPath())) .distinct(CassandraIdAndPath::getMailboxPath) .concatMap(this::retrieveMailbox); } @Inject  CassandraMailboxMapper(CassandraMailboxDAO mailboxDAO,
                                  CassandraMailboxPathDAOImpl mailboxPathDAO,
                                  CassandraMailboxPathV2DAO mailboxPathV2DAO,
                                  CassandraUserMailboxRightsDAO userMailboxRightsDAO,
                                  CassandraACLMapper aclMapper,
                                  CassandraSchemaVersionManager versionManager); }
CassandraMailboxMapper implements MailboxMapper { @Override public Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query) { String fixedNamespace = query.getFixedNamespace(); Username fixedUser = query.getFixedUser(); return listPaths(fixedNamespace, fixedUser) .filter(idAndPath -> query.isPathMatch(idAndPath.getMailboxPath())) .distinct(CassandraIdAndPath::getMailboxPath) .concatMap(this::retrieveMailbox); } @Inject  CassandraMailboxMapper(CassandraMailboxDAO mailboxDAO,
                                  CassandraMailboxPathDAOImpl mailboxPathDAO,
                                  CassandraMailboxPathV2DAO mailboxPathV2DAO,
                                  CassandraUserMailboxRightsDAO userMailboxRightsDAO,
                                  CassandraACLMapper aclMapper,
                                  CassandraSchemaVersionManager versionManager); @Override Mono<Void> delete(Mailbox mailbox); @Override Mono<Mailbox> findMailboxByPath(MailboxPath path); @Override Mono<Boolean> pathExists(MailboxPath mailboxName); @Override Mono<Mailbox> findMailboxById(MailboxId id); @Override Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query); @Override Mono<Mailbox> create(MailboxPath mailboxPath, UidValidity uidValidity); @Override Mono<MailboxId> rename(Mailbox mailbox); @Override Mono<Boolean> hasChildren(Mailbox mailbox, char delimiter); @Override Flux<Mailbox> list(); @Override T execute(Transaction<T> transaction); @Override Mono<ACLDiff> updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand); @Override Mono<ACLDiff> setACL(Mailbox mailbox, MailboxACL mailboxACL); @Override void endRequest(); @Override Flux<Mailbox> findNonPersonalMailboxes(Username userName, Right right); }
CassandraMailboxMapper implements MailboxMapper { @Override public Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query) { String fixedNamespace = query.getFixedNamespace(); Username fixedUser = query.getFixedUser(); return listPaths(fixedNamespace, fixedUser) .filter(idAndPath -> query.isPathMatch(idAndPath.getMailboxPath())) .distinct(CassandraIdAndPath::getMailboxPath) .concatMap(this::retrieveMailbox); } @Inject  CassandraMailboxMapper(CassandraMailboxDAO mailboxDAO,
                                  CassandraMailboxPathDAOImpl mailboxPathDAO,
                                  CassandraMailboxPathV2DAO mailboxPathV2DAO,
                                  CassandraUserMailboxRightsDAO userMailboxRightsDAO,
                                  CassandraACLMapper aclMapper,
                                  CassandraSchemaVersionManager versionManager); @Override Mono<Void> delete(Mailbox mailbox); @Override Mono<Mailbox> findMailboxByPath(MailboxPath path); @Override Mono<Boolean> pathExists(MailboxPath mailboxName); @Override Mono<Mailbox> findMailboxById(MailboxId id); @Override Flux<Mailbox> findMailboxWithPathLike(MailboxQuery.UserBound query); @Override Mono<Mailbox> create(MailboxPath mailboxPath, UidValidity uidValidity); @Override Mono<MailboxId> rename(Mailbox mailbox); @Override Mono<Boolean> hasChildren(Mailbox mailbox, char delimiter); @Override Flux<Mailbox> list(); @Override T execute(Transaction<T> transaction); @Override Mono<ACLDiff> updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand); @Override Mono<ACLDiff> setACL(Mailbox mailbox, MailboxACL mailboxACL); @Override void endRequest(); @Override Flux<Mailbox> findNonPersonalMailboxes(Username userName, Right right);  }