Return-Path: Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: (qmail 27173 invoked from network); 24 Apr 2010 07:29:54 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 24 Apr 2010 07:29:54 -0000 Received: (qmail 61908 invoked by uid 500); 24 Apr 2010 07:29:54 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 61836 invoked by uid 500); 24 Apr 2010 07:29:52 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 61824 invoked by uid 99); 24 Apr 2010 07:29:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Apr 2010 07:29:50 +0000 X-ASF-Spam-Status: No, hits=-1389.7 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; Sat, 24 Apr 2010 07:29:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 23C7623888FE; Sat, 24 Apr 2010 07:29:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r937599 - in /hadoop/hdfs/trunk: CHANGES.txt src/test/hdfs/org/apache/hadoop/security/TestPermission.java Date: Sat, 24 Apr 2010 07:29:07 -0000 To: hdfs-commits@hadoop.apache.org From: suresh@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100424072907.23C7623888FE@eris.apache.org> Author: suresh Date: Sat Apr 24 07:29:06 2010 New Revision: 937599 URL: http://svn.apache.org/viewvc?rev=937599&view=rev Log: HDFS-1099. Add test for umask backward compatibility. Contributed by Suresh Srinivas. Modified: hadoop/hdfs/trunk/CHANGES.txt hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/security/TestPermission.java Modified: hadoop/hdfs/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=937599&r1=937598&r2=937599&view=diff ============================================================================== --- hadoop/hdfs/trunk/CHANGES.txt (original) +++ hadoop/hdfs/trunk/CHANGES.txt Sat Apr 24 07:29:06 2010 @@ -140,6 +140,8 @@ Trunk (unreleased changes) HDFS-1083. Update TestHDFSCLI not to expect exception class name in error messages. (suresh) + HDFS-1099. Add test for umask backward compatibility. (suresh) + OPTIMIZATIONS HDFS-946. NameNode should not return full path name when lisitng a Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/security/TestPermission.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/security/TestPermission.java?rev=937599&r1=937598&r2=937599&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/security/TestPermission.java (original) +++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/security/TestPermission.java Sat Apr 24 07:29:06 2010 @@ -61,6 +61,39 @@ public class TestPermission extends Test return s.getPermission(); } + /** + * Tests backward compatibility. Configuration can be + * either set with old param dfs.umask that takes decimal umasks + * or dfs.umaskmode that takes symbolic or octal umask. + */ + public void testBackwardCompatibility() { + // Test 1 - old configuration key with decimal + // umask value should be handled when set using + // FSPermission.setUMask() API + FsPermission perm = new FsPermission((short)18); + Configuration conf = new Configuration(); + FsPermission.setUMask(conf, perm); + assertEquals(18, FsPermission.getUMask(conf).toShort()); + + // Test 2 - old configuration key set with decimal + // umask value should be handled + perm = new FsPermission((short)18); + conf = new Configuration(); + conf.set(FsPermission.DEPRECATED_UMASK_LABEL, "18"); + assertEquals(18, FsPermission.getUMask(conf).toShort()); + + // Test 3 - old configuration key overrides the new one + conf = new Configuration(); + conf.set(FsPermission.DEPRECATED_UMASK_LABEL, "18"); + conf.set(FsPermission.UMASK_LABEL, "000"); + assertEquals(18, FsPermission.getUMask(conf).toShort()); + + // Test 4 - new configuration key is handled + conf = new Configuration(); + conf.set(FsPermission.UMASK_LABEL, "022"); + assertEquals(18, FsPermission.getUMask(conf).toShort()); + } + public void testCreate() throws Exception { Configuration conf = new HdfsConfiguration(); conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, true);