@Test public void testFindByDomain() throws TechnicalException { Certificate certificate = new Certificate(); certificate.setName("testName"); certificate.setDomain("testDomain"); certificateRepository.create(certificate).blockingGet(); TestObserver<Set<Certificate>> testObserver = certificateRepository.findByDomain("testDomain").test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(certificates -> certificates.size() == 1); }
@Override public Single<Set<Certificate>> findByDomain(String domain) { return Observable.fromPublisher(certificatesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Set<Certificate>> findByDomain(String domain) { return Observable.fromPublisher(certificatesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); } }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Set<Certificate>> findByDomain(String domain) { return Observable.fromPublisher(certificatesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Set<Certificate>> findByDomain(String domain) { return Observable.fromPublisher(certificatesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  @PostConstruct void init(); @Override Single<Set<Certificate>> findByDomain(String domain); @Override Single<Set<Certificate>> findAll(); @Override Maybe<Certificate> findById(String certificateId); @Override Single<Certificate> create(Certificate item); @Override Single<Certificate> update(Certificate item); @Override Completable delete(String id); }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Set<Certificate>> findByDomain(String domain) { return Observable.fromPublisher(certificatesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  @PostConstruct void init(); @Override Single<Set<Certificate>> findByDomain(String domain); @Override Single<Set<Certificate>> findAll(); @Override Maybe<Certificate> findById(String certificateId); @Override Single<Certificate> create(Certificate item); @Override Single<Certificate> update(Certificate item); @Override Completable delete(String id);  }