hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject svn commit: r1500190 - /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
Date Sat, 06 Jul 2013 02:16:28 GMT
Author: harsh
Date: Sat Jul  6 02:16:27 2013
New Revision: 1500190

URL: http://svn.apache.org/r1500190
Log:
HADOOP-8844. Add a plaintext fs -text test-case. Contributed by Akira AJISAKA. (harsh)

Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java?rev=1500190&r1=1500189&r2=1500190&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
Sat Jul  6 02:16:27 2013
@@ -676,6 +676,22 @@ public class TestDFSShell {
       assertTrue("Output doesn't match input",
           Arrays.equals(writebytes, out.toByteArray()));
       out.reset();
+      
+      // Test a plain text.
+      OutputStream pout = fs.create(new Path(root, "file.txt"));
+      writebytes = "bar".getBytes();
+      pout.write(writebytes);
+      pout.close();
+      out = new ByteArrayOutputStream();
+      System.setOut(new PrintStream(out));
+      argv = new String[2];
+      argv[0] = "-text";
+      argv[1] = new Path(root, "file.txt").toString();
+      ret = ToolRunner.run(new FsShell(conf), argv);
+      assertEquals("'-text " + argv[1] + " returned " + ret, 0, ret);
+      assertTrue("Output doesn't match input",
+          Arrays.equals(writebytes, out.toByteArray()));
+      out.reset();
     } finally {
       if (null != bak) {
         System.setOut(bak);



Mime
View raw message