Author: sebb Date: Wed Apr 15 12:59:36 2009 New Revision: 765173 URL: http://svn.apache.org/viewvc?rev=765173&view=rev Log: Extra test case
Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java?rev=765173&r1=765172&r2=765173&view=diff ============================================================================== --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Wed Apr 15 12:59:36 2009 @@ -105,6 +105,45 @@ } /** + * Tries to delete the folder "la" from an archive file. This should result in + * the deletion of la/*, which should not match any files/folders. + * + * @throws Exception + */ + public void testDeleteDir2() throws Exception { + final String archivename = "cpio"; + File input = this.createArchive(archivename); + + ArchiveOutputStream out = null; + ArchiveInputStream ais = null; + File result = File.createTempFile("test", "."+archivename); + result.deleteOnExit(); + try { + + final InputStream is = new FileInputStream(input); + ais = factory.createArchiveInputStream(archivename, is); + + out = factory.createArchiveOutputStream(archivename, + new FileOutputStream(result)); + + ChangeSet changes = new ChangeSet(); + changes.deleteDir("la"); + archiveListDeleteDir("la"); + ChangeSetPerformer performer = new ChangeSetPerformer(changes); + performer.perform(ais, out); + is.close(); + + } finally { + if (out != null) + out.close(); + if (ais != null) + ais.close(); + } + + this.checkArchiveContent(result, archiveList); + } + + /** * Tries to delete the file "bla/test5.xml" from an archive. This should * result in the deletion of "bla/test5.xml". *