@Test @Ignore("requires real mail server") public void testEndToEnd() throws Exception { setupLocalhostSendGoogleRead2(); final PollStatus status = m_monitor.poll(getMailService("127.0.0.1"), m_params); assertEquals(PollStatus.SERVICE_AVAILABLE, status.getStatusCode()); }
@Override public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) { PollStatus status = null; try { final MailTransportParameters mailParms = MailTransportParameters.get(parameters); try { if ("${ipaddr}".equals(mailParms.getReadTestHost())) { mailParms.setReadTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } try { if ("${ipaddr}".equals(mailParms.getSendTestHost())) { mailParms.setSendTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } parseJavaMailProperties(mailParms); status = doMailTest(mailParms); } catch (final IllegalStateException ise) { } catch (final Throwable e) { LogUtils.errorf(this, e, "An error occurred while polling."); status = PollStatus.down("Exception from mailer: " + e.getLocalizedMessage()); } return status; }
MailTransportMonitor extends AbstractServiceMonitor { @Override public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) { PollStatus status = null; try { final MailTransportParameters mailParms = MailTransportParameters.get(parameters); try { if ("${ipaddr}".equals(mailParms.getReadTestHost())) { mailParms.setReadTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } try { if ("${ipaddr}".equals(mailParms.getSendTestHost())) { mailParms.setSendTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } parseJavaMailProperties(mailParms); status = doMailTest(mailParms); } catch (final IllegalStateException ise) { } catch (final Throwable e) { LogUtils.errorf(this, e, "An error occurred while polling."); status = PollStatus.down("Exception from mailer: " + e.getLocalizedMessage()); } return status; } }
MailTransportMonitor extends AbstractServiceMonitor { @Override public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) { PollStatus status = null; try { final MailTransportParameters mailParms = MailTransportParameters.get(parameters); try { if ("${ipaddr}".equals(mailParms.getReadTestHost())) { mailParms.setReadTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } try { if ("${ipaddr}".equals(mailParms.getSendTestHost())) { mailParms.setSendTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } parseJavaMailProperties(mailParms); status = doMailTest(mailParms); } catch (final IllegalStateException ise) { } catch (final Throwable e) { LogUtils.errorf(this, e, "An error occurred while polling."); status = PollStatus.down("Exception from mailer: " + e.getLocalizedMessage()); } return status; }  }
MailTransportMonitor extends AbstractServiceMonitor { @Override public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) { PollStatus status = null; try { final MailTransportParameters mailParms = MailTransportParameters.get(parameters); try { if ("${ipaddr}".equals(mailParms.getReadTestHost())) { mailParms.setReadTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } try { if ("${ipaddr}".equals(mailParms.getSendTestHost())) { mailParms.setSendTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } parseJavaMailProperties(mailParms); status = doMailTest(mailParms); } catch (final IllegalStateException ise) { } catch (final Throwable e) { LogUtils.errorf(this, e, "An error occurred while polling."); status = PollStatus.down("Exception from mailer: " + e.getLocalizedMessage()); } return status; }  @Override PollStatus poll(MonitoredService svc, Map<String, Object> parameters); }
MailTransportMonitor extends AbstractServiceMonitor { @Override public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) { PollStatus status = null; try { final MailTransportParameters mailParms = MailTransportParameters.get(parameters); try { if ("${ipaddr}".equals(mailParms.getReadTestHost())) { mailParms.setReadTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } try { if ("${ipaddr}".equals(mailParms.getSendTestHost())) { mailParms.setSendTestHost(svc.getIpAddr()); } } catch (final IllegalStateException ise) { } parseJavaMailProperties(mailParms); status = doMailTest(mailParms); } catch (final IllegalStateException ise) { } catch (final Throwable e) { LogUtils.errorf(this, e, "An error occurred while polling."); status = PollStatus.down("Exception from mailer: " + e.getLocalizedMessage()); } return status; }  @Override PollStatus poll(MonitoredService svc, Map<String, Object> parameters);  }