hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1102947 - in /hadoop/hdfs/trunk: CHANGES.txt src/test/hdfs/org/apache/hadoop/hdfs/TestDFSShell.java
Date Sat, 14 May 2011 03:56:12 GMT
Author: todd
Date: Sat May 14 03:56:12 2011
New Revision: 1102947

URL: http://svn.apache.org/viewvc?rev=1102947&view=rev
Log:
HDFS-1933. Update TestDFSShell for improved "test" shell command. Contributed by Daryn Sharp.

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=1102947&r1=1102946&r2=1102947&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Sat May 14 03:56:12 2011
@@ -561,6 +561,9 @@ Trunk (unreleased changes)
     HDFS-1929. TestEditLogFileOutputStream fails if running on same host as NN
     (Aaron T. Myers via todd)
 
+    HDFS-1933. Update TestDFSShell for improved "test" shell command. (Daryn
+    Sharp via todd)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

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=1102947&r1=1102946&r2=1102947&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 Sat May 14 03:56:12
2011
@@ -1028,17 +1028,43 @@ public class TestDFSShell extends TestCa
 
       // Verify touch/test
       {
-        String[] args = new String[2];
+        String[] args;
+        int val;
+
+        args = new String[3];
+        args[0] = "-test";
+        args[1] = "-e";
+        args[2] = "/test/mkdirs/noFileHere";
+        val = -1;
+        try {
+          val = shell.run(args);
+        } catch (Exception e) {
+          System.err.println("Exception raised from DFSShell.run " +
+                             e.getLocalizedMessage());
+        }
+        assertEquals(1, val);
+
+        args[1] = "-z";
+        val = -1;
+        try {
+          val = shell.run(args);
+        } catch (Exception e) {
+          System.err.println("Exception raised from DFSShell.run " +
+                             e.getLocalizedMessage());
+        }
+        assertEquals(1, val);
+
+        args = new String[2];
         args[0] = "-touchz";
         args[1] = "/test/mkdirs/noFileHere";
-        int val = -1;
+        val = -1;
         try {
           val = shell.run(args);
         } catch (Exception e) {
           System.err.println("Exception raised from DFSShell.run " +
                              e.getLocalizedMessage());
         }
-        assertTrue(val == 0);
+        assertEquals(0, val);
 
         args = new String[3];
         args[0] = "-test";
@@ -1051,7 +1077,27 @@ public class TestDFSShell extends TestCa
           System.err.println("Exception raised from DFSShell.run " +
                              e.getLocalizedMessage());
         }
-        assertTrue(val == 0);
+        assertEquals(0, val);
+
+        args[1] = "-d";
+        val = -1;
+        try {
+          val = shell.run(args);
+        } catch (Exception e) {
+          System.err.println("Exception raised from DFSShell.run " +
+                             e.getLocalizedMessage());
+        }
+        assertEquals(1, val);
+
+        args[1] = "-z";
+        val = -1;
+        try {
+          val = shell.run(args);
+        } catch (Exception e) {
+          System.err.println("Exception raised from DFSShell.run " +
+                             e.getLocalizedMessage());
+        }
+        assertEquals(0, val);
       }
 
       // Verify that cp from a directory to a subdirectory fails



Mime
View raw message