Fixed LDAP-189, The constructor DefaultDirContextValidator(int searchScope) does not actually set scope in SearchControls
This commit is contained in:
@@ -99,6 +99,7 @@ public class DefaultDirContextValidator implements DirContextValidator {
|
||||
*/
|
||||
public DefaultDirContextValidator(int searchScope) {
|
||||
this.searchControls = new SearchControls();
|
||||
this.searchControls.setSearchScope(searchScope);
|
||||
this.searchControls.setCountLimit(1);
|
||||
this.searchControls.setReturningAttributes(new String[] { "objectclass" });
|
||||
this.searchControls.setTimeLimit(500);
|
||||
|
||||
@@ -69,7 +69,25 @@ public class DefaultDirContextValidatorTest extends TestCase {
|
||||
namingEnumerationControl.verify();
|
||||
dirContextControl.verify();
|
||||
}
|
||||
|
||||
// LDAP-189
|
||||
public void testSearchScopeOneLevelScopeSetInConstructorIsUsed() throws Exception {
|
||||
DefaultDirContextValidator tested = new DefaultDirContextValidator(SearchControls.ONELEVEL_SCOPE);
|
||||
assertEquals("ONELEVEL_SCOPE, ", SearchControls.ONELEVEL_SCOPE, tested.getSearchControls().getSearchScope());
|
||||
}
|
||||
|
||||
// LDAP-189
|
||||
public void testSearchScopeSubTreeScopeSetInConstructorIsUsed() throws Exception {
|
||||
DefaultDirContextValidator tested = new DefaultDirContextValidator(SearchControls.SUBTREE_SCOPE);
|
||||
assertEquals("SUBTREE_SCOPE, ", SearchControls.SUBTREE_SCOPE, tested.getSearchControls().getSearchScope());
|
||||
}
|
||||
|
||||
// LDAP-189
|
||||
public void testSearchScopeObjectScopeSetInConstructorIsUsed() throws Exception {
|
||||
DefaultDirContextValidator tested = new DefaultDirContextValidator(SearchControls.OBJECT_SCOPE);
|
||||
assertEquals("OBJECT_SCOPE, ", SearchControls.OBJECT_SCOPE, tested.getSearchControls().getSearchScope());
|
||||
}
|
||||
|
||||
public void testProperties() throws Exception {
|
||||
final DefaultDirContextValidator dirContextValidator = new DefaultDirContextValidator();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user