NodeHealthScriptRunner extends TimedHealthReporterService { static boolean shouldRun(String script, String healthScript) { if (healthScript == null || healthScript.trim().isEmpty()) { LOG.info("Missing location for the node health check script \"{}\".", script); return false; } File f = new File(healthScript); if (!f.exists()) { LOG.warn("File {} for script \"{}\" does not exist.", healthScript, script); return false; } if (!FileUtil.canExecute(f)) { LOG.warn("File {} for script \"{}\" can not be executed.", healthScript, script); return false; } return true; } private  NodeHealthScriptRunner(String scriptName, long checkInterval,
      long timeout, String[] scriptArgs, boolean runBeforeStartup); static NodeHealthScriptRunner newInstance(String scriptName,
      Configuration conf); @Override void serviceStop();  }
@Test public void testNodeHealthScriptShouldRun() throws IOException { assertFalse("Node health script should start", NodeHealthScriptRunner.shouldRun("script", nodeHealthscriptFile.getAbsolutePath())); writeNodeHealthScriptFile("", false); assertFalse("Node health script should start", NodeHealthScriptRunner.shouldRun("script", nodeHealthscriptFile.getAbsolutePath())); writeNodeHealthScriptFile("", true); assertTrue("Node health script should start", NodeHealthScriptRunner.shouldRun("script", nodeHealthscriptFile.getAbsolutePath())); }