@Test public void testCreate() throws TechnicalException { Application application = new Application(); application.setName("testClientId"); TestObserver<Application> testObserver = applicationRepository.create(application).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(a -> a.getName().equals(application.getName())); }
@Override public Single<Application> create(Application item) { ApplicationMongo application = convert(item); application.setId(application.getId() == null ? RandomString.generate() : application.getId()); return Single.fromPublisher(applicationsCollection.insertOne(application)).flatMap(success -> findById(application.getId()).toSingle()); }
MongoApplicationRepository extends AbstractManagementMongoRepository implements ApplicationRepository { @Override public Single<Application> create(Application item) { ApplicationMongo application = convert(item); application.setId(application.getId() == null ? RandomString.generate() : application.getId()); return Single.fromPublisher(applicationsCollection.insertOne(application)).flatMap(success -> findById(application.getId()).toSingle()); } }
MongoApplicationRepository extends AbstractManagementMongoRepository implements ApplicationRepository { @Override public Single<Application> create(Application item) { ApplicationMongo application = convert(item); application.setId(application.getId() == null ? RandomString.generate() : application.getId()); return Single.fromPublisher(applicationsCollection.insertOne(application)).flatMap(success -> findById(application.getId()).toSingle()); }  }
MongoApplicationRepository extends AbstractManagementMongoRepository implements ApplicationRepository { @Override public Single<Application> create(Application item) { ApplicationMongo application = convert(item); application.setId(application.getId() == null ? RandomString.generate() : application.getId()); return Single.fromPublisher(applicationsCollection.insertOne(application)).flatMap(success -> findById(application.getId()).toSingle()); }  @PostConstruct void init(); @Override Single<List<Application>> findAll(); @Override Single<Page<Application>> findAll(int page, int size); @Override Single<Page<Application>> findByDomain(String domain, int page, int size); @Override Single<Page<Application>> search(String domain, String query, int page, int size); @Override Single<Set<Application>> findByCertificate(String certificate); @Override Single<Set<Application>> findByIdentityProvider(String identityProvider); @Override Single<Set<Application>> findByFactor(String factor); @Override Maybe<Application> findById(String id); @Override Maybe<Application> findByDomainAndClientId(String domain, String clientId); @Override Single<Set<Application>> findByDomainAndExtensionGrant(String domain, String extensionGrant); @Override Single<Set<Application>> findByIdIn(List<String> ids); @Override Single<Application> create(Application item); @Override Single<Application> update(Application item); @Override Completable delete(String id); @Override Single<Long> count(); @Override Single<Long> countByDomain(String domain); }
MongoApplicationRepository extends AbstractManagementMongoRepository implements ApplicationRepository { @Override public Single<Application> create(Application item) { ApplicationMongo application = convert(item); application.setId(application.getId() == null ? RandomString.generate() : application.getId()); return Single.fromPublisher(applicationsCollection.insertOne(application)).flatMap(success -> findById(application.getId()).toSingle()); }  @PostConstruct void init(); @Override Single<List<Application>> findAll(); @Override Single<Page<Application>> findAll(int page, int size); @Override Single<Page<Application>> findByDomain(String domain, int page, int size); @Override Single<Page<Application>> search(String domain, String query, int page, int size); @Override Single<Set<Application>> findByCertificate(String certificate); @Override Single<Set<Application>> findByIdentityProvider(String identityProvider); @Override Single<Set<Application>> findByFactor(String factor); @Override Maybe<Application> findById(String id); @Override Maybe<Application> findByDomainAndClientId(String domain, String clientId); @Override Single<Set<Application>> findByDomainAndExtensionGrant(String domain, String extensionGrant); @Override Single<Set<Application>> findByIdIn(List<String> ids); @Override Single<Application> create(Application item); @Override Single<Application> update(Application item); @Override Completable delete(String id); @Override Single<Long> count(); @Override Single<Long> countByDomain(String domain);  }