@Test public void testMainNotEnoughArguments() { try { AggregatorApplication.main(new String[0]); throw new Exception("Should not be thrown"); } catch (Exception e) { } try { AggregatorApplication.main(new String[1]); throw new Exception("Should not be thrown"); } catch (Exception e) { } }
public static void main(String[] args) throws Exception { if (args.length != 2) { throw new Exception("This jar should be executed with 2 arguments : 1st - current host name, " + "2nd - collector hosts separated with coma"); } final AggregatorApplication app = new AggregatorApplication(args[0], args[1]); app.startWebServerAndPublishersThreads(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { app.stop(); } }); }
AggregatorApplication { public static void main(String[] args) throws Exception { if (args.length != 2) { throw new Exception("This jar should be executed with 2 arguments : 1st - current host name, " + "2nd - collector hosts separated with coma"); } final AggregatorApplication app = new AggregatorApplication(args[0], args[1]); app.startWebServerAndPublishersThreads(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { app.stop(); } }); } }
AggregatorApplication { public static void main(String[] args) throws Exception { if (args.length != 2) { throw new Exception("This jar should be executed with 2 arguments : 1st - current host name, " + "2nd - collector hosts separated with coma"); } final AggregatorApplication app = new AggregatorApplication(args[0], args[1]); app.startWebServerAndPublishersThreads(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { app.stop(); } }); } AggregatorApplication(String hostname, String collectorHosts); }
AggregatorApplication { public static void main(String[] args) throws Exception { if (args.length != 2) { throw new Exception("This jar should be executed with 2 arguments : 1st - current host name, " + "2nd - collector hosts separated with coma"); } final AggregatorApplication app = new AggregatorApplication(args[0], args[1]); app.startWebServerAndPublishersThreads(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { app.stop(); } }); } AggregatorApplication(String hostname, String collectorHosts); static void main(String[] args); }
AggregatorApplication { public static void main(String[] args) throws Exception { if (args.length != 2) { throw new Exception("This jar should be executed with 2 arguments : 1st - current host name, " + "2nd - collector hosts separated with coma"); } final AggregatorApplication app = new AggregatorApplication(args[0], args[1]); app.startWebServerAndPublishersThreads(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { app.stop(); } }); } AggregatorApplication(String hostname, String collectorHosts); static void main(String[] args);  }