DefaultMailCreator implements MailCreator { @Override public boolean createFailedExecutorHealthCheckMessage(final List<ExecutableFlow> flows, final Executor executor, final ExecutorManagerException failureException, final EmailMessage message, final String azkabanName, final String scheme, final String clientHostname, final String clientPortNumber, final List<String> emailList) { if (emailList == null || emailList.isEmpty()) { return false; } message.addAllToAddress(emailList); message.setMimeType("text/html"); message.setSubject( "Alert: Executor is unreachable, " + executor.getHost() + " on " + azkabanName); message.println( "<h2 style=\"color:#FFA500\"> Executor is unreachable. Executor host - " + executor .getHost() + " on Cluster - " + azkabanName + "</h2>"); message.println("Remedial action will be attempted on affected executions - <br>"); message.println("Following flows were reported as running on the executor and will be " + "finalized."); message.println(""); message.println("<h3>Affected executions</h3>"); message.println("<ul>"); appendFlowLinksToMessage(message, flows, scheme, clientHostname, clientPortNumber); message.println("</ul>"); message.println(""); message.println("<h3>Error detail</h3>"); message.println(String.format("Following error was reported for executor-id: %s, " + "executor-host: %s, executor-port: %d", executor.getId(), executor.getHost(), executor.getPort())); message.println("<pre>" + ExceptionUtils.getStackTrace(failureException) + "</pre>"); return true; }  static void registerCreator(final String name, final MailCreator creator); static MailCreator getCreator(final String name); @Override boolean createFirstErrorMessage(final ExecutableFlow flow,
      final EmailMessage message, final String azkabanName, final String scheme,
      final String clientHostname, final String clientPortNumber); @Override boolean createErrorEmail(final ExecutableFlow flow, final List<ExecutableFlow>
      pastExecutions, final EmailMessage message, final String azkabanName, final String scheme,
      final String clientHostname, final String clientPortNumber, final String... reasons); @Override boolean createSuccessEmail(final ExecutableFlow flow, final EmailMessage message,
      final String azkabanName, final String scheme, final String clientHostname,
      final String clientPortNumber); @Override boolean createFailedUpdateMessage(final List<ExecutableFlow> flows,
      final Executor executor, final ExecutorManagerException updateException,
      final EmailMessage message, final String azkabanName,
      final String scheme, final String clientHostname, final String clientPortNumber); @Override boolean createFailedExecutorHealthCheckMessage(final List<ExecutableFlow> flows,
      final Executor executor, final ExecutorManagerException failureException,
      final EmailMessage message, final String azkabanName,
      final String scheme, final String clientHostname, final String clientPortNumber,
      final List<String> emailList); static final String DEFAULT_MAIL_CREATOR; }
@Test public void createFailedHealthCheckMessage() throws Exception { final ExecutorManagerException exception = createTestStracktrace(); assertTrue(this.mailCreator .createFailedExecutorHealthCheckMessage(Arrays.asList(this.executableFlow, this.executableFlow), this.executor, exception, this.message, this.azkabanName, this.scheme, this.clientHostname, this.clientPortNumber, ImmutableList.of("test@example.com"))); assertEquals("Alert: Executor is unreachable, executor1-host on unit-tests", this.message.getSubject()); assertThat(TestUtils.readResource("failedExecutorHealthCheckMessage.html", this)) .isEqualToIgnoringWhitespace(this.message.getBody()); }