Author: bodewig Date: Mon Feb 23 08:21:40 2009 New Revision: 746917 URL: http://svn.apache.org/viewvc?rev=746917&view=rev Log: EFS-Flag interop test using 7-Zip created file submitted by wolfgang Glas. SANDBOX-176
Added: commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip (with props) commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip (with props) Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java?rev=746917&r1=746916&r2=746917&view=diff ============================================================================== --- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java (original) +++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java Mon Feb 23 08:21:40 2009 @@ -22,6 +22,9 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URL; +import java.net.URISyntaxException; import java.nio.charset.Charset; import java.nio.charset.UnsupportedCharsetException; import java.util.Enumeration; @@ -36,22 +39,38 @@ private static final String EURO_FOR_DOLLAR_TXT = "\u20AC_for_Dollar.txt"; private static final String OIL_BARREL_TXT = "\u00D6lf\u00E4sser.txt"; - public void testUtf8FileRoundtrip() throws IOException { + public void xtestUtf8FileRoundtrip() throws IOException { testFileRoundtrip(UTF_8, true); } - public void testUtf8FileRoundtripNoEFS() throws IOException { + public void xtestUtf8FileRoundtripNoEFS() throws IOException { testFileRoundtrip(UTF_8, false); } - public void testCP437FileRoundtrip() throws IOException { + public void xtestCP437FileRoundtrip() throws IOException { testFileRoundtrip(CP437, false); } - public void testASCIIFileRoundtrip() throws IOException { + public void xtestASCIIFileRoundtrip() throws IOException { testFileRoundtrip(US_ASCII, false); } + /** + * 7-ZIP created archive, uses EFS to signal UTF-8 filenames. + */ + public void testReadEFS() throws IOException, URISyntaxException { + URL zip = getClass().getResource("/utf8-7zip-test.zip"); + File archive = new File(new URI(zip.toString())); + ZipFile zf = null; + try { + zf = new ZipFile(archive); + assertNotNull(zf.getEntry(ASCII_TXT)); + assertNotNull(zf.getEntry(EURO_FOR_DOLLAR_TXT)); + } finally { + ZipFile.closeQuietly(zf); + } + } + private static void testFileRoundtrip(String encoding, boolean withEFS) throws IOException { Added: commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip?rev=746917&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip?rev=746917&view=auto ============================================================================== Binary file - no diff available. Propchange: commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream