@Test public void testUpdate() throws TechnicalException { Domain domain = new Domain(); domain.setName("testName"); Domain domainCreated = domainRepository.create(domain).blockingGet(); Domain updatedDomain = new Domain(); updatedDomain.setId(domainCreated.getId()); updatedDomain.setName("testUpdatedName"); TestObserver<Domain> testObserver = domainRepository.update(updatedDomain).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(d -> d.getName().equals(updatedDomain.getName())); }
@Override public Single<Domain> update(Domain item) { DomainMongo domain = convert(item); return Single.fromPublisher(domainsCollection.replaceOne(eq(FIELD_ID, domain.getId()), domain)).flatMap(updateResult -> findById(domain.getId()).toSingle()); }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> update(Domain item) { DomainMongo domain = convert(item); return Single.fromPublisher(domainsCollection.replaceOne(eq(FIELD_ID, domain.getId()), domain)).flatMap(updateResult -> findById(domain.getId()).toSingle()); } }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> update(Domain item) { DomainMongo domain = convert(item); return Single.fromPublisher(domainsCollection.replaceOne(eq(FIELD_ID, domain.getId()), domain)).flatMap(updateResult -> findById(domain.getId()).toSingle()); }  }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> update(Domain item) { DomainMongo domain = convert(item); return Single.fromPublisher(domainsCollection.replaceOne(eq(FIELD_ID, domain.getId()), domain)).flatMap(updateResult -> findById(domain.getId()).toSingle()); }  @PostConstruct void init(); @Override Single<Set<Domain>> findAll(); @Override Maybe<Domain> findById(String id); @Override Single<Set<Domain>> findByIdIn(Collection<String> ids); @Override Flowable<Domain> findAllByEnvironment(String environmentId); @Override Maybe<Domain> findMaster(); @Override Single<Domain> create(Domain item); @Override Single<Domain> update(Domain item); @Override Completable delete(String id); }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> update(Domain item) { DomainMongo domain = convert(item); return Single.fromPublisher(domainsCollection.replaceOne(eq(FIELD_ID, domain.getId()), domain)).flatMap(updateResult -> findById(domain.getId()).toSingle()); }  @PostConstruct void init(); @Override Single<Set<Domain>> findAll(); @Override Maybe<Domain> findById(String id); @Override Single<Set<Domain>> findByIdIn(Collection<String> ids); @Override Flowable<Domain> findAllByEnvironment(String environmentId); @Override Maybe<Domain> findMaster(); @Override Single<Domain> create(Domain item); @Override Single<Domain> update(Domain item); @Override Completable delete(String id);  }