@Test public void findByCredentialId() throws TechnicalException { Credential credential = new Credential(); credential.setReferenceType(ReferenceType.DOMAIN); credential.setReferenceId("domainId"); credential.setCredentialId("credentialId"); credential.setUserId("userId"); credential.setUsername("username"); credentialRepository.create(credential).blockingGet(); TestObserver<List<Credential>> testObserver = credentialRepository .findByCredentialId(credential.getReferenceType(), credential.getReferenceId(), credential.getCredentialId()).test(); testObserver.awaitTerminalEvent(); testObserver.assertComplete(); testObserver.assertNoErrors(); testObserver.assertValue(credentials -> credentials.size() == 1); }
@Override public Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId) { return Observable.fromPublisher( credentialsCollection.find( and( eq(FIELD_REFERENCE_TYPE, referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId), eq(FIELD_CREDENTIAL_ID, credentialId) ) )) .map(this::convert).toList(); }
MongoCredentialRepository extends AbstractManagementMongoRepository implements CredentialRepository { @Override public Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId) { return Observable.fromPublisher( credentialsCollection.find( and( eq(FIELD_REFERENCE_TYPE, referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId), eq(FIELD_CREDENTIAL_ID, credentialId) ) )) .map(this::convert).toList(); } }
MongoCredentialRepository extends AbstractManagementMongoRepository implements CredentialRepository { @Override public Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId) { return Observable.fromPublisher( credentialsCollection.find( and( eq(FIELD_REFERENCE_TYPE, referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId), eq(FIELD_CREDENTIAL_ID, credentialId) ) )) .map(this::convert).toList(); }  }
MongoCredentialRepository extends AbstractManagementMongoRepository implements CredentialRepository { @Override public Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId) { return Observable.fromPublisher( credentialsCollection.find( and( eq(FIELD_REFERENCE_TYPE, referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId), eq(FIELD_CREDENTIAL_ID, credentialId) ) )) .map(this::convert).toList(); }  @PostConstruct void init(); @Override Single<List<Credential>> findByUserId(ReferenceType referenceType, String referenceId, String userId); @Override Single<List<Credential>> findByUsername(ReferenceType referenceType, String referenceId, String username); @Override Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId); @Override Maybe<Credential> findById(String id); @Override Single<Credential> create(Credential item); @Override Single<Credential> update(Credential item); @Override Completable delete(String id); }
MongoCredentialRepository extends AbstractManagementMongoRepository implements CredentialRepository { @Override public Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId) { return Observable.fromPublisher( credentialsCollection.find( and( eq(FIELD_REFERENCE_TYPE, referenceType.name()), eq(FIELD_REFERENCE_ID, referenceId), eq(FIELD_CREDENTIAL_ID, credentialId) ) )) .map(this::convert).toList(); }  @PostConstruct void init(); @Override Single<List<Credential>> findByUserId(ReferenceType referenceType, String referenceId, String userId); @Override Single<List<Credential>> findByUsername(ReferenceType referenceType, String referenceId, String username); @Override Single<List<Credential>> findByCredentialId(ReferenceType referenceType, String referenceId, String credentialId); @Override Maybe<Credential> findById(String id); @Override Single<Credential> create(Credential item); @Override Single<Credential> update(Credential item); @Override Completable delete(String id);  }