Search in sources :

Example 1 with TestDataSource

use of com.zimbra.soap.mail.type.TestDataSource in project zm-mailbox by Zimbra.

the class ZMailbox method testDataSource.

/**
 * Tests a data source.
 *
 * @return <tt>null</tt> on success, or the error string on failure
 */
public String testDataSource(ZDataSource source) throws ServiceException {
    TestDataSourceRequest req = new TestDataSourceRequest();
    DataSource jaxbObj = source.toJaxb();
    req.setDataSource(jaxbObj);
    TestDataSourceResponse resp = (TestDataSourceResponse) invokeJaxb(req);
    List<TestDataSource> dataSources = resp.getDataSources();
    int success = 0;
    if (dataSources.size() > 0 && dataSources.get(0) != null) {
        TestDataSource ds = dataSources.get(0);
        success = ds.getSuccess();
        if (success < 1) {
            return ds.getError();
        } else {
            return null;
        }
    }
    return null;
}
Also used : TestDataSourceRequest(com.zimbra.soap.mail.message.TestDataSourceRequest) TestDataSource(com.zimbra.soap.mail.type.TestDataSource) TestDataSourceResponse(com.zimbra.soap.mail.message.TestDataSourceResponse) RssDataSource(com.zimbra.soap.type.RssDataSource) TestDataSource(com.zimbra.soap.mail.type.TestDataSource) DataSource(com.zimbra.soap.type.DataSource) Pop3DataSource(com.zimbra.soap.type.Pop3DataSource) ImapDataSource(com.zimbra.soap.type.ImapDataSource) CalDataSource(com.zimbra.soap.type.CalDataSource)

Aggregations

TestDataSourceRequest (com.zimbra.soap.mail.message.TestDataSourceRequest)1 TestDataSourceResponse (com.zimbra.soap.mail.message.TestDataSourceResponse)1 TestDataSource (com.zimbra.soap.mail.type.TestDataSource)1 CalDataSource (com.zimbra.soap.type.CalDataSource)1 DataSource (com.zimbra.soap.type.DataSource)1 ImapDataSource (com.zimbra.soap.type.ImapDataSource)1 Pop3DataSource (com.zimbra.soap.type.Pop3DataSource)1 RssDataSource (com.zimbra.soap.type.RssDataSource)1