Search in sources :

Example 1 with ZCalDataSource

use of com.zimbra.client.ZCalDataSource in project zm-mailbox by Zimbra.

the class TestDataSource method disabledTestCal.

// XXX bburtin: disabled test due to bug 37222 (unable to parse Google calendar).
public void disabledTestCal() throws Exception {
    // Create folder.
    ZMailbox mbox = TestUtil.getZMailbox(USER_NAME);
    String parentId = Integer.toString(Mailbox.ID_FOLDER_USER_ROOT);
    String urlString = "http://www.google.com/calendar/ical/k2kh7ncij3s05dog63g0o0n254%40group.calendar.google.com/public/basic.ics";
    ZFolder folder;
    try {
        folder = mbox.createFolder(parentId, NAME_PREFIX + " testCal", ZFolder.View.appointment, null, null, urlString);
    } catch (ServiceException e) {
        assertEquals(ServiceException.RESOURCE_UNREACHABLE, e.getCode());
        ZimbraLog.test.warn("Unable to test calendar data source for %s: %s", urlString, e.toString());
        return;
    }
    // Get the data source that was implicitly created.
    ZCalDataSource ds = (ZCalDataSource) getDataSource(mbox, folder.getId());
    assertNotNull(ds);
    // Test data source.  If the test fails, skip validation so we don't
    // get false positives when the feed is down or the test
    // is running on a box that's not connected to the internet.
    String error = mbox.testDataSource(ds);
    if (error != null) {
        ZimbraLog.test.warn("Unable to test iCal data source for %s: %s.", urlString, error);
        return;
    }
    // Import data and confirm that the folder is not empty.
    List<ZDataSource> list = new ArrayList<ZDataSource>();
    list.add(ds);
    mbox.importData(list);
    waitForData(mbox, folder);
    // Delete folder, import data, and make sure that the data source was deleted.
    mbox.deleteFolder(folder.getId());
    mbox.importData(list);
    ds = (ZCalDataSource) getDataSource(mbox, folder.getId());
    assertNull(ds);
}
Also used : ZCalDataSource(com.zimbra.client.ZCalDataSource) ZMailbox(com.zimbra.client.ZMailbox) ServiceException(com.zimbra.common.service.ServiceException) ArrayList(java.util.ArrayList) ZFolder(com.zimbra.client.ZFolder) ZDataSource(com.zimbra.client.ZDataSource)

Aggregations

ZCalDataSource (com.zimbra.client.ZCalDataSource)1 ZDataSource (com.zimbra.client.ZDataSource)1 ZFolder (com.zimbra.client.ZFolder)1 ZMailbox (com.zimbra.client.ZMailbox)1 ServiceException (com.zimbra.common.service.ServiceException)1 ArrayList (java.util.ArrayList)1