@Test public void testZipDirWithOneFile() throws IOException { fileUtils.createFileInDir(tempDir, "test1"); File dstFile = getDestinationFile(); ZipUtilities.zipDir(tempDir.getAbsolutePath(), dstFile.getAbsolutePath()); assertCountOfZipEntries(dstFile, 1); }
@VisibleForTesting public static String zipDir(String srcDir, String dstFile) throws IOException { FileOutputStream fos = new FileOutputStream(dstFile); ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(srcDir); LOG.info("Compressing directory {}", srcDir); addDirToZip(zos, srcFile, srcFile); zos.close(); LOG.info("Compressed directory {} to file: {}", srcDir, dstFile); return dstFile; }
ZipUtilities { @VisibleForTesting public static String zipDir(String srcDir, String dstFile) throws IOException { FileOutputStream fos = new FileOutputStream(dstFile); ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(srcDir); LOG.info("Compressing directory {}", srcDir); addDirToZip(zos, srcFile, srcFile); zos.close(); LOG.info("Compressed directory {} to file: {}", srcDir, dstFile); return dstFile; } }
ZipUtilities { @VisibleForTesting public static String zipDir(String srcDir, String dstFile) throws IOException { FileOutputStream fos = new FileOutputStream(dstFile); ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(srcDir); LOG.info("Compressing directory {}", srcDir); addDirToZip(zos, srcFile, srcFile); zos.close(); LOG.info("Compressed directory {} to file: {}", srcDir, dstFile); return dstFile; } private  ZipUtilities(); }
ZipUtilities { @VisibleForTesting public static String zipDir(String srcDir, String dstFile) throws IOException { FileOutputStream fos = new FileOutputStream(dstFile); ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(srcDir); LOG.info("Compressing directory {}", srcDir); addDirToZip(zos, srcFile, srcFile); zos.close(); LOG.info("Compressed directory {} to file: {}", srcDir, dstFile); return dstFile; } private  ZipUtilities(); @VisibleForTesting static String zipDir(String srcDir, String dstFile); }
ZipUtilities { @VisibleForTesting public static String zipDir(String srcDir, String dstFile) throws IOException { FileOutputStream fos = new FileOutputStream(dstFile); ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(srcDir); LOG.info("Compressing directory {}", srcDir); addDirToZip(zos, srcFile, srcFile); zos.close(); LOG.info("Compressed directory {} to file: {}", srcDir, dstFile); return dstFile; } private  ZipUtilities(); @VisibleForTesting static String zipDir(String srcDir, String dstFile);  }