InstallPackages extends PuppetActivity { @Override public String createPuppetScript(Pool pool, Machine machine) throws IOException { return Mustache.toString(InstallPackages.class, PACKAGES_TEMPLATE, ImmutableMap.of("packages", packagesAsListOfMaps(pool.getSoftware()))); } InstallPackages(); @Override String createPuppetScript(Pool pool, Machine machine); static final String PACKAGES_TEMPLATE; }
@Test public void testCreatePuppetScript() throws Exception { Pool pool = mock(Pool.class); when(pool.getSoftware()).thenReturn(Software.builder() .packages("git-core", "vim").createSoftware()); PuppetActivity activity = new InstallPackages(); String content = activity.createPuppetScript(pool, null); assertThat(content).contains( "Package { ensure => \"installed\" }\n" + "\n" + "package { \"git-core\": }\n" + "package { \"vim\": }\n" ); }