use of com.zimbra.cs.mailclient.smtp.SmtpTransport in project zm-mailbox by Zimbra.
the class DataSourceManager method test.
/*
* Tests connecting to a data source. Do not actually create the
* data source.
*/
public static void test(DataSource ds) throws ServiceException {
ZimbraLog.datasource.info("Testing: %s", ds);
try {
DataImport di = getInstance().getDataImport(ds, true);
di.test();
if (ds.isSmtpEnabled()) {
Session session = JMSession.getSession(ds);
Transport smtp = session.getTransport();
String emailAddress = ds.getEmailAddress();
if (smtp instanceof SmtpTransport) {
test((SmtpTransport) smtp, emailAddress);
} else {
test((SMTPTransport) smtp, emailAddress);
}
}
ZimbraLog.datasource.info("Test succeeded: %s", ds);
} catch (ServiceException x) {
ZimbraLog.datasource.info("Test failed: %s", ds, x);
throw x;
} catch (Exception e) {
ZimbraLog.datasource.info("Test failed: %s", ds, e);
throw ServiceException.INVALID_REQUEST("Datasource test failed", e);
}
}
Aggregations