@Test public void testGroovyToASTToGroovyExecution() throws Exception { ModelASTPipelineDef origRoot = Converter.urlToPipelineDef(getClass().getResource("/" + configName + ".groovy")); assertNotNull(origRoot); String prettyGroovy = origRoot.toPrettyGroovy(); assertNotNull(prettyGroovy); System.err.println("about to set up repo for config " + configName); prepRepoWithJenkinsfileFromString(prettyGroovy); executeBuild(); }
@Test public void groovyToASTToGroovyToAST() throws Exception { ModelASTPipelineDef origRoot = Converter.urlToPipelineDef(getClass().getResource("/" + configName + ".groovy")); assertNotNull(origRoot); String prettyGroovy = origRoot.toPrettyGroovy(); assertNotNull(prettyGroovy); ModelASTPipelineDef newRoot = parse(prettyGroovy); assertNotNull(newRoot); assertEquals(origRoot, newRoot); }
Converter.scriptToPipelineDef(pipelineDef.toPrettyGroovy()); result.accumulate("result", "success"); result.accumulate("jenkinsfile", pipelineDef.toPrettyGroovy()); } catch (Exception e) { JSONObject jfErrors = new JSONObject();
if (!collectErrors(result, parser.getErrorCollector()) && result.isEmpty()) { try { Converter.scriptToPipelineDef(pipelineDef.toPrettyGroovy()); result.accumulate("result", "success"); } catch (Exception e) {
@Test public void testJSONToASTToGroovyExecution() throws Exception { JSONObject json = JSONObject.fromObject(fileContentsFromResources("json/" + configName + ".json")); assertNotNull("Couldn't parse JSON for " + configName, json); JSONParser jp = new JSONParser(Converter.jsonTreeFromJSONObject(json)); ModelASTPipelineDef origRoot = jp.parse(); assertEquals(getJSONErrorReport(jp, configName), 0, jp.getErrorCollector().getErrorCount()); assertNotNull("Pipeline null for " + configName, origRoot); String prettyGroovy = origRoot.toPrettyGroovy(); assertNotNull(prettyGroovy); prepRepoWithJenkinsfileFromString(prettyGroovy); executeBuild(); }
@Test public void jsonToASTToGroovyToAST() throws Exception { JSONObject origJson = JSONObject.fromObject(fileContentsFromResources("json/" + configName + ".json")); assertNotNull("Couldn't parse JSON for " + configName, origJson); JSONParser jp = new JSONParser(Converter.jsonTreeFromJSONObject(origJson)); ModelASTPipelineDef origRoot = jp.parse(); assertEquals(getJSONErrorReport(jp, configName), 0, jp.getErrorCollector().getErrorCount()); assertNotNull("Pipeline null for " + configName, origRoot); String prettyGroovy = origRoot.toPrettyGroovy(); assertNotNull(prettyGroovy); ModelASTPipelineDef newRoot = parse(prettyGroovy); assertNotNull(newRoot); assertEquals(origRoot, newRoot); }