@Test public void testFindAll() throws TechnicalException { Role role1 = new Role(); role1.setName("testName1"); role1.setReferenceType(ReferenceType.DOMAIN); role1.setReferenceId(DOMAIN_ID); Role roleCreated1 = roleRepository.create(role1).blockingGet(); Role role2 = new Role(); role2.setName("testName2"); role2.setReferenceType(ReferenceType.DOMAIN); role2.setReferenceId(DOMAIN_ID); Role roleCreated2 = roleRepository.create(role2).blockingGet(); Role role3 = new Role(); role3.setName("testName3"); role3.setReferenceType(ReferenceType.DOMAIN); role3.setReferenceId("domain#2"); roleRepository.create(role3).blockingGet(); TestSubscriber<Role> testObserver = roleRepository.findAll(ReferenceType.DOMAIN, DOMAIN_ID).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValueCount(2); List<Role> roles = testObserver.values(); assertTrue(roles.stream().anyMatch(role -> role.getId().equals(roleCreated1.getId()))); assertTrue(roles.stream().anyMatch(role -> role.getId().equals(roleCreated2.getId()))); }
@Override public Flowable<Role> findAll(ReferenceType referenceType, String referenceId) { return Flowable.fromPublisher(rolesCollection.find(and(eq(FIELD_REFERENCE_TYPE, referenceType == null ? null : referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId)))).map(this::convert); }
MongoRoleRepository extends AbstractManagementMongoRepository implements RoleRepository { @Override public Flowable<Role> findAll(ReferenceType referenceType, String referenceId) { return Flowable.fromPublisher(rolesCollection.find(and(eq(FIELD_REFERENCE_TYPE, referenceType == null ? null : referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId)))).map(this::convert); } }
MongoRoleRepository extends AbstractManagementMongoRepository implements RoleRepository { @Override public Flowable<Role> findAll(ReferenceType referenceType, String referenceId) { return Flowable.fromPublisher(rolesCollection.find(and(eq(FIELD_REFERENCE_TYPE, referenceType == null ? null : referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId)))).map(this::convert); }  }
MongoRoleRepository extends AbstractManagementMongoRepository implements RoleRepository { @Override public Flowable<Role> findAll(ReferenceType referenceType, String referenceId) { return Flowable.fromPublisher(rolesCollection.find(and(eq(FIELD_REFERENCE_TYPE, referenceType == null ? null : referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId)))).map(this::convert); }  @PostConstruct void init(); @Override Flowable<Role> findAll(ReferenceType referenceType, String referenceId); @Override Single<Set<Role>> findByDomain(String domain); @Override Single<Set<Role>> findByIdIn(List<String> ids); @Override Maybe<Role> findById(ReferenceType referenceType, String referenceId, String role); @Override Maybe<Role> findById(String role); @Override Single<Role> create(Role item); @Override Single<Role> update(Role item); @Override Completable delete(String id); @Override Maybe<Role> findByNameAndAssignableType(ReferenceType referenceType, String referenceId, String name, ReferenceType assignableType); }
MongoRoleRepository extends AbstractManagementMongoRepository implements RoleRepository { @Override public Flowable<Role> findAll(ReferenceType referenceType, String referenceId) { return Flowable.fromPublisher(rolesCollection.find(and(eq(FIELD_REFERENCE_TYPE, referenceType == null ? null : referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId)))).map(this::convert); }  @PostConstruct void init(); @Override Flowable<Role> findAll(ReferenceType referenceType, String referenceId); @Override Single<Set<Role>> findByDomain(String domain); @Override Single<Set<Role>> findByIdIn(List<String> ids); @Override Maybe<Role> findById(ReferenceType referenceType, String referenceId, String role); @Override Maybe<Role> findById(String role); @Override Single<Role> create(Role item); @Override Single<Role> update(Role item); @Override Completable delete(String id); @Override Maybe<Role> findByNameAndAssignableType(ReferenceType referenceType, String referenceId, String name, ReferenceType assignableType); static final String FIELD_SYSTEM; }