Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 60698 invoked from network); 10 May 2010 14:38:37 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 May 2010 14:38:37 -0000 Received: (qmail 8323 invoked by uid 500); 10 May 2010 14:38:36 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 8252 invoked by uid 500); 10 May 2010 14:38:35 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 8201 invoked by uid 99); 10 May 2010 14:38:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 May 2010 14:38:35 +0000 X-ASF-Spam-Status: No, hits=-1539.6 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 May 2010 14:38:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CE4D323889F1; Mon, 10 May 2010 14:37:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100510143737.CE4D323889F1@eris.apache.org> 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