Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 41F2E79D1 for ; Wed, 28 Sep 2011 03:01:16 +0000 (UTC) Received: (qmail 77474 invoked by uid 500); 28 Sep 2011 03:01:15 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 77438 invoked by uid 500); 28 Sep 2011 03:01:15 -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 77392 invoked by uid 99); 28 Sep 2011 03:01:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 03:01:13 +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; Wed, 28 Sep 2011 03:01:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0FB972388A64; Wed, 28 Sep 2011 03:00:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1176691 - in /hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java Date: Wed, 28 Sep 2011 03:00:48 -0000 To: hdfs-commits@hadoop.apache.org From: todd@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110928030049.0FB972388A64@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: todd Date: Wed Sep 28 03:00:48 2011 New Revision: 1176691 URL: http://svn.apache.org/viewvc?rev=1176691&view=rev Log: HDFS-2332. Add test for HADOOP-7629 (using an immutable FsPermission object as an RPC parameter fails). Contributed by Todd Lipcon. Modified: hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java Modified: hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1176691&r1=1176690&r2=1176691&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Sep 28 03:00:48 2011 @@ -686,6 +686,9 @@ Release 0.23.0 - Unreleased HdfsConstants. (Harsh J Chouraria via atm) HDFS-2197. Refactor RPC call implementations out of NameNode class (todd) + HDFS-2332. Add test for HADOOP-7629 (using an immutable FsPermission + object as an RPC parameter fails). (todd) + OPTIMIZATIONS HDFS-1458. Improve checkpoint performance by avoiding unnecessary image Modified: hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java?rev=1176691&r1=1176690&r2=1176691&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java (original) +++ hadoop/common/branches/branch-0.23/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSPermission.java Wed Sep 28 03:00:48 2011 @@ -72,6 +72,7 @@ public class TestDFSPermission extends T final private static Path NON_EXISTENT_FILE = new Path("/NonExistentFile"); private FileSystem fs; + private MiniDFSCluster cluster; private static Random r; static { @@ -105,18 +106,25 @@ public class TestDFSPermission extends T } } + @Override + public void setUp() throws IOException { + cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build(); + cluster.waitActive(); + } + + @Override + public void tearDown() throws IOException { + if (cluster != null) { + cluster.shutdown(); + } + } + /** This tests if permission setting in create, mkdir, and * setPermission works correctly */ public void testPermissionSetting() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build(); - try { - cluster.waitActive(); - testPermissionSetting(OpType.CREATE); // test file creation - testPermissionSetting(OpType.MKDIRS); // test directory creation - } finally { - cluster.shutdown(); - } + testPermissionSetting(OpType.CREATE); // test file creation + testPermissionSetting(OpType.MKDIRS); // test directory creation } private void initFileSystem(short umask) throws Exception { @@ -245,17 +253,22 @@ public class TestDFSPermission extends T } } + /** + * check that ImmutableFsPermission can be used as the argument + * to setPermission + */ + public void testImmutableFsPermission() throws IOException { + fs = FileSystem.get(conf); + + // set the permission of the root to be world-wide rwx + fs.setPermission(new Path("/"), + FsPermission.createImmutable((short)0777)); + } + /* check if the ownership of a file/directory is set correctly */ public void testOwnership() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build(); - try { - cluster.waitActive(); - testOwnership(OpType.CREATE); // test file creation - testOwnership(OpType.MKDIRS); // test directory creation - } finally { - fs.close(); - cluster.shutdown(); - } + testOwnership(OpType.CREATE); // test file creation + testOwnership(OpType.MKDIRS); // test directory creation } /* change a file/directory's owner and group. @@ -342,9 +355,7 @@ public class TestDFSPermission extends T /* Check if namenode performs permission checking correctly for * superuser, file owner, group owner, and other users */ public void testPermissionChecking() throws Exception { - MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build(); try { - cluster.waitActive(); fs = FileSystem.get(conf); // set the permission of the root to be world-wide rwx @@ -401,7 +412,6 @@ public class TestDFSPermission extends T parentPermissions, permissions, parentPaths, filePaths, dirPaths); } finally { fs.close(); - cluster.shutdown(); } }