InstallRSAPrivateKey implements Statement { @Override public String render(OsFamily family) { checkNotNull(family, "family"); if (family == OsFamily.WINDOWS) throw new UnsupportedOperationException("windows not yet implemented"); Builder<Statement> statements = ImmutableList.builder(); statements.add(exec("{md} " + sshDir)); String idRsa = sshDir + "{fs}id_rsa"; statements.add(exec("{rm} " + idRsa)); statements.add(appendFile(idRsa, Splitter.on('\n').split(privateKey))); statements.add(exec("chmod 600 " + idRsa)); return new StatementList(statements.build()).render(family); } InstallRSAPrivateKey(String privateKey);  InstallRSAPrivateKey(String sshDir, String privateKey); @Override Iterable<String> functionDependencies(OsFamily family); @Override String render(OsFamily family);  }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testInstallRSAPrivateKeyWINDOWS() { new InstallRSAPrivateKey("-----BEGIN RSA PRIVATE KEY-----\n-----END RSA PRIVATE KEY-----\n") .render(OsFamily.WINDOWS); }