DownloadFiles extends PuppetActivity { @Override public String createPuppetScript(Pool pool, Machine machine) throws Exception { return Mustache.toString(InstallPackages.class, FILES_TEMPLATE, ImmutableMap.of("files", filesAsListOfMaps(pool.getSoftware()))); } DownloadFiles(); @Override String createPuppetScript(Pool pool, Machine machine); static final String FILES_TEMPLATE; }
@Test public void testCreatePuppetScript() throws Exception { Software software = Software.builder() .file("http: .file("http: .createSoftware(); Pool pool = mock(Pool.class); when(pool.getSoftware()).thenReturn(software); PuppetActivity activity = new DownloadFiles(); String content = activity.createPuppetScript(pool, null); assertThat(content) .contains("download_file {\"/opt/test.tar.gz\":\n" + " uri => \"http: "}") .contains("download_file {\"/opt/google.html\":\n" + " uri => \"http: "}"); assertThat(activity.createAdditionalFiles(pool, null)).isEmpty(); }