DefaultMailCreator implements MailCreator { @Override public 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) { final ExecutionOptions option = flows.get(0).getExecutionOptions(); final List<String> emailList = option.getFailureEmails(); if (emailList != null && !emailList.isEmpty()) { message.addAllToAddress(emailList); message.setMimeType("text/html"); message.setSubject( "Flow status could not be updated from " + executor.getHost() + " on " + azkabanName); message.println( "<h2 style=\"color:#FF0000\"> Flow status could not be updated from " + executor.getHost() + " on " + azkabanName + "</h2>"); message.println("The actual status of these executions is unknown, " + "because getting status update from azkaban executor is failing"); message.println(""); message.println("<h3>Error detail</h3>"); message.println("<pre>" + ExceptionUtils.getStackTrace(updateException) + "</pre>"); message.println(""); message.println("<h3>Affected executions</h3>"); message.println("<ul>"); appendFlowLinksToMessage(message, flows, scheme, clientHostname, clientPortNumber); message.println("</ul>"); return true; } return false; }  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 createFailedUpdateMessage() throws Exception { final ExecutorManagerException exception = createTestStracktrace(); assertTrue(this.mailCreator .createFailedUpdateMessage(Arrays.asList(this.executableFlow, this.executableFlow), this.executor, exception, this.message, this.azkabanName, this.scheme, this.clientHostname, this.clientPortNumber)); assertEquals("Flow status could not be updated from executor1-host on unit-tests", this.message.getSubject()); assertThat(TestUtils.readResource("failedUpdateMessage.html", this)) .isEqualToIgnoringWhitespace(this.message.getBody()); }