Search in sources :

Example 71 with DataSource

use of com.zimbra.cs.account.DataSource in project zm-mailbox by Zimbra.

the class TestLdapProvDataSource method getAllDataSources.

@Test
public void getAllDataSources() throws Exception {
    String ACCT_NAME_LOCALPART = Names.makeAccountNameLocalPart(genAcctNameLocalPart());
    String DATA_SOURCE_NAME_1 = Names.makeDataSourceName(genDataSourceName("1"));
    String DATA_SOURCE_NAME_2 = Names.makeDataSourceName(genDataSourceName("2"));
    String DATA_SOURCE_NAME_3 = Names.makeDataSourceName(genDataSourceName("3"));
    Account acct = createAccount(ACCT_NAME_LOCALPART);
    DataSource dataSource1 = createDataSource(acct, DATA_SOURCE_NAME_1);
    DataSource dataSource2 = createDataSource(acct, DATA_SOURCE_NAME_2);
    DataSource dataSource3 = createDataSource(acct, DATA_SOURCE_NAME_3);
    acct = getFresh(acct);
    List<DataSource> allDataSources = prov.getAllDataSources(acct);
    assertEquals(3, allDataSources.size());
    Set<String> allDataSourceIds = new HashSet<String>();
    for (DataSource dataSource : allDataSources) {
        allDataSourceIds.add(dataSource.getId());
    }
    assertTrue(allDataSourceIds.contains(dataSource1.getId()));
    assertTrue(allDataSourceIds.contains(dataSource2.getId()));
    assertTrue(allDataSourceIds.contains(dataSource3.getId()));
    deleteDataSource(acct, dataSource1);
    deleteDataSource(acct, dataSource2);
    deleteDataSource(acct, dataSource3);
    deleteAccount(acct);
}
Also used : Account(com.zimbra.cs.account.Account) DataSource(com.zimbra.cs.account.DataSource) HashSet(java.util.HashSet)

Aggregations

DataSource (com.zimbra.cs.account.DataSource)71 Account (com.zimbra.cs.account.Account)29 HashMap (java.util.HashMap)21 Provisioning (com.zimbra.cs.account.Provisioning)18 DbDataSource (com.zimbra.cs.db.DbDataSource)18 ServiceException (com.zimbra.common.service.ServiceException)15 Element (com.zimbra.common.soap.Element)14 Mailbox (com.zimbra.cs.mailbox.Mailbox)11 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)11 ArrayList (java.util.ArrayList)11 ZDataSource (com.zimbra.client.ZDataSource)8 AccountServiceException (com.zimbra.cs.account.AccountServiceException)7 Folder (com.zimbra.cs.mailbox.Folder)7 DataSourceType (com.zimbra.soap.admin.type.DataSourceType)7 HashSet (java.util.HashSet)7 Test (org.junit.Test)7 DataSourceItem (com.zimbra.cs.db.DbDataSource.DataSourceItem)6 ZMailbox (com.zimbra.client.ZMailbox)5 LdapDataSource (com.zimbra.cs.account.ldap.entry.LdapDataSource)5 MailServiceException (com.zimbra.cs.mailbox.MailServiceException)5