use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.
the class TestLdapHelper method searchDirSizeLimitExceeded.
@Test
public void searchDirSizeLimitExceeded() throws Exception {
int SIZE_LIMIT = 5;
String base = LdapConstants.DN_ROOT_DSE;
ZLdapFilter filter = filterFactory.anyEntry();
String[] returnAttrs = new String[] { "objectClass" };
ZSearchControls searchControls = ZSearchControls.createSearchControls(ZSearchScope.SEARCH_SCOPE_SUBTREE, SIZE_LIMIT, returnAttrs);
int numFound = 0;
boolean caughtException = false;
try {
ZSearchResultEnumeration ne = ldapHelper.searchDir(base, filter, searchControls);
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
numFound++;
}
ne.close();
} catch (LdapSizeLimitExceededException e) {
caughtException = true;
}
assertTrue(caughtException);
/*
// unboundid does not return entries if LdapSizeLimitExceededException
// is thrown, See commons on ZLdapContext.searchDir().
if (testConfig != TestLdap.TestConfig.UBID) {
assertEquals(SIZE_LIMIT, numFound);
}
*/
}
use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.
the class TestLdapHelper method searchDirNotFound.
@Test
public void searchDirNotFound() throws Exception {
LdapDIT dit = prov.getDIT();
String base = dit.configBranchBaseDN();
ZLdapFilter filter = filterFactory.allSignatures();
String[] returnAttrs = new String[] { "objectClass" };
ZSearchControls searchControls = ZSearchControls.createSearchControls(ZSearchScope.SEARCH_SCOPE_SUBTREE, ZSearchControls.SIZE_UNLIMITED, returnAttrs);
ZSearchResultEnumeration ne = ldapHelper.searchDir(base, filter, searchControls);
int numFound = 0;
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
numFound++;
}
ne.close();
assertEquals(0, numFound);
}
use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.
the class TestLdapHelper method testAndModifyAttributes.
@Test
public void testAndModifyAttributes() throws Exception {
ZLdapFilter filter = filterFactory.domainLockedForEagerAutoProvision();
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraAutoProvLock, "blah");
ZLdapContext zlc = null;
try {
zlc = LdapClient.getContext(LdapServerType.MASTER, LdapUsage.UNITTEST);
ldapHelper.testAndModifyEntry(zlc, ((LdapEntry) domain).getDN(), filter, attrs, domain);
} finally {
LdapClient.closeContext(zlc);
}
}
use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.
the class TestLdapZLdapFilter method dynamicGroupByName.
@Test
public void dynamicGroupByName() throws Exception {
String NAME = getTestName();
String filter = LegacyLdapFilter.dynamicGroupByName(NAME);
ZLdapFilter zLdapFilter = filterDactory.dynamicGroupByName(NAME);
verify(FilterId.DYNAMIC_GROUP_BY_NAME, filter, zLdapFilter);
}
use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.
the class TestLdapZLdapFilter method allDistributionLists.
@Test
public void allDistributionLists() throws Exception {
String filter = LegacyLdapFilter.allDistributionLists();
ZLdapFilter zLdapFilter = filterDactory.allDistributionLists();
verify(FilterId.ALL_DISTRIBUTION_LISTS, filter, zLdapFilter);
}
Aggregations