Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DAF74D6B6 for ; Tue, 20 Nov 2012 21:20:33 +0000 (UTC) Received: (qmail 6658 invoked by uid 500); 20 Nov 2012 21:20:33 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 6595 invoked by uid 500); 20 Nov 2012 21:20:33 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 6588 invoked by uid 99); 20 Nov 2012 21:20:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Nov 2012 21:20:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED 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; Tue, 20 Nov 2012 21:20:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A607E2388900; Tue, 20 Nov 2012 21:20:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1411882 - in /hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common: CHANGES.txt src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java Date: Tue, 20 Nov 2012 21:20:08 -0000 To: common-commits@hadoop.apache.org From: eli@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121120212009.A607E2388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: eli Date: Tue Nov 20 21:20:07 2012 New Revision: 1411882 URL: http://svn.apache.org/viewvc?rev=1411882&view=rev Log: HADOOP-9042. Add a test for umask in FileSystemContractBaseTest. Contributed by Colin McCabe Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1411882&r1=1411881&r2=1411882&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt Tue Nov 20 21:20:07 2012 @@ -91,6 +91,9 @@ Release 2.0.3-alpha - Unreleased HADOOP-8926. hadoop.util.PureJavaCrc32 cache hit-ratio is low for static data (Gopal V via bobby) + HADOOP-9042. Add a test for umask in FileSystemContractBaseTest. + (Colin McCabe via eli) + BUG FIXES HADOOP-8795. BASH tab completion doesn't look in PATH, assumes path to Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java?rev=1411882&r1=1411881&r2=1411882&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java (original) +++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java Tue Nov 20 21:20:07 2012 @@ -23,11 +23,13 @@ import java.io.IOException; import junit.framework.TestCase; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsPermission; /** *

@@ -43,7 +45,7 @@ import org.apache.hadoop.fs.Path; *

*/ public abstract class FileSystemContractBaseTest extends TestCase { - + protected final static String TEST_UMASK = "062"; protected FileSystem fs; protected byte[] data = new byte[getBlockSize() * 2]; // two blocks of data { @@ -151,7 +153,26 @@ public abstract class FileSystemContract assertFalse(fs.exists(testDeepSubDir)); } - + + public void testMkdirsWithUmask() throws Exception { + if (fs.getScheme().equals("s3") || fs.getScheme().equals("s3n")) { + // skip permission tests for S3FileSystem until HDFS-1333 is fixed. + return; + } + Configuration conf = fs.getConf(); + String oldUmask = conf.get(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY); + try { + conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, TEST_UMASK); + final Path dir = new Path("/test/newDir"); + assertTrue(fs.mkdirs(dir, new FsPermission((short)0777))); + FileStatus status = fs.getFileStatus(dir); + assertTrue(status.isDirectory()); + assertEquals((short)0715, status.getPermission().toShort()); + } finally { + conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, oldUmask); + } + } + public void testGetFileStatusThrowsExceptionForNonExistentFile() throws Exception { try {