From hdfs-commits-return-623-apmail-hadoop-hdfs-commits-archive=hadoop.apache.org@hadoop.apache.org Sun Apr 25 22:42:43 2010 Return-Path: Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: (qmail 29714 invoked from network); 25 Apr 2010 22:42:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 Apr 2010 22:42:43 -0000 Received: (qmail 99597 invoked by uid 500); 25 Apr 2010 22:42:42 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 99574 invoked by uid 500); 25 Apr 2010 22:42:42 -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 99565 invoked by uid 99); 25 Apr 2010 22:42:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Apr 2010 22:42:42 +0000 X-ASF-Spam-Status: No, hits=-1429.3 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; Sun, 25 Apr 2010 22:42:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 06A342388900; Sun, 25 Apr 2010 22:41:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r937903 - in /hadoop/hdfs/trunk: CHANGES.txt src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java Date: Sun, 25 Apr 2010 22:41:57 -0000 To: hdfs-commits@hadoop.apache.org From: jghoman@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100425224158.06A342388900@eris.apache.org> Author: jghoman Date: Sun Apr 25 22:41:57 2010 New Revision: 937903 URL: http://svn.apache.org/viewvc?rev=937903&view=rev Log: HDFS-666. Unit test for FsShell -text. (cdouglas via jghoman) Modified: hadoop/hdfs/trunk/CHANGES.txt hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java Modified: hadoop/hdfs/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=937903&r1=937902&r2=937903&view=diff ============================================================================== --- hadoop/hdfs/trunk/CHANGES.txt (original) +++ hadoop/hdfs/trunk/CHANGES.txt Sun Apr 25 22:41:57 2010 @@ -148,6 +148,8 @@ Trunk (unreleased changes) HDFS-1047. Install/deploy source jars to Maven repo. (Patrick Angeles via jghoman) + HDFS-666. Unit test for FsShell -text. (cdouglas via jghoman) + OPTIMIZATIONS HDFS-946. NameNode should not return full path name when lisitng a Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java?rev=937903&r1=937902&r2=937903&view=diff ============================================================================== --- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java (original) +++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java Sun Apr 25 22:41:57 2010 @@ -541,11 +541,27 @@ public class TestDFSShell extends TestCa public void testText() throws Exception { Configuration conf = new HdfsConfiguration(); MiniDFSCluster cluster = null; - PrintStream bak = null; try { cluster = new MiniDFSCluster(conf, 2, true, null); - FileSystem fs = cluster.getFileSystem(); - Path root = new Path("/texttest"); + final FileSystem dfs = cluster.getFileSystem(); + textTest(new Path("/texttest").makeQualified(dfs.getUri(), + dfs.getWorkingDirectory()), conf); + + conf.set("fs.default.name", dfs.getUri().toString()); + final FileSystem lfs = FileSystem.getLocal(conf); + textTest(new Path(TEST_ROOT_DIR, "texttest").makeQualified(lfs.getUri(), + lfs.getWorkingDirectory()), conf); + } finally { + if (null != cluster) { + cluster.shutdown(); + } + } + } + + private void textTest(Path root, Configuration conf) throws Exception { + PrintStream bak = null; + try { + final FileSystem fs = root.getFileSystem(conf); fs.mkdirs(root); OutputStream zout = new GZIPOutputStream( fs.create(new Path(root, "file.gz"))); @@ -564,21 +580,17 @@ public class TestDFSShell extends TestCa String[] argv = new String[2]; argv[0] = "-text"; - argv[1] = new Path(root, "file.gz").toUri().getPath(); - int ret = ToolRunner.run(new FsShell(), argv); - assertTrue("-text returned -1", 0 >= ret); + argv[1] = new Path(root, "file.gz").toString(); + int ret = ToolRunner.run(new FsShell(conf), argv); + assertEquals("'-text " + argv[1] + " returned " + ret, 0, ret); file.reset(); out.reset(); assertTrue("Output doesn't match input", Arrays.equals(file.toByteArray(), out.toByteArray())); - } finally { if (null != bak) { System.setOut(bak); } - if (null != cluster) { - cluster.shutdown(); - } } } @@ -697,7 +709,8 @@ public class TestDFSShell extends TestCa final FileSystem localfs = FileSystem.getLocal(conf); Path localpath = new Path(TEST_ROOT_DIR, "testcount"); - localpath = localpath.makeQualified(localfs); + localpath = localpath.makeQualified(localfs.getUri(), + localfs.getWorkingDirectory()); localfs.mkdirs(localpath); final String localstr = localpath.toString();