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);
}
Aggregations