Search in sources :

Example 1 with ImapSync

use of com.zimbra.cs.datasource.imap.ImapSync in project zm-mailbox by Zimbra.

the class DataSourceManagerTest method testGetDataImportWithDefaultClass.

@Test
public void testGetDataImportWithDefaultClass() throws ServiceException {
    Map<String, Object> testAttrs = new HashMap<String, Object>();
    testAttrs.put(Provisioning.A_zimbraDataSourceDomain, "zimbra.com");
    testAttrs.put(Provisioning.A_zimbraDataSourcePort, "1234");
    testAttrs.put(Provisioning.A_zimbraDataSourceHost, "localhost");
    testAttrs.put(Provisioning.A_zimbraDataSourceUsername, "test");
    testAttrs.put(Provisioning.A_zimbraDataSourcePassword, "test");
    DataSource ds = new DataSource(testAccount, DataSourceType.pop3, POP3_DS_NAME, POP3_DS_ID, testAttrs, null);
    DataImport di = DataSourceManager.getInstance().getDataImport(ds);
    assertNotNull("DataImport should not be NULL", di);
    assertTrue("DataImport for 'pop3' should be Pop3Sync", di instanceof Pop3Sync);
    ds = new DataSource(testAccount, DataSourceType.imap, IMAP_DS_NAME, IMAP_DS_ID, testAttrs, null);
    di = DataSourceManager.getInstance().getDataImport(ds);
    assertNotNull("DataImport should not be NULL", di);
    assertTrue("DataImport for 'imap' should be ImapSync", di instanceof ImapSync);
    ds = new DataSource(testAccount, DataSourceType.caldav, CALDAV_DS_NAME, CALDAV_DS_ID, testAttrs, null);
    di = DataSourceManager.getInstance().getDataImport(ds);
    assertNotNull("DataImport should not be NULL", di);
    assertTrue("DataImport for 'caldav' should be CalDavDataImport", di instanceof CalDavDataImport);
    ds = new DataSource(testAccount, DataSourceType.rss, RSS_DS_NAME, RSS_DS_ID, testAttrs, null);
    di = DataSourceManager.getInstance().getDataImport(ds);
    assertNotNull("DataImport should not be NULL", di);
    assertTrue("DataImport for 'rss' should be RssImport", di instanceof RssImport);
    ds = new DataSource(testAccount, DataSourceType.cal, CAL_DS_NAME, CAL_DS_ID, testAttrs, null);
    di = DataSourceManager.getInstance().getDataImport(ds);
    assertNotNull("DataImport should not be NULL", di);
    assertTrue("DataImport for 'cal' should be RssImport", di instanceof RssImport);
    ds = new DataSource(testAccount, DataSourceType.gal, GAL_DS_NAME, GAL_DS_ID, testAttrs, null);
    di = DataSourceManager.getInstance().getDataImport(ds);
    assertNotNull("DataImport should not be NULL", di);
    assertTrue("DataImport for 'gal' should be GalImport", di instanceof GalImport);
}
Also used : GalImport(com.zimbra.cs.gal.GalImport) DataImport(com.zimbra.cs.account.DataSource.DataImport) HashMap(java.util.HashMap) ImapSync(com.zimbra.cs.datasource.imap.ImapSync) DataSource(com.zimbra.cs.account.DataSource) Test(org.junit.Test)

Aggregations

DataSource (com.zimbra.cs.account.DataSource)1 DataImport (com.zimbra.cs.account.DataSource.DataImport)1 ImapSync (com.zimbra.cs.datasource.imap.ImapSync)1 GalImport (com.zimbra.cs.gal.GalImport)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1