commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r942754 - in /commons/proper/compress/trunk/src/test: java/org/apache/commons/compress/archivers/tar/ resources/tarlongpath/
Date Mon, 10 May 2010 14:37:37 GMT
Author: sebb
Date: Mon May 10 14:37:37 2010
New Revision: 942754

URL: http://svn.apache.org/viewvc?rev=942754&view=rev
Log:
Add some tar long name archive tests

Added:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java
  (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/
    commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_gnu.tar   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_oldgnu.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_pax.tar   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_posix.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_ustar.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/files.txt   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson-E.tar   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson.tar   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_pax.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_posix.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_ustar.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_gnu.tar   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_oldgnu.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_pax.tar   (with props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_posix.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_ustar.tar   (with
props)
    commons/proper/compress/trunk/src/test/resources/tarlongpath/winXP_antgnu.tar   (with
props)

Added: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java?rev=942754&view=auto
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java
(added)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java
Mon May 10 14:37:37 2010
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ */
+
+package org.apache.commons.compress.archivers.tar;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.compress.AbstractTestCase;
+
+/**
+ * Test that can read various tar file examples.
+ * 
+ * The class uses nested suites in order to be able to name the test after the file name,
+ * as JUnit does not allow one to change the display name of a test.
+ */
+public class TarReadTests extends AbstractTestCase {
+    
+    private static final ClassLoader classLoader = TarReadTests.class.getClassLoader();
+
+    private File file;
+
+    private static final ArrayList fileList = new ArrayList();
+    
+    public TarReadTests(String name) {
+        super(name);
+    }
+    
+    private TarReadTests(String name, File file){
+        super(name);
+        this.file = file;
+    }
+    
+    public static TestSuite suite() throws IOException{
+        TestSuite suite = new TestSuite("TarReadTests");
+        File arcdir =new File(classLoader.getResource("tarlongpath").getFile());
+        assertTrue(arcdir.exists());
+        File listing= new File(arcdir,"files.txt");
+        assertTrue("File listing is readable",listing.canRead());
+        BufferedReader br = new BufferedReader(new FileReader(listing));
+        String line;
+        while ((line=br.readLine())!=null){
+            if (line.startsWith("#")){
+                continue;
+            }
+            fileList.add(line);
+        }
+        br.close();
+        File[]files=arcdir.listFiles();
+        for (int i=0; i<files.length; i++){
+            final File file = files[i];
+            if (file.getName().endsWith(".txt")){
+                continue;
+            }
+            // Appears to be the only way to give the test a variable name
+            TestSuite namedSuite = new TestSuite(file.getName());
+            Test test = new TarReadTests("testArchive", file);
+            namedSuite.addTest(test);
+            suite.addTest(namedSuite);
+        }        
+        return suite;
+    }
+    
+    public void testArchive() throws Exception{
+        ArrayList expected=(ArrayList) fileList.clone();
+        checkArchiveContent(new TarArchiveInputStream(new FileInputStream(file)), expected);
+    }
+}

Propchange: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarReadTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_gnu.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_gnu.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_gnu.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_oldgnu.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_oldgnu.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_oldgnu.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_pax.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_pax.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_pax.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_posix.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_posix.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_posix.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_ustar.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_ustar.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/cygwin_ustar.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/files.txt
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/files.txt?rev=942754&view=auto
==============================================================================
--- commons/proper/compress/trunk/src/test/resources/tarlongpath/files.txt (added)
+++ commons/proper/compress/trunk/src/test/resources/tarlongpath/files.txt Mon May 10 14:37:37
2010
@@ -0,0 +1,42 @@
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+# 
+#       http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+#
+#   File prefixes correspond to the following OSes:
+#   cygwin - CYGWIN_NT-5.1 1.7.1(0.218/5/3)
+#   hudson - SunOS 5.10
+#   minotaur - FreeBSD 8.0-STABLE
+#   vmgump - Linux 2.6.24-27-server 
+#   winXP_ant - Ant 1.7.1 on Windows/XP
+#
+compress-test/
+compress-test/dir1/
+compress-test/dir1/dir2/
+compress-test/dir1/dir2/dir3/
+compress-test/dir1/dir2/dir3/dir4/
+compress-test/dir1/dir2/dir3/dir4/dir5/
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file12345678901234567890.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file1234567890123456789012345678901234567890123456789012345678901234567890.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file123456789012345678901234567890123456789012345678901234567890.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file123456789012345678901234567890.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file1234567890.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file1234567890123456789012345678901234567890.txt
+compress-test/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/file12345678901234567890123456789012345678901234567890.txt
\ No newline at end of file

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/files.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson-E.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson-E.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson-E.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/hudson.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_pax.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_pax.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_pax.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_posix.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_posix.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_posix.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_ustar.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_ustar.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/minotaur_ustar.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_gnu.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_gnu.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_gnu.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_oldgnu.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_oldgnu.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_oldgnu.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_pax.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_pax.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_pax.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_posix.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_posix.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_posix.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_ustar.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_ustar.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/vmgump_ustar.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/compress/trunk/src/test/resources/tarlongpath/winXP_antgnu.tar
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/tarlongpath/winXP_antgnu.tar?rev=942754&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/tarlongpath/winXP_antgnu.tar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message