@Test public void testCreate() throws TechnicalException { Certificate certificate = new Certificate(); certificate.setName("testName"); TestObserver<Certificate> testObserver = certificateRepository.create(certificate).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(domainCreated -> domainCreated.getName().equals(certificate.getName())); }
@Override public Single<Certificate> create(Certificate item) { CertificateMongo certificate = convert(item); certificate.setId(certificate.getId() == null ? RandomString.generate() : certificate.getId()); return Single.fromPublisher(certificatesCollection.insertOne(certificate)).flatMap(success -> findById(certificate.getId()).toSingle()); }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Certificate> create(Certificate item) { CertificateMongo certificate = convert(item); certificate.setId(certificate.getId() == null ? RandomString.generate() : certificate.getId()); return Single.fromPublisher(certificatesCollection.insertOne(certificate)).flatMap(success -> findById(certificate.getId()).toSingle()); } }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Certificate> create(Certificate item) { CertificateMongo certificate = convert(item); certificate.setId(certificate.getId() == null ? RandomString.generate() : certificate.getId()); return Single.fromPublisher(certificatesCollection.insertOne(certificate)).flatMap(success -> findById(certificate.getId()).toSingle()); }  }
MongoCertificateRepository extends AbstractManagementMongoRepository implements CertificateRepository { @Override public Single<Certificate> create(Certificate item) { CertificateMongo certificate = convert(item); certificate.setId(certificate.getId() == null ? RandomString.generate() : certificate.getId()); return Single.fromPublisher(certificatesCollection.insertOne(certificate)).flatMap(success -> findById(certificate.getId()).toSingle()); }  @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<Certificate> create(Certificate item) { CertificateMongo certificate = convert(item); certificate.setId(certificate.getId() == null ? RandomString.generate() : certificate.getId()); return Single.fromPublisher(certificatesCollection.insertOne(certificate)).flatMap(success -> findById(certificate.getId()).toSingle()); }  @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);  }