Java 类javax.naming.ldap.LdapReferralException 实例源码

项目:u-qasar.platform    文件:LdapManager.java   
public List<LdapUser> getUsersFromGroup(int maximum, LdapGroup group) throws NamingException {
    List<LdapUser> users = new ArrayList<>();
    final String mapping = settings.getGroupMemberMapping();
    javax.naming.directory.Attribute members = group.
            getMappedAttribute(mapping);
    if (members == null) {
        return users;
    }
    NamingEnumeration<?> results = members.getAll();
    while (results.hasMoreElements() && users.size() < maximum) {
        try {
            final String userDN = (String) results.next();
            LdapUser user = getUserByDNAndFilter(userDN, settings.
                    getUserFilter());
            if (user != null) {
                users.add(user);
            }
        } catch (LdapReferralException ex) {
            logger.warn(ex.getMessage(), ex);
        }
    }
    Collections.sort(users, new LdapUserComparator());
    return users;
}
项目:u-qasar.platform    文件:LdapManager.java   
private int countLdapEntities(int maximum, final String baseDN, final String preferredFilter) throws NamingException {
    if (maximum <= 0) {
        return 0;
    }
    int count = 0;
    NamingEnumeration<SearchResult> results = searchLDAP(baseDN, preferredFilter);
    while (results.hasMoreElements() && count < maximum) {
        try {
            results.next();
            count++;
        } catch (LdapReferralException ex) {
            logger.warn(ex.getMessage(), ex);
        }
    }
    return count;
}
项目:cn1    文件:LdapReferralExceptionTest.java   
public void testAllCoveragePurpose() throws NamingException {
    log.setMethod("testAllCoveragePurpose()");
    LdapReferralException ex = new MockLdapReferralException();
    ex = new MockLdapReferralException("message");

    ex.getReferralContext();
    ex.getReferralContext(null);
    ex.getReferralContext(null, null);
    ex.getReferralInfo();
    ex.skipReferral();
    ex.retryReferral();
}
项目:freeVM    文件:LdapReferralExceptionTest.java   
public void testAllCoveragePurpose() throws NamingException {
    log.setMethod("testAllCoveragePurpose()");
    LdapReferralException ex = new MockLdapReferralException();
    ex = new MockLdapReferralException("message");

    ex.getReferralContext();
    ex.getReferralContext(null);
    ex.getReferralContext(null, null);
    ex.getReferralInfo();
    ex.skipReferral();
    ex.retryReferral();
}
项目:freeVM    文件:LdapReferralExceptionTest.java   
public void testAllCoveragePurpose() throws NamingException {
    log.setMethod("testAllCoveragePurpose()");
    LdapReferralException ex = new MockLdapReferralException();
    ex = new MockLdapReferralException("message");

    ex.getReferralContext();
    ex.getReferralContext(null);
    ex.getReferralContext(null, null);
    ex.getReferralInfo();
    ex.skipReferral();
    ex.retryReferral();
}