@Test public void testFindById() throws TechnicalException { IdentityProvider identityProvider = new IdentityProvider(); identityProvider.setName("testName"); IdentityProvider identityProviderCreated = identityProviderRepository.create(identityProvider).blockingGet(); TestObserver<IdentityProvider> testObserver = identityProviderRepository.findById(identityProviderCreated.getId()).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(idp -> idp.getName().equals("testName")); }
@Override public Maybe<IdentityProvider> findById(String identityProviderId) { return Observable.fromPublisher(identitiesCollection.find(eq(FIELD_ID, identityProviderId)).first()).firstElement().map(this::convert); }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Maybe<IdentityProvider> findById(String identityProviderId) { return Observable.fromPublisher(identitiesCollection.find(eq(FIELD_ID, identityProviderId)).first()).firstElement().map(this::convert); } }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Maybe<IdentityProvider> findById(String identityProviderId) { return Observable.fromPublisher(identitiesCollection.find(eq(FIELD_ID, identityProviderId)).first()).firstElement().map(this::convert); }  }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Maybe<IdentityProvider> findById(String identityProviderId) { return Observable.fromPublisher(identitiesCollection.find(eq(FIELD_ID, identityProviderId)).first()).firstElement().map(this::convert); }  @PostConstruct void init(); @Override Single<Set<IdentityProvider>> findAll(ReferenceType referenceType, String referenceId); @Override Single<Set<IdentityProvider>> findAll(); @Override Single<Set<IdentityProvider>> findByDomain(String domain); @Override Maybe<IdentityProvider> findById(String identityProviderId); @Override Maybe<IdentityProvider> findById(ReferenceType referenceType, String referenceId, String identityProviderId); @Override Single<IdentityProvider> create(IdentityProvider item); @Override Single<IdentityProvider> update(IdentityProvider item); @Override Completable delete(String id); }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Maybe<IdentityProvider> findById(String identityProviderId) { return Observable.fromPublisher(identitiesCollection.find(eq(FIELD_ID, identityProviderId)).first()).firstElement().map(this::convert); }  @PostConstruct void init(); @Override Single<Set<IdentityProvider>> findAll(ReferenceType referenceType, String referenceId); @Override Single<Set<IdentityProvider>> findAll(); @Override Single<Set<IdentityProvider>> findByDomain(String domain); @Override Maybe<IdentityProvider> findById(String identityProviderId); @Override Maybe<IdentityProvider> findById(ReferenceType referenceType, String referenceId, String identityProviderId); @Override Single<IdentityProvider> create(IdentityProvider item); @Override Single<IdentityProvider> update(IdentityProvider item); @Override Completable delete(String id);  }