@Test public void testFindByResources() throws TechnicalException { Resource resource1 = new Resource().setResourceScopes(Arrays.asList("a","b","c")).setDomain("domainA").setClientId(CLIENT_ID).setUserId(USER_ID); Resource resource2 = new Resource().setResourceScopes(Arrays.asList("d","e","f")).setDomain("domainB").setClientId(CLIENT_ID).setUserId(USER_ID); Resource rsCreated1 = repository.create(resource1).blockingGet(); Resource rsCreated2 = repository.create(resource2).blockingGet(); TestObserver<List<Resource>> testObserver = repository.findByResources(Arrays.asList(rsCreated1.getId(),rsCreated2.getId(),"notMatching")).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(resources -> resources.size() == 2); }
@Override public Single<List<Resource>> findByResources(List<String> resources) { return Observable.fromPublisher(resourceCollection.find(in(FIELD_ID, resources))).map(this::convert).toList(); }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Single<List<Resource>> findByResources(List<String> resources) { return Observable.fromPublisher(resourceCollection.find(in(FIELD_ID, resources))).map(this::convert).toList(); } }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Single<List<Resource>> findByResources(List<String> resources) { return Observable.fromPublisher(resourceCollection.find(in(FIELD_ID, resources))).map(this::convert).toList(); }  }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Single<List<Resource>> findByResources(List<String> resources) { return Observable.fromPublisher(resourceCollection.find(in(FIELD_ID, resources))).map(this::convert).toList(); }  @PostConstruct void init(); @Override Single<Page<Resource>> findByDomainAndClient(String domain, String client, int page, int size); @Override Maybe<Resource> findById(String id); @Override Single<Resource> create(Resource item); @Override Single<Resource> update(Resource item); @Override Completable delete(String id); @Override Single<List<Resource>> findByDomainAndClientAndUser(String domain, String client, String user); @Override Single<Page<Resource>> findByDomain(String domain, int page, int size); @Override Single<List<Resource>> findByResources(List<String> resources); @Override Single<List<Resource>> findByDomainAndClientAndResources(String domain, String client, List<String> resources); @Override Maybe<Resource> findByDomainAndClientAndUserAndResource(String domain, String client, String user, String resource); }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Single<List<Resource>> findByResources(List<String> resources) { return Observable.fromPublisher(resourceCollection.find(in(FIELD_ID, resources))).map(this::convert).toList(); }  @PostConstruct void init(); @Override Single<Page<Resource>> findByDomainAndClient(String domain, String client, int page, int size); @Override Maybe<Resource> findById(String id); @Override Single<Resource> create(Resource item); @Override Single<Resource> update(Resource item); @Override Completable delete(String id); @Override Single<List<Resource>> findByDomainAndClientAndUser(String domain, String client, String user); @Override Single<Page<Resource>> findByDomain(String domain, int page, int size); @Override Single<List<Resource>> findByResources(List<String> resources); @Override Single<List<Resource>> findByDomainAndClientAndResources(String domain, String client, List<String> resources); @Override Maybe<Resource> findByDomainAndClientAndUserAndResource(String domain, String client, String user, String resource); static final String COLLECTION_NAME; }