@Test public void testUpdate() throws TechnicalException { IdentityProvider identityProvider = new IdentityProvider(); identityProvider.setName("testName"); IdentityProvider identityProviderCreated = identityProviderRepository.create(identityProvider).blockingGet(); IdentityProvider updatedIdentityProvider = new IdentityProvider(); updatedIdentityProvider.setId(identityProviderCreated.getId()); updatedIdentityProvider.setName("testUpdatedName"); TestObserver<IdentityProvider> testObserver = identityProviderRepository.update(updatedIdentityProvider).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(idp -> idp.getName().equals(updatedIdentityProvider.getName())); }
@Override public Single<IdentityProvider> update(IdentityProvider item) { IdentityProviderMongo identityProvider = convert(item); return Single.fromPublisher(identitiesCollection.replaceOne(eq(FIELD_ID, identityProvider.getId()), identityProvider)).flatMap(updateResult -> findById(identityProvider.getId()).toSingle()); }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Single<IdentityProvider> update(IdentityProvider item) { IdentityProviderMongo identityProvider = convert(item); return Single.fromPublisher(identitiesCollection.replaceOne(eq(FIELD_ID, identityProvider.getId()), identityProvider)).flatMap(updateResult -> findById(identityProvider.getId()).toSingle()); } }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Single<IdentityProvider> update(IdentityProvider item) { IdentityProviderMongo identityProvider = convert(item); return Single.fromPublisher(identitiesCollection.replaceOne(eq(FIELD_ID, identityProvider.getId()), identityProvider)).flatMap(updateResult -> findById(identityProvider.getId()).toSingle()); }  }
MongoIdentityProviderRepository extends AbstractManagementMongoRepository implements IdentityProviderRepository { @Override public Single<IdentityProvider> update(IdentityProvider item) { IdentityProviderMongo identityProvider = convert(item); return Single.fromPublisher(identitiesCollection.replaceOne(eq(FIELD_ID, identityProvider.getId()), identityProvider)).flatMap(updateResult -> findById(identityProvider.getId()).toSingle()); }  @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 Single<IdentityProvider> update(IdentityProvider item) { IdentityProviderMongo identityProvider = convert(item); return Single.fromPublisher(identitiesCollection.replaceOne(eq(FIELD_ID, identityProvider.getId()), identityProvider)).flatMap(updateResult -> findById(identityProvider.getId()).toSingle()); }  @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);  }