bb.io
Class ZipUtil.UnitTest

java.lang.Object
  extended by bb.io.ZipUtil.UnitTest
Enclosing class:
ZipUtil

public static class ZipUtil.UnitTest
extends Object

See the Overview page of the project's javadocs for a general description of this unit test class.


Field Summary
private static AtomicLong id
           
private static File root
           
 
Constructor Summary
ZipUtil.UnitTest()
           
 
Method Summary
private  void archive_extract(File dirToArchive, String type)
           
private  void archiveWithDifferentProgram(File dirToArchive, File zipFile)
           
private  void confirmExtraction(File dirToArchive, File directoryExtraction)
           
private  void extractWithDifferentProgram(File zipFile, File directoryExtraction)
           
(package private) static File makeArchiveFile(String type)
          Result is always a temporary file that initially contains no data.
(package private) static File makeDataFile(File parent, long length)
          Result is always a temporary file of the specified length (its data consists of the Latin alphabet continuously repeated).
(package private) static File makeDirectory(String namePrefix)
          Result is always a directory located inside root, with the specified name, that does not currently exist (hence, contains no data).
private static void printEntries(File zipFile)
           
 void test_archive_extract_fileSizeLimit_shouldFail()
           
 void test_archive_extract_fileSizeLimit_shouldPass()
           
 void test_archive_extract()
           
private  String unZipCommand(File zipFile)
           
private  String zipCommand(File dirToArchive, File zipFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private static final File root

id

private static final AtomicLong id
Constructor Detail

ZipUtil.UnitTest

public ZipUtil.UnitTest()
Method Detail

makeDataFile

static File makeDataFile(File parent,
                         long length)
                  throws IllegalArgumentException,
                         IOException
Result is always a temporary file of the specified length (its data consists of the Latin alphabet continuously repeated). Its name includes an ID number as well as its length in bytes, which makes it unique (for this JVM session).

Throws:
IllegalArgumentException
IOException

makeArchiveFile

static File makeArchiveFile(String type)
Result is always a temporary file that initially contains no data. Its name includes an ID number, which makes it unique (for this JVM session).


makeDirectory

static File makeDirectory(String namePrefix)
Result is always a directory located inside root, with the specified name, that does not currently exist (hence, contains no data). Its name starts with namePrefix, and is then followed by "Dir#" and then an ID number, which makes it unique (for this JVM session).


test_archive_extract

public void test_archive_extract()
                          throws Exception
Throws:
Exception

archive_extract

private void archive_extract(File dirToArchive,
                             String type)
                      throws Exception
Throws:
Exception

confirmExtraction

private void confirmExtraction(File dirToArchive,
                               File directoryExtraction)
                        throws Exception
Throws:
Exception

extractWithDifferentProgram

private void extractWithDifferentProgram(File zipFile,
                                         File directoryExtraction)
                                  throws Exception
Throws:
Exception

unZipCommand

private String unZipCommand(File zipFile)
                     throws Exception
Throws:
Exception

archiveWithDifferentProgram

private void archiveWithDifferentProgram(File dirToArchive,
                                         File zipFile)
                                  throws Exception
Throws:
Exception

zipCommand

private String zipCommand(File dirToArchive,
                          File zipFile)
                   throws Exception
Throws:
Exception

test_archive_extract_fileSizeLimit_shouldPass

public void test_archive_extract_fileSizeLimit_shouldPass()
                                                   throws Exception
Throws:
Exception

test_archive_extract_fileSizeLimit_shouldFail

public void test_archive_extract_fileSizeLimit_shouldFail()
                                                   throws Exception
Throws:
Exception

printEntries

private static void printEntries(File zipFile)
                          throws Exception
Throws:
Exception