@Test
public void testUpload()
    throws IOException, UploaderException, InterruptedException {

  final String fileName = "/upload.tar.gz";
  File parent = new File(testDir);
  try {
    parent.deleteOnExit();
    FrameworkUploader uploader = prepareTree(parent);
    uploader.target = "file://" + parent.getAbsolutePath() + fileName;
    uploader.buildPackage();
    try (TarArchiveInputStream archiveInputStream = new TarArchiveInputStream(
        new GZIPInputStream(
            new FileInputStream(
                parent.getAbsolutePath() + fileName)))) {
      Set<String> fileNames = new HashSet<>();
      Set<Long> sizes = new HashSet<>();
      TarArchiveEntry entry1 = archiveInputStream.getNextTarEntry();
      fileNames.add(entry1.getName());
      sizes.add(entry1.getSize());
      TarArchiveEntry entry2 = archiveInputStream.getNextTarEntry();
      fileNames.add(entry2.getName());
      sizes.add(entry2.getSize());
      Assert.assertTrue(
          "File name error", fileNames.contains("a.jar"));
      Assert.assertTrue(
          "File size error", sizes.contains((long) 13));
      Assert.assertTrue(
          "File name error", fileNames.contains("b.jar"));
      Assert.assertTrue(
          "File size error", sizes.contains((long) 14));
    }
  } finally {
    FileUtils.deleteDirectory(parent);
  }
}