@Test public void testFindById() throws TechnicalException { Resource resource = new Resource().setResourceScopes(Arrays.asList("a","b","c")); Resource rsCreated = repository.create(resource).blockingGet(); TestObserver<Resource> testObserver = repository.findById(rsCreated.getId()).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(s -> s.getResourceScopes().containsAll(Arrays.asList("a","b","c"))); }
@Override public Maybe<Resource> findById(String id) { return Observable.fromPublisher(resourceCollection.find(eq(FIELD_ID, id)).first()).firstElement().map(this::convert); }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Maybe<Resource> findById(String id) { return Observable.fromPublisher(resourceCollection.find(eq(FIELD_ID, id)).first()).firstElement().map(this::convert); } }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Maybe<Resource> findById(String id) { return Observable.fromPublisher(resourceCollection.find(eq(FIELD_ID, id)).first()).firstElement().map(this::convert); }  }
MongoResourceRepository extends AbstractManagementMongoRepository implements ResourceRepository { @Override public Maybe<Resource> findById(String id) { return Observable.fromPublisher(resourceCollection.find(eq(FIELD_ID, id)).first()).firstElement().map(this::convert); }  @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 Maybe<Resource> findById(String id) { return Observable.fromPublisher(resourceCollection.find(eq(FIELD_ID, id)).first()).firstElement().map(this::convert); }  @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; }