@Test public void testFindByDomain() { Scope scope = new Scope(); scope.setName("testName"); scope.setDomain("testDomain"); scopeRepository.create(scope).blockingGet(); TestObserver<Set<Scope>> testObserver = scopeRepository.findByDomain("testDomain").test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(scopes -> scopes.size() == 1); }
@Override public Single<Set<Scope>> findByDomain(String domain) { return Observable.fromPublisher(scopesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Set<Scope>> findByDomain(String domain) { return Observable.fromPublisher(scopesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); } }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Set<Scope>> findByDomain(String domain) { return Observable.fromPublisher(scopesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  }
MongoScopeRepository extends AbstractManagementMongoRepository implements ScopeRepository { @Override public Single<Set<Scope>> findByDomain(String domain) { return Observable.fromPublisher(scopesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  @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<Set<Scope>> findByDomain(String domain) { return Observable.fromPublisher(scopesCollection.find(eq(FIELD_DOMAIN, domain))).map(this::convert).collect(HashSet::new, Set::add); }  @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);  }