@Test public void testStatementGeneration() { Recipe recipe = new Recipe("nginx", null, "http: recipe.attribs.put("webport", "90"); recipe.fileName = "test"; assertEquals("Statement representation incorrect", CHEF_COMMAND, recipe.render(OsFamily.UNIX)); }
@Override public String render(OsFamily family) { if (family.equals(OsFamily.UNIX)) { String fileName = "/tmp/" + this.fileName + ".json"; Statement storeJSonFile = Statements.createOrOverwriteFile(fileName, Collections.singleton(toJSON())); Statement runRecipe = null; runRecipe = Statements.exec("sudo -i chef-solo -j " + fileName + (url != null ? " -r " + url : "")); return Statements.newStatementList(storeJSonFile, runRecipe).render( family); } else { throw new UnsupportedOperationException(); } }
Recipe implements Statement { @Override public String render(OsFamily family) { if (family.equals(OsFamily.UNIX)) { String fileName = "/tmp/" + this.fileName + ".json"; Statement storeJSonFile = Statements.createOrOverwriteFile(fileName, Collections.singleton(toJSON())); Statement runRecipe = null; runRecipe = Statements.exec("sudo -i chef-solo -j " + fileName + (url != null ? " -r " + url : "")); return Statements.newStatementList(storeJSonFile, runRecipe).render( family); } else { throw new UnsupportedOperationException(); } } }
Recipe implements Statement { @Override public String render(OsFamily family) { if (family.equals(OsFamily.UNIX)) { String fileName = "/tmp/" + this.fileName + ".json"; Statement storeJSonFile = Statements.createOrOverwriteFile(fileName, Collections.singleton(toJSON())); Statement runRecipe = null; runRecipe = Statements.exec("sudo -i chef-solo -j " + fileName + (url != null ? " -r " + url : "")); return Statements.newStatementList(storeJSonFile, runRecipe).render( family); } else { throw new UnsupportedOperationException(); } } Recipe(String cookbook);  Recipe(String cookbook, String recipe);  Recipe(String cookbook, String recipe, String url);   Recipe(String cookbook, String recipe, Configuration config); }
Recipe implements Statement { @Override public String render(OsFamily family) { if (family.equals(OsFamily.UNIX)) { String fileName = "/tmp/" + this.fileName + ".json"; Statement storeJSonFile = Statements.createOrOverwriteFile(fileName, Collections.singleton(toJSON())); Statement runRecipe = null; runRecipe = Statements.exec("sudo -i chef-solo -j " + fileName + (url != null ? " -r " + url : "")); return Statements.newStatementList(storeJSonFile, runRecipe).render( family); } else { throw new UnsupportedOperationException(); } } Recipe(String cookbook);  Recipe(String cookbook, String recipe);  Recipe(String cookbook, String recipe, String url);   Recipe(String cookbook, String recipe, Configuration config); String toJSON(); @Override Iterable<String> functionDependencies(OsFamily family); @Override String render(OsFamily family); static RunScriptOptions recipeScriptOptions(RunScriptOptions options); }
Recipe implements Statement { @Override public String render(OsFamily family) { if (family.equals(OsFamily.UNIX)) { String fileName = "/tmp/" + this.fileName + ".json"; Statement storeJSonFile = Statements.createOrOverwriteFile(fileName, Collections.singleton(toJSON())); Statement runRecipe = null; runRecipe = Statements.exec("sudo -i chef-solo -j " + fileName + (url != null ? " -r " + url : "")); return Statements.newStatementList(storeJSonFile, runRecipe).render( family); } else { throw new UnsupportedOperationException(); } } Recipe(String cookbook);  Recipe(String cookbook, String recipe);  Recipe(String cookbook, String recipe, String url);   Recipe(String cookbook, String recipe, Configuration config); String toJSON(); @Override Iterable<String> functionDependencies(OsFamily family); @Override String render(OsFamily family); static RunScriptOptions recipeScriptOptions(RunScriptOptions options); final String cookbook; final String recipe; public String url; final Map<String, Object> attribs; }