@Test public void testCreate() throws TechnicalException { Domain domain = new Domain(); domain.setName("testName"); TestObserver<Domain> testObserver = domainRepository.create(domain).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(domainCreated -> domainCreated.getName().equals(domain.getName())); }
@Override public Single<Domain> create(Domain item) { DomainMongo domain = convert(item); domain.setId(domain.getId() == null ? RandomString.generate() : domain.getId()); return Single.fromPublisher(domainsCollection.insertOne(domain)).flatMap(success -> findById(domain.getId()).toSingle()); }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> create(Domain item) { DomainMongo domain = convert(item); domain.setId(domain.getId() == null ? RandomString.generate() : domain.getId()); return Single.fromPublisher(domainsCollection.insertOne(domain)).flatMap(success -> findById(domain.getId()).toSingle()); } }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> create(Domain item) { DomainMongo domain = convert(item); domain.setId(domain.getId() == null ? RandomString.generate() : domain.getId()); return Single.fromPublisher(domainsCollection.insertOne(domain)).flatMap(success -> findById(domain.getId()).toSingle()); }  }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> create(Domain item) { DomainMongo domain = convert(item); domain.setId(domain.getId() == null ? RandomString.generate() : domain.getId()); return Single.fromPublisher(domainsCollection.insertOne(domain)).flatMap(success -> findById(domain.getId()).toSingle()); }  @PostConstruct void init(); @Override Single<Set<Domain>> findAll(); @Override Maybe<Domain> findById(String id); @Override Single<Set<Domain>> findByIdIn(Collection<String> ids); @Override Flowable<Domain> findAllByEnvironment(String environmentId); @Override Maybe<Domain> findMaster(); @Override Single<Domain> create(Domain item); @Override Single<Domain> update(Domain item); @Override Completable delete(String id); }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Single<Domain> create(Domain item) { DomainMongo domain = convert(item); domain.setId(domain.getId() == null ? RandomString.generate() : domain.getId()); return Single.fromPublisher(domainsCollection.insertOne(domain)).flatMap(success -> findById(domain.getId()).toSingle()); }  @PostConstruct void init(); @Override Single<Set<Domain>> findAll(); @Override Maybe<Domain> findById(String id); @Override Single<Set<Domain>> findByIdIn(Collection<String> ids); @Override Flowable<Domain> findAllByEnvironment(String environmentId); @Override Maybe<Domain> findMaster(); @Override Single<Domain> create(Domain item); @Override Single<Domain> update(Domain item); @Override Completable delete(String id);  }