@Test public void testFindAllByEnvironment() throws TechnicalException { Domain domain = new Domain(); domain.setName("testName"); domain.setReferenceType(ReferenceType.ENVIRONMENT); domain.setReferenceId("environment#1"); domainRepository.create(domain).blockingGet(); Domain otherDomain = new Domain(); otherDomain.setName("testName"); otherDomain.setReferenceType(ReferenceType.ENVIRONMENT); otherDomain.setReferenceId("environment#2"); domainRepository.create(otherDomain).blockingGet(); TestSubscriber<Domain> testObserver1 = domainRepository.findAllByEnvironment("environment#1").test(); testObserver1.awaitTerminalEvent(); testObserver1.assertComplete(); testObserver1.assertNoErrors(); testObserver1.assertValueCount(1); }
@Override public Flowable<Domain> findAllByEnvironment(String environmentId) { return Flowable.fromPublisher(domainsCollection.find(and(eq(FIELD_REFERENCE_TYPE, ReferenceType.ENVIRONMENT.name()), eq(FIELD_REFERENCE_ID, environmentId)))).map(this::convert); }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Flowable<Domain> findAllByEnvironment(String environmentId) { return Flowable.fromPublisher(domainsCollection.find(and(eq(FIELD_REFERENCE_TYPE, ReferenceType.ENVIRONMENT.name()), eq(FIELD_REFERENCE_ID, environmentId)))).map(this::convert); } }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Flowable<Domain> findAllByEnvironment(String environmentId) { return Flowable.fromPublisher(domainsCollection.find(and(eq(FIELD_REFERENCE_TYPE, ReferenceType.ENVIRONMENT.name()), eq(FIELD_REFERENCE_ID, environmentId)))).map(this::convert); }  }
MongoDomainRepository extends AbstractManagementMongoRepository implements DomainRepository { @Override public Flowable<Domain> findAllByEnvironment(String environmentId) { return Flowable.fromPublisher(domainsCollection.find(and(eq(FIELD_REFERENCE_TYPE, ReferenceType.ENVIRONMENT.name()), eq(FIELD_REFERENCE_ID, environmentId)))).map(this::convert); }  @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 Flowable<Domain> findAllByEnvironment(String environmentId) { return Flowable.fromPublisher(domainsCollection.find(and(eq(FIELD_REFERENCE_TYPE, ReferenceType.ENVIRONMENT.name()), eq(FIELD_REFERENCE_ID, environmentId)))).map(this::convert); }  @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);  }