@Test public void should_throw_special_exception_when_failed_already() throws Exception { eslintBridgeServer = createEslintBridgeServer("throw.js"); String failedToStartExceptionMessage = "Failed to start server (" + TEST_TIMEOUT_SECONDS + "s timeout)"; assertThatThrownBy(() -> eslintBridgeServer.startServerLazily(context)) .isInstanceOf(NodeCommandException.class) .hasMessage(failedToStartExceptionMessage); assertThatThrownBy(() -> eslintBridgeServer.startServerLazily(context)) .isInstanceOf(ServerAlreadyFailedException.class); }
@Override public void startServerLazily(SensorContext context) throws IOException { if (failedToStart) { throw new ServerAlreadyFailedException(); } try { if (isAlive()) { LOG.debug("eslint-bridge server is up, no need to start."); return; } deploy(); List<Path> deployedBundles = rulesBundles.deploy(); startServer(context, deployedBundles); } catch (NodeCommandException e) { failedToStart = true; throw e; } }
EslintBridgeServerImpl implements EslintBridgeServer { @Override public void startServerLazily(SensorContext context) throws IOException { if (failedToStart) { throw new ServerAlreadyFailedException(); } try { if (isAlive()) { LOG.debug("eslint-bridge server is up, no need to start."); return; } deploy(); List<Path> deployedBundles = rulesBundles.deploy(); startServer(context, deployedBundles); } catch (NodeCommandException e) { failedToStart = true; throw e; } } }
EslintBridgeServerImpl implements EslintBridgeServer { @Override public void startServerLazily(SensorContext context) throws IOException { if (failedToStart) { throw new ServerAlreadyFailedException(); } try { if (isAlive()) { LOG.debug("eslint-bridge server is up, no need to start."); return; } deploy(); List<Path> deployedBundles = rulesBundles.deploy(); startServer(context, deployedBundles); } catch (NodeCommandException e) { failedToStart = true; throw e; } } EslintBridgeServerImpl(NodeCommandBuilder nodeCommandBuilder, Bundle bundle, RulesBundles rulesBundles,
    NodeDeprecationWarning deprecationWarning);   EslintBridgeServerImpl(NodeCommandBuilder nodeCommandBuilder,
    int timeoutSeconds,
    Bundle bundle,
    RulesBundles rulesBundles,
    NodeDeprecationWarning deprecationWarning); }
EslintBridgeServerImpl implements EslintBridgeServer { @Override public void startServerLazily(SensorContext context) throws IOException { if (failedToStart) { throw new ServerAlreadyFailedException(); } try { if (isAlive()) { LOG.debug("eslint-bridge server is up, no need to start."); return; } deploy(); List<Path> deployedBundles = rulesBundles.deploy(); startServer(context, deployedBundles); } catch (NodeCommandException e) { failedToStart = true; throw e; } } EslintBridgeServerImpl(NodeCommandBuilder nodeCommandBuilder, Bundle bundle, RulesBundles rulesBundles,
    NodeDeprecationWarning deprecationWarning);   EslintBridgeServerImpl(NodeCommandBuilder nodeCommandBuilder,
    int timeoutSeconds,
    Bundle bundle,
    RulesBundles rulesBundles,
    NodeDeprecationWarning deprecationWarning); @Override void startServerLazily(SensorContext context); @Override void initLinter(Rule[] rules); @Override AnalysisResponse analyzeJavaScript(AnalysisRequest request); @Override AnalysisResponse analyzeTypeScript(AnalysisRequest request); boolean isAlive(); @Override boolean newTsConfig(); @Override TsConfigFile loadTsConfig(String filename); @Override void clean(); @Override String getCommandInfo(); @Override void start(); @Override void stop(); }
EslintBridgeServerImpl implements EslintBridgeServer { @Override public void startServerLazily(SensorContext context) throws IOException { if (failedToStart) { throw new ServerAlreadyFailedException(); } try { if (isAlive()) { LOG.debug("eslint-bridge server is up, no need to start."); return; } deploy(); List<Path> deployedBundles = rulesBundles.deploy(); startServer(context, deployedBundles); } catch (NodeCommandException e) { failedToStart = true; throw e; } } EslintBridgeServerImpl(NodeCommandBuilder nodeCommandBuilder, Bundle bundle, RulesBundles rulesBundles,
    NodeDeprecationWarning deprecationWarning);   EslintBridgeServerImpl(NodeCommandBuilder nodeCommandBuilder,
    int timeoutSeconds,
    Bundle bundle,
    RulesBundles rulesBundles,
    NodeDeprecationWarning deprecationWarning); @Override void startServerLazily(SensorContext context); @Override void initLinter(Rule[] rules); @Override AnalysisResponse analyzeJavaScript(AnalysisRequest request); @Override AnalysisResponse analyzeTypeScript(AnalysisRequest request); boolean isAlive(); @Override boolean newTsConfig(); @Override TsConfigFile loadTsConfig(String filename); @Override void clean(); @Override String getCommandInfo(); @Override void start(); @Override void stop();  }