NodeHealthScriptRunner extends AbstractService { public static boolean shouldRun(String healthScript) { if (healthScript == null || healthScript.trim().isEmpty()) { return false; } File f = new File(healthScript); return f.exists() && FileUtil.canExecute(f); } NodeHealthScriptRunner(String scriptName, long chkInterval, long timeout,
      String[] scriptArgs); boolean isHealthy(); String getHealthReport(); long getLastReportedTime(); static boolean shouldRun(String healthScript); TimerTask getTimerTask(); static final String NODE_HEALTH_SCRIPT_TIMED_OUT_MSG; }
@Test public void testNodeHealthScriptShouldRun() throws IOException { Assert.assertFalse("Node health script should start", NodeHealthScriptRunner.shouldRun( nodeHealthscriptFile.getAbsolutePath())); writeNodeHealthScriptFile("", false); Assert.assertFalse("Node health script should start", NodeHealthScriptRunner.shouldRun( nodeHealthscriptFile.getAbsolutePath())); writeNodeHealthScriptFile("", true); Assert.assertTrue("Node health script should start", NodeHealthScriptRunner.shouldRun( nodeHealthscriptFile.getAbsolutePath())); }