VulasCli { public static void main(String[] _args) throws GoalConfigurationException, GoalExecutionException { final Options options = new Options(); options.addOption( "goal", "goal", true, "Goal to be executed (clean, cleanSpace, app, a2c, t2c, instr, report, upload)"); try { final CommandLineParser parser = new DefaultParser(); final CommandLine cmd = parser.parse(options, _args); String g = cmd.getOptionValue("goal", null); if ("cleanSpace".equals(g)) g = "spaceClean"; else if ("cleanSpace".equals(g)) g = "spaceDel"; goalType = GoalType.parseGoal(g); } catch (ParseException pe) { log.error(pe.getMessage()); final HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Vulas Command Line Interface", options); return; } catch (IllegalArgumentException iae) { log.error(iae.getMessage()); final HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Vulas Command Line Interface", options); return; } try { goal = GoalFactory.create(goalType, GoalClient.CLI); goal.executeSync(); } catch (IllegalStateException ise) { log.error(ise.getMessage()); } catch (IllegalArgumentException iae) { log.error(iae.getMessage()); } }  static void main(String[] _args);  }
@Test public void testCleanGoal() throws GoalConfigurationException, GoalExecutionException { this.configureBackendServiceUrl(server); this.setupMockServices(this.testApp); final String[] args = new String[] {"-goal", "clean"}; VulasCli.main(args); verifyHttp(server).times(1, method(Method.POST), uri("/backend" + PathBuilder.app(testApp))); verifyHttp(server) .times( 2, method(Method.POST), uri("/backend" + PathBuilder.goalExcecutions(null, null, this.testApp))); }
@Test public void testAppGoal() throws GoalConfigurationException, GoalExecutionException { final Path rel_app_with_space = Paths.get("src", "test", "resources", "appfolder with space"); final Path abs_app = Paths.get("src", "test", "resources", "appfolder").toAbsolutePath(); final Path py_app = Paths.get("src", "test", "resources", "foo").toAbsolutePath(); final String app_string = rel_app_with_space.toString() + "," + abs_app + "," + py_app; final Path rel_dep_with_space = Paths.get("src", "test", "resources", "depfolder with space"); final Path abs_dep = Paths.get("src", "test", "resources", "depfolder").toAbsolutePath(); final Path cc = Paths.get("src", "test", "resources", "depfolder", "commons-collections-3.2.2.jar"); final String dep_string = cc.toString() + "," + rel_dep_with_space.toString() + "," + abs_dep.toString(); System.setProperty(CoreConfiguration.APP_DIRS, app_string + "," + dep_string); this.configureBackendServiceUrl(server); this.setupMockServices(this.testApp); final String[] args = new String[] {"-goal", "app"}; VulasCli.main(args); verifyHttp(server) .times(1, method(Method.PUT), uri("/backend" + PathBuilder.app(this.testApp))); verifyHttp(server) .times( 2, method(Method.POST), uri("/backend" + PathBuilder.goalExcecutions(null, null, this.testApp))); }
@Test @Category(org.eclipse.steady.shared.categories.Slow.class) public void testPyAppGoal() throws GoalConfigurationException, GoalExecutionException { System.setProperty(CoreConfiguration.APP_DIRS, "./src/test/resources/cf-helloworld"); this.configureBackendServiceUrl(server); this.setupMockServices(this.testApp); final String[] args = new String[] {"-goal", "app"}; VulasCli.main(args); verifyHttp(server) .times(1, method(Method.PUT), uri("/backend" + PathBuilder.app(this.testApp))); verifyHttp(server) .times( 2, method(Method.POST), uri("/backend" + PathBuilder.goalExcecutions(null, null, this.testApp))); }
@Test public void testJavaAppGoal() throws GoalConfigurationException, GoalExecutionException { System.setProperty(CoreConfiguration.APP_DIRS, "./src/test/resources/java-app"); this.configureBackendServiceUrl(server); this.setupMockServices(this.testApp); final String[] args = new String[] {"-goal", "app"}; VulasCli.main(args); verifyHttp(server) .times(1, method(Method.PUT), uri("/backend" + PathBuilder.app(this.testApp))); verifyHttp(server) .times( 2, method(Method.POST), uri("/backend" + PathBuilder.goalExcecutions(null, null, this.testApp))); }