@Test public void testUpdate() { Scope scope = new Scope(); scope.setName("testName"); Scope scopeCreated = scopeRepository.create(scope).blockingGet(); Scope updatedScope = new Scope(); updatedScope.setId(scopeCreated.getId()); updatedScope.setName("testUpdatedName"); TestObserver<Scope> testObserver = scopeRepository.update(updatedScope).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(s -> s.getName().equals(updatedScope.getName())); }
@Override public Single<Scope> update(Scope item) { ScopeMongo scope = convert(item); return Single.fromPublisher(scopesCollection.replaceOne(eq(FIELD_ID, scope.getId()), scope)).flatMap(updateResult -> findById(scope.getId()).toSingle()); }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Scope> update(Scope item) { ScopeMongo scope = convert(item); return Single.fromPublisher(scopesCollection.replaceOne(eq(FIELD_ID, scope.getId()), scope)).flatMap(updateResult -> findById(scope.getId()).toSingle()); } }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Scope> update(Scope item) { ScopeMongo scope = convert(item); return Single.fromPublisher(scopesCollection.replaceOne(eq(FIELD_ID, scope.getId()), scope)).flatMap(updateResult -> findById(scope.getId()).toSingle()); }  }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Scope> update(Scope item) { ScopeMongo scope = convert(item); return Single.fromPublisher(scopesCollection.replaceOne(eq(FIELD_ID, scope.getId()), scope)).flatMap(updateResult -> findById(scope.getId()).toSingle()); }  @PostConstruct void init(); @Override Maybe<Scope> findById(String id); @Override Single<Scope> create(Scope item); @Override Single<Scope> update(Scope item); @Override Completable delete(String id); @Override Single<Set<Scope>> findByDomain(String domain); @Override Maybe<Scope> findByDomainAndKey(String domain, String key); @Override Single<List<Scope>> findByDomainAndKeys(String domain, List<String> keys); }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Scope> update(Scope item) { ScopeMongo scope = convert(item); return Single.fromPublisher(scopesCollection.replaceOne(eq(FIELD_ID, scope.getId()), scope)).flatMap(updateResult -> findById(scope.getId()).toSingle()); }  @PostConstruct void init(); @Override Maybe<Scope> findById(String id); @Override Single<Scope> create(Scope item); @Override Single<Scope> update(Scope item); @Override Completable delete(String id); @Override Single<Set<Scope>> findByDomain(String domain); @Override Maybe<Scope> findByDomainAndKey(String domain, String key); @Override Single<List<Scope>> findByDomainAndKeys(String domain, List<String> keys);  }