CreateRunScript extends StatementList { @Override public String render(OsFamily family) { if (checkNotNull(family, "family") == OsFamily.WINDOWS) throw new UnsupportedOperationException("windows not yet implemented"); List<Statement> statements = newArrayList(); final Map<String, String> tokenMap = ShellToken.tokenValueMap(family); String runScript = Utils.replaceTokens(pwd + "{fs}" + instanceName + ".{sh}", tokenMap); statements.add(interpret(String.format("{md} %s{lf}", pwd))); StringBuilder builder = new StringBuilder(); builder.append("\n"); addUnixRunScriptHeader(runScript, builder); builder.append("\n"); addUnixRunScript(runScript, builder); builder.append("\n"); addUnixRunScriptFooter(runScript, builder); builder.append("\n"); statements.add(interpret(builder.toString())); statements.add(exec("chmod u+x " + runScript)); return new StatementList(statements).render(family); } CreateRunScript(String instanceName, Iterable<String> exports, String pwd, Iterable<Statement> statements); @Override Iterable<String> functionDependencies(OsFamily family); @Override String render(OsFamily family); static final String DELIMITER; }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testWINDOWSUnimplemented() throws IOException { statement.render(OsFamily.WINDOWS); }