public void testZipNonConcurrentResourceCollection() throws Exception {
    final File tarFile = getTestFile("target/output/zip-non-concurrent.tar");
    TarArchiver tarArchiver = (TarArchiver) lookup(Archiver.ROLE, "tar");
    tarArchiver.setDestFile(tarFile);
    // We're testing concurrency issue so we need large amount of files
    for (int i = 0; i < 100; i++) {
      tarArchiver.addFile(
          getTestFile("src/test/resources/manifests/manifest1.mf"), "manifest1.mf" + i);
      // Directories are added separately so let's test them too
      tarArchiver.addFile(
          getTestFile("src/test/resources/manifests/manifest2.mf"), "subdir" + i + "/manifest2.mf");
    }
    tarArchiver.createArchive();

    final File zipFile = new File("target/output/zip-non-concurrent.zip");
    ZipArchiver zipArchive = getZipArchiver(zipFile);
    zipArchive.addArchivedFileSet(tarFile, "prfx/");
    zipArchive.setEncoding("UTF-8");
    zipArchive.createArchive();

    final TarFile cmp1 = new TarFile(tarFile);
    final ZipFile cmp2 = new ZipFile(zipFile);
    ArchiveFileComparator.assertEquals(cmp1, cmp2, "prfx/");
    cmp1.close();
    cmp2.close();
  }
  public void testCreateResourceCollection() throws Exception {
    final File srcDir = new File("src");
    final File zipFile = new File("target/output/src.zip");
    ZipArchiver zipArchiver = getZipArchiver(zipFile);
    zipArchiver.addDirectory(srcDir, null, FileUtils.getDefaultExcludes());
    zipArchiver.setEncoding("UTF-8");
    FileUtils.removePath(zipFile.getPath());
    zipArchiver.createArchive();

    final File zipFile2 = new File("target/output/src2.zip");
    ZipArchiver zipArchiver2 = getZipArchiver(zipFile2);
    zipArchiver2.addArchivedFileSet(zipFile, "prfx/");
    zipArchiver2.setEncoding("UTF-8");
    FileUtils.removePath(zipFile2.getPath());
    zipArchiver2.createArchive();

    final ZipFile cmp1 = new ZipFile(zipFile);
    final ZipFile cmp2 = new ZipFile(zipFile2);
    ArchiveFileComparator.assertEquals(cmp1, cmp2, "prfx/");
    cmp1.close();
    cmp2.close();
  }
 public void testDefaultUTF8withUTF8() throws IOException {
   final ZipArchiver zipArchiver = getZipArchiver(new File("target/output/utf8-with_utf.zip"));
   zipArchiver.setEncoding("UTF-8");
   zipArchiver.addDirectory(new File("src/test/resources/miscUtf8"));
   zipArchiver.createArchive();
 }