Search in sources :

Example 86 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method globalConfig.

@Test
public void globalConfig() throws Exception {
    String filter = LegacyLdapFilter.globalConfig();
    ZLdapFilter zLdapFilter = filterDactory.globalConfig();
    verify(FilterId.GLOBAL_CONFIG, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 87 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method allZimlets.

@Test
public void allZimlets() throws Exception {
    String filter = LegacyLdapFilter.allZimlets();
    ZLdapFilter zLdapFilter = filterDactory.allZimlets();
    verify(FilterId.ALL_ZIMLETS, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 88 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method CMBSearchNonSystemResourceAccountsOnly.

@Test
public void CMBSearchNonSystemResourceAccountsOnly() throws Exception {
    /*
        orig filter before refactoring
        String legacyFilter =
            "(&(&(!(zimbraIsSystemResource=*))(|(!(zimbraExcludeFromCMBSearch=*))(zimbraExcludeFromCMBSearch=FALSE)))(&(objectClass=zimbraAccount)(!(objectClass=zimbraCalendarResource))))";
         */
    String legacyFilter = "(&(&(objectClass=zimbraAccount)(!(objectClass=zimbraCalendarResource)))(&(!(zimbraIsSystemResource=*))(|(!(zimbraExcludeFromCMBSearch=*))(zimbraExcludeFromCMBSearch=FALSE))))";
    String filter = LegacyLdapFilter.CMBSearchNonSystemResourceAccountsOnly();
    assertEquals(legacyFilter, filter);
    ZLdapFilter zLdapFilter = filterDactory.CMBSearchNonSystemResourceAccountsOnly();
    String zFilter = zLdapFilter.toFilterString();
    // This assertion fails because we optimized it in the new code
    // it is now:
    // (&(&(objectClass=zimbraAccount)(!(objectClass=zimbraCalendarResource)))(!(zimbraIsSystemResource=TRUE))(|(!(zimbraExcludeFromCMBSearch=*))(zimbraExcludeFromCMBSearch=FALSE)))
    // System.out.println(zLdapFilter.toFilterString());
    // assertEquals(filter, zFilter);
    // assertEquals(legacyFilter, zFilter);
    verifyStatString(FilterId.CMB_SEARCH_NON_SYSTEM_RESOURCE_ACCOUNTS_ONLY, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 89 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method domainByName.

@Test
public void domainByName() throws Exception {
    String NAME = getTestName();
    String filter = LegacyLdapFilter.domainByName(NAME);
    ZLdapFilter zLdapFilter = filterDactory.domainByName(NAME);
    verify(FilterId.DOMAIN_BY_NAME, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Example 90 with ZLdapFilter

use of com.zimbra.cs.ldap.ZLdapFilter in project zm-mailbox by Zimbra.

the class TestLdapZLdapFilter method distributionListsByMemberAddrs.

@Test
public void distributionListsByMemberAddrs() throws Exception {
    String[] MEMBER_ADDRS = new String[] { "addr1@test.com", "addr2@test.com", "addr3@test.com" };
    String filter = LegacyLdapFilter.distributionListsByMemberAddrs(MEMBER_ADDRS);
    ZLdapFilter zLdapFilter = filterDactory.distributionListsByMemberAddrs(MEMBER_ADDRS);
    verify(FilterId.DISTRIBUTION_LISTS_BY_MEMBER_ADDRS, filter, zLdapFilter);
}
Also used : ZLdapFilter(com.zimbra.cs.ldap.ZLdapFilter)

Aggregations

ZLdapFilter (com.zimbra.cs.ldap.ZLdapFilter)123 ZSearchResultEntry (com.zimbra.cs.ldap.ZSearchResultEntry)15 ZSearchResultEnumeration (com.zimbra.cs.ldap.ZSearchResultEnumeration)13 ZLdapContext (com.zimbra.cs.ldap.ZLdapContext)10 ZSearchControls (com.zimbra.cs.ldap.ZSearchControls)10 ServiceException (com.zimbra.common.service.ServiceException)9 AccountServiceException (com.zimbra.cs.account.AccountServiceException)8 AuthFailedServiceException (com.zimbra.cs.account.AccountServiceException.AuthFailedServiceException)8 ArrayList (java.util.ArrayList)8 Server (com.zimbra.cs.account.Server)7 LdapDIT (com.zimbra.cs.account.ldap.LdapDIT)7 Account (com.zimbra.cs.account.Account)6 LdapSizeLimitExceededException (com.zimbra.cs.ldap.LdapException.LdapSizeLimitExceededException)6 NamedEntry (com.zimbra.cs.account.NamedEntry)5 SearchAccountsOptions (com.zimbra.cs.account.SearchAccountsOptions)5 BySearchResultEntrySearcher (com.zimbra.cs.account.ldap.BySearchResultEntrySearcher)5 SearchLdapOptions (com.zimbra.cs.ldap.SearchLdapOptions)5 ProvTest (com.zimbra.qa.unittest.prov.ProvTest)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)3 SearchRequest (com.unboundid.ldap.sdk.SearchRequest)3