示例#1
0
 @Test
 public void testBuild__File_File() {
   try {
     File installFolder = ForgeTests.getTestOutputFolder("apache-install-here", true);
     File resultFolder = ForgeTests.getTestOutputFolder("apache-build-result", true);
     FileUtils.cpR(
         Activator.getTestData("puppetlabs-apache"),
         installFolder,
         FileUtils.DEFAULT_EXCLUDES,
         false,
         true);
     Metadata md = fixture.build(installFolder, resultFolder);
     String archiveName = md.getFullName() + '-' + md.getVersion();
     File builtArchive = new File(resultFolder, archiveName + ".tar.gz");
     assertTrue("Build did not build any archive", builtArchive.canRead());
     File unpackFolder = ForgeTests.getTestOutputFolder("apache-unpack-result", true);
     InputStream input = new GZIPInputStream(new FileInputStream(builtArchive));
     try {
       TarUtils.unpack(input, unpackFolder, false);
     } finally {
       StreamUtil.close(input);
     }
     assertTrue(
         "Archive doesn't contain the expected top folder",
         new File(unpackFolder, archiveName).isDirectory());
   } catch (IOException e) {
     fail(e.getMessage());
   } catch (IncompleteException e) {
     fail(e.getMessage());
   }
 }
示例#2
0
 @Test
 public void testChanges__File() {
   try {
     File installFolder = ForgeTests.getTestOutputFolder("test-changes", true);
     File resultFolder = ForgeTests.getTestOutputFolder("test-changes-result", true);
     FileUtils.cpR(
         Activator.getTestData("puppetlabs-apache"),
         installFolder,
         FileUtils.DEFAULT_EXCLUDES,
         false,
         true);
     fixture.build(installFolder, resultFolder);
     List<File> changes = fixture.changes(installFolder);
     assertTrue("Unexpected changes", changes.isEmpty());
   } catch (IOException e) {
     fail(e.getMessage());
   } catch (IncompleteException e) {
     fail(e.getMessage());
   }
 }